Repository navigation
feat(channels): record account lifecycle facts and retire inferred health vocabularies - #117300
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 5:37 AM ET / 09:37 UTC. ClawSweeper reviewWhat this changesThis PR adds an optional recorded lifecycle state to channel account status, uses it for Gateway health, readiness, and restart decisions, and migrates Slack while retaining WhatsApp-specific diagnostics. Merge readinessKeep this PR open for maintainer review. The latest head addresses the prior WhatsApp P1 by preserving channel-authored Priority: P1 Review scores
Verification
How this fits togetherChannel plugins publish account runtime facts to the Gateway, which projects them into flowchart LR
A[Channel plugin runtime] --> B[Account status facts]
B --> C[Gateway lifecycle state]
C --> D[Shared health evaluation]
D --> E[Status and readiness]
D --> F[Restart monitor]
E --> G[Operator guidance]
Decision needed
Why: This is not merely an internal refactor: an optional Plugin SDK field changes how plugin-authored status can control shared Gateway recovery behavior, so maintainers need to choose the permanent external contract and documentation level. Before merge
Agent review detailsSecurityNone. PR surfaceSource +21, Tests +355, Generated 0, Other +74. Total +450 across 43 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt lifecycle as a documented, narrow plugin status contract only if maintainers want external channel plugins to publish those five operational states; retain WhatsApp-specific Do we have a high-confidence way to reproduce the issue? Yes for the covered boundary: the supplied mock Gateway scenario exercises a blocked Slack account through Is this the best way to solve the issue? Mostly yes: recording lifecycle at the transition owner is a stronger design than inferring it downstream, and the latest head preserves the WhatsApp diagnostics previously at risk. The remaining question is whether that lifecycle should be a documented external plugin contract rather than an internal bundled-channel fact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against aa743c9f8186. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
491e098 to
a1b2629
Compare
|
Merged via squash.
|
* origin/main: fix(test/ui): prevent shared history pollution (openclaw#117348) fix(openrouter): apply image request transport policy (openclaw#117336) perf(gateway): skip clean transcript workers (openclaw#117342) test(testing): assert relay smoke readiness fix(testing): activate relay live smoke transport feat(channels): record account lifecycle facts and retire inferred health vocabularies (openclaw#117300) fix(canvas): remove unsupported snapshot delay hint (openclaw#117326) refactor(agents): fold cache TTL pruning into prompt projection (openclaw#117313) fix(canvas): honor paired-node invocation deadlines (openclaw#117316) fix(system-agent): make exit-and-run-a-terminal guidance surface-correct (openclaw#114633) fix(ai): assistant text blocks are run together on replay (openclaw#115743) refactor(agents): canonicalize subagent execution state (openclaw#117267)
…alth vocabularies (openclaw#117300) * fix(channels): record account lifecycle facts * fix(channels): bound recorded lifecycle grace * fix(channels): preserve authored health state * test: dedupe health snapshot type literal and fix spread order
* origin/main: fix(test/ui): prevent shared history pollution (openclaw#117348) fix(openrouter): apply image request transport policy (openclaw#117336) perf(gateway): skip clean transcript workers (openclaw#117342) test(testing): assert relay smoke readiness fix(testing): activate relay live smoke transport feat(channels): record account lifecycle facts and retire inferred health vocabularies (openclaw#117300) fix(canvas): remove unsupported snapshot delay hint (openclaw#117326) refactor(agents): fold cache TTL pruning into prompt projection (openclaw#117313) fix(canvas): honor paired-node invocation deadlines (openclaw#117316) fix(system-agent): make exit-and-run-a-terminal guidance surface-correct (openclaw#114633) fix(ai): assistant text blocks are run together on replay (openclaw#115743) refactor(agents): canonicalize subagent execution state (openclaw#117267)
What Problem This Solves
Channel health is largely inferred (timers, socket flags) instead of recorded, and the one state-ish field that exists —
healthState— carries two conflicting vocabularies: policy verdicts written back by the gateway and channel-authored display strings that no core consumer reads. Concrete failures this produced: a Slack account with broken identity stayed "healthy" forever (fixed for identity specifically in #117253, but the state remained unrepresentable), operator surfaces and the health monitor could disagree, and Discord shipped its own duplicate interpretation layer over the shared verdict.Why This Change Was Made
One recorded lifecycle fact, written where transitions happen, read everywhere:
lifecycle?: "starting" | "ready" | "recovering" | "blocked" | "stopped"onChannelAccountSnapshot, surviving both projections. The gateway writesstarting(unconditionally on every start, so a staleblockedcannot outlive its cause across the blind patch-merge),ready,recovering, andstopped;blockedis plugin-authored only — Slack's identity health is the first producer.evaluateChannelHealthconsumes the recorded fact above the inference waterfall:blockedis unhealthy and non-restarting;starting/recoveringgrant startup grace bounded by the connect-grace wall clock — past the bound (or with no start timestamp) evaluation falls through to disconnected/stale/stuck inference, so a channel hung instartingcannot evade monitoring (a defect caught and fixed in review of this PR itself).healthStatebecomes derived-only (policy output at status boundaries); Slack's channel-authored writes migrate tolifecycle.collectDiscordStatusIssuesstring-matched gateway-derivedhealthStatereasons — a duplicate of the sharedcollectChannelStatusIssuessurface, and the only consumer of that vocabulary. It is deleted; parity tests prove stale-socket and running-but-disconnected Discord states remain operator-visible through the generic path. Discord-owned checks (application/intents/permissions) are untouched.User Impact
channels status, doctor, readiness, the health monitor, and auto-recovery now agree on one recorded operational state. A blocked account says blocked — and is not futilely restarted. Existing external plugins that never publishlifecycleare unaffected (optional field; socketless tri-stateconnectedsemantics preserved and test-pinned).Evidence
lifecycle:"blocked"with derivedhealthState:"blocked"inchannels.status,running:true,restartPending:false, andlastStartAtunchanged (health monitor did not restart it).plugin-sdk:api:gen).🤖 Generated with Claude Code
Review correction (accepted ClawSweeper finding)
The original absorption dropped channel-authored
healthStatefrom projections — breaking WhatsApp's owner-specific QR-login/doctor guidance (logged-out,conflict, …) and silently narrowing a shipped public snapshot field. Restored to main's exact pass-through semantics: authored values survive both projections; the shared evaluator still never readshealthState; only the pre-existing unhealthy-boundary overwrite remains; bundled Slack/Discord stay migrated tolifecycle. WhatsApp fixtures now projectlogged-out/conflictthrough the real SDK helper and assert distinct guidance. Deprecating channel-authoredhealthStateis named future SDK work, not this PR. Branch prod delta: +7 LOC (the restored pass-through), 1,166 tests across 56 files green.