feat(xdbg): add healthcheck command for local XMTP clients#3351
feat(xdbg): add healthcheck command for local XMTP clients#3351
Conversation
Adds `xdbg healthcheck` which runs 5 checks per client stored in the local identity store: missing messages, can-send, can-receive, no fork, and identity reachability. Supports --fail-fast to stop on first failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @insipx's task —— View job Code Review CompleteReview Date: March 21, 2026 02:37 UTC I've reviewed PR #3351 and found the following issues beyond what Macroscope already identified: 🔴 Critical Issues1. Incorrect
|
| impl ClientHealthResult { | ||
| fn is_healthy(&self) -> bool { | ||
| self.identity_reachable | ||
| && self | ||
| .groups | ||
| .iter() | ||
| .all(|g| g.missing_message_count == 0 && g.can_send && g.can_receive && g.is_forked != Some(true)) | ||
| } |
There was a problem hiding this comment.
🔴 Critical app/healthcheck.rs:52
In is_healthy(), g.can_send is required to be true for all groups, but the usage code only sets can_send = true on the first active group that successfully sends and then breaks. A client with multiple groups will always be reported as unhealthy because at most one group can have can_send = true. Consider changing the logic to check whether the client can send to ANY group, or track which groups are expected to be sendable.
fn is_healthy(&self) -> bool {
self.identity_reachable
&& self
.groups
.iter()
- .all(|g| g.missing_message_count == 0 && g.can_send && g.can_receive && g.is_forked != Some(true))
+ .all(|g| g.missing_message_count == 0 && g.can_receive && g.is_forked != Some(true))
}🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/xmtp_debug/src/app/healthcheck.rs around lines 52-59:
In `is_healthy()`, `g.can_send` is required to be `true` for all groups, but the usage code only sets `can_send = true` on the first active group that successfully sends and then breaks. A client with multiple groups will always be reported as unhealthy because at most one group can have `can_send = true`. Consider changing the logic to check whether the client can send to ANY group, or track which groups are expected to be sendable.
Evidence trail:
apps/xmtp_debug/src/app/healthcheck.rs lines 51-56 (is_healthy uses .all() requiring can_send=true for ALL groups), lines 182-201 (only sets can_send=true on first successful send then breaks), line 5 (documented intent says 'at least one active group')
ApprovabilityVerdict: Approved This PR adds a new diagnostic healthcheck command to the xmtp_debug tool, which is a self-contained developer utility that doesn't affect production code paths. The author owns all modified files and has extensive tenure, making this a low-risk addition within their designated domain. You can customize Macroscope's approvability policy. Learn more. |
- Print missing sequence IDs (sequence_id, originator_id) in summary - Check all fork signals: `maybe_forked` + `fork_details` in addition to `is_commit_log_forked` - Replace all println! with info! for consistent structured logging - Use owo_colors red+bold for unhealthy status, error counts, and failure messages - Exit with code 1 on failure so CI can detect unhealthy state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3351 +/- ##
==========================================
+ Coverage 82.91% 82.93% +0.02%
==========================================
Files 376 376
Lines 50896 50896
==========================================
+ Hits 42198 42209 +11
+ Misses 8698 8687 -11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
xdbg healthchecksubcommand that runs 5 health checks per client in the local identity store--fail-fast(-f) flag to stop at the first unhealthy clientTest plan
xdbg healthcheckagainst a local node with generated identities and verify outputxdbg healthcheck --fail-fastand verify it exits early on the first failurexdbg --helpshows the newhealthchecksubcommand with correct description🤖 Generated with Claude Code
Note
Add
healthcheckcommand to xmtp_debug CLI for local XMTP clientshealthchecksubcommand to args.rs with a--fail-fast(-f) flag to stop at the first unhealthy client.get_identity_updates_v2, enumerates groups, compares network vs. local messages to detect missing ones, reads fork indicators, and attempts to send a test message (xdbg-healthcheck) to an active group.std::process::exit(1)directly on unhealthy findings rather than returning an error.Macroscope summarized e61b440.