Repository navigation
fix(channels): report a channel that cannot receive as unhealthy instead of connected - #115229
Conversation
5bd0ed9 to
1943505
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 11:53 AM ET / 15:53 UTC. ClawSweeper reviewWhat this changesThe PR adds an inbound-ingress failure signal so channel status, readiness, and automatic recovery treat a channel that cannot admit messages as unhealthy even when its transport is connected. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 6 items remain Keep open: the health-model approach is sound, but the new docs promise coverage that the PR itself says Nostr does not provide, and the branch still lacks after-fix real runtime proof. Priority: P1 Review scores
Verification
How this fits togetherChannel plugins start durable ingress monitors that admit inbound events into queues. The gateway supervisor converts runtime outcomes into account snapshots, which health policy, readiness, status, and the restart monitor use to inform operators and recovery behavior. flowchart LR
A[Channel plugin startup] --> B[Durable ingress monitor]
B --> C{Queue opens?}
C -->|No| D[Gateway account snapshot]
C -->|Yes| E[Inbound event admission]
D --> F[Health and readiness evaluation]
F --> G[Status output]
F --> H[Automatic restart path]
Decision needed
Why: The branch intentionally leaves one durable-ingress channel unable to emit the new health signal, while the new public documentation describes the behavior without that boundary. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +105, Tests +283, Docs +11. Total +399 across 16 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Scope the documentation to integrations that propagate durable-ingress startup failures (or include the Nostr owner fix), then add a redacted after-fix runtime transcript that demonstrates the unhealthy status, readiness transition, and successful recovery path. Do we have a high-confidence way to reproduce the issue? No high-confidence independent current-head reproduction is included. The source path and production report identify the failure mode, but the submitted evidence is focused tests and CI rather than an after-fix real channel runtime run. Is this the best way to solve the issue? Unclear. Separating inbound admission from transport connectivity is the right boundary, but the public claim must match the Nostr exception and the integrated runtime behavior still needs proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bb06e0fbcc13. LabelsLabel 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 (1 earlier review cycle)
|
…the transport `connected` is a transport signal, so a channel holding a healthy socket while its durable ingress queue is unavailable evaluated as `health: healthy` and admitted nothing. On a production gateway that hid 26+ hours of completely dead inbound Slack behind `connected, bot:config, app:config, health:healthy`; outbound kept working, which is what kept the transport looking fine. Add inbound admission as its own health dimension rather than overloading `connected` (deliberately tri-state since 30fda06, and 17 of 27 channel plugins depend on absent meaning "no transport signal"). The shared ingress monitor now rethrows a typed ChannelIngressUnavailableError when it cannot open its durable queue, the channel supervisor records that as `ingressUnavailable` on the account, and `evaluateChannelHealth` reports `ingress-unavailable` ahead of every lifecycle window. Absence stays "unknown", never "fine", so socketless and simply quiet channels are untouched; no traffic-staleness heuristic is introduced. The health monitor deliberately does not restart such an account. A denied or unusable ingress queue is a capability/config failure that a restart cannot fix, and the channel's own bounded backoff ladder already tried. Today that case instead loops at the 10-restarts-per-hour cap forever, so this removes a restart treadmill rather than adding one.
The health-monitor skip latched a transient queue-open failure into a permanent inbound outage: ingressUnavailable is only cleared by a later start, and skipping the restart meant that start never happened. Report the dimension and name the restart reason instead of suppressing recovery.
Shadowing not-running would have made readiness flap during the supervisor's documented restart-backoff grace. The blind spot the dimension exists for is a running channel with a live transport and dead inbound, so evaluate it there and leave stopped accounts on their lifecycle reason. Also applies oxfmt.
…koff grace Two review cycles pulled in opposite directions on the same bounded window: the health policy must keep the ingress cause in the not-running state a failed start actually lands in, while readiness must not flap during restart backoff. Put each in its owner -- the policy states the truth, and readiness extends its existing restart-handoff grace to the ingress reason. Once the ladder stops setting restartPending, the account stays red instead of hiding dead inbound.
The new health.md section needs docs/docs_map.md regenerated, and knip flagged CHANNEL_INGRESS_UNAVAILABLE_CODE as an unused production export -- it only has callers inside its own module.
1943505 to
f3b9871
Compare
|
Merged via squash.
|
…etwork-none * origin/main: fix(macos): signed rebuild no longer stalls on app shutdown (#103957) fix(agents): prevent repeated Code Mode output across waits (#115213) refactor(ui): split Profile (identity) from Usage (statistics) (#115245) fix(channels): report a channel that cannot receive as unhealthy instead of connected (#115229) fix(cli): reject malformed infer model refs (#115225) feat(ui): finish the Lobsterdex at 42 with wild variants, squish fix, and blink variance (#115264) test(migrations): avoid mtime precision in checkpoint fixture (#115269) test(signal): verify archive limits without malformed tar (#115270) test(ui): reset config route hash between cases fix(talk): remove unsupported Codex OAuth realtime
…-20260728 * origin/main: fix(macos): signed rebuild no longer stalls on app shutdown (#103957) fix(agents): prevent repeated Code Mode output across waits (#115213) refactor(ui): split Profile (identity) from Usage (statistics) (#115245) fix(channels): report a channel that cannot receive as unhealthy instead of connected (#115229) fix(cli): reject malformed infer model refs (#115225) feat(ui): finish the Lobsterdex at 42 with wild variants, squish fix, and blink variance (#115264) test(migrations): avoid mtime precision in checkpoint fixture (#115269) test(signal): verify archive limits without malformed tar (#115270) test(ui): reset config route hash between cases fix(talk): remove unsupported Codex OAuth realtime
* origin/main: (199 commits) refactor(workboard): tidy Control UI card execution helpers (openclaw#115195) perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281) fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232) fix: restore Fish completion after global CLI options (openclaw#115222) refactor(agents): collapse the client-tool catalog branch (openclaw#115212) fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957) fix(agents): prevent repeated Code Mode output across waits (openclaw#115213) refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245) fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229) fix(cli): reject malformed infer model refs (openclaw#115225) feat(ui): finish the Lobsterdex at 42 with wild variants, squish fix, and blink variance (openclaw#115264) test(migrations): avoid mtime precision in checkpoint fixture (openclaw#115269) test(signal): verify archive limits without malformed tar (openclaw#115270) refactor(sessions): isolate legacy transcript fixtures (openclaw#115231) fix(discord): clear pending launch watchdog (openclaw#115100) fix(agents): stop quadratic subagent prompt rendering (openclaw#115263) fix(memory-core): recover dreaming cron reconciliation (openclaw#115174) fix(qa-lab): filter incompatible channel scenarios (openclaw#115087) fix(android): respect locale in compact labels test(i18n): prove iOS discovery catalog ownership ...
* origin/main: (62 commits) feat(macos): enable Computer Control by default and diagnose stale Accessibility grants (openclaw#115280) fix(qa): restore full-stack scenarios and truthful suite exits (openclaw#115290) feat(memory): backfill past sessions from Control UI (openclaw#115266) docs: link macOS onboarding pages to app download (openclaw#111361) feat(skills): shared authoring standards make learned skills routable (openclaw#115103) fix(matrix): suppress previews for modifying hooks fix: prevent node gateway hangs and runaway local inference (openclaw#115248) refactor(ui): adopt @lit/task across remaining page surfaces (openclaw#115274) fix(slack): cap chat.update edit text at the 4000-char limit, not the 8000 send limit (openclaw#115027) [AI-assisted] docs: recommend Node 26 in quickstart, landing, and platform install docs (openclaw#115064) refactor(workboard): tidy Control UI card execution helpers (openclaw#115195) perf(agents): amortize history-limit eviction with hysteresis (openclaw#115273) (openclaw#115281) fix: schema-version refusal blames a downgrade that never happened and cannot identify the stale install (openclaw#115232) fix: restore Fish completion after global CLI options (openclaw#115222) refactor(agents): collapse the client-tool catalog branch (openclaw#115212) fix(macos): signed rebuild no longer stalls on app shutdown (openclaw#103957) fix(agents): prevent repeated Code Mode output across waits (openclaw#115213) refactor(ui): split Profile (identity) from Usage (statistics) (openclaw#115245) fix(channels): report a channel that cannot receive as unhealthy instead of connected (openclaw#115229) fix(cli): reject malformed infer model refs (openclaw#115225) ...
…ead of connected (openclaw#115229) * fix(channels): make channel health reflect inbound ingress, not just the transport `connected` is a transport signal, so a channel holding a healthy socket while its durable ingress queue is unavailable evaluated as `health: healthy` and admitted nothing. On a production gateway that hid 26+ hours of completely dead inbound Slack behind `connected, bot:config, app:config, health:healthy`; outbound kept working, which is what kept the transport looking fine. Add inbound admission as its own health dimension rather than overloading `connected` (deliberately tri-state since 937bcfd, and 17 of 27 channel plugins depend on absent meaning "no transport signal"). The shared ingress monitor now rethrows a typed ChannelIngressUnavailableError when it cannot open its durable queue, the channel supervisor records that as `ingressUnavailable` on the account, and `evaluateChannelHealth` reports `ingress-unavailable` ahead of every lifecycle window. Absence stays "unknown", never "fine", so socketless and simply quiet channels are untouched; no traffic-staleness heuristic is introduced. The health monitor deliberately does not restart such an account. A denied or unusable ingress queue is a capability/config failure that a restart cannot fix, and the channel's own bounded backoff ladder already tried. Today that case instead loops at the 10-restarts-per-hour cap forever, so this removes a restart treadmill rather than adding one. * fix(channels): keep automatic recovery for a dead-ingress account The health-monitor skip latched a transient queue-open failure into a permanent inbound outage: ingressUnavailable is only cleared by a later start, and skipping the restart meant that start never happened. Report the dimension and name the restart reason instead of suppressing recovery. * fix(channels): scope the ingress dimension to running accounts Shadowing not-running would have made readiness flap during the supervisor's documented restart-backoff grace. The blind spot the dimension exists for is a running channel with a live transport and dead inbound, so evaluate it there and leave stopped accounts on their lifecycle reason. Also applies oxfmt. * fix(channels): keep the ingress reason and give readiness its own backoff grace Two review cycles pulled in opposite directions on the same bounded window: the health policy must keep the ingress cause in the not-running state a failed start actually lands in, while readiness must not flap during restart backoff. Put each in its owner -- the policy states the truth, and readiness extends its existing restart-handoff grace to the ingress reason. Once the ladder stops setting restartPending, the account stays red instead of hiding dead inbound. * style: reshape the readiness backoff predicate for oxfmt * fix(ci): regenerate the docs map and drop an unused ingress export The new health.md section needs docs/docs_map.md regenerated, and knip flagged CHANNEL_INGRESS_UNAVAILABLE_CODE as an unused production export -- it only has callers inside its own module.
Related: #114998, #114970
What Problem This Solves
Resolves a problem where a channel that could not receive a single message still reported itself as connected and healthy.
Channel health was derived from the transport only. On a production gateway that hid 26+ hours of completely dead inbound Slack behind
connected, bot:config, app:config, health:healthy. Outbound kept working the whole time, which is exactly what kept the transport looking fine, and across the entire retained log not one inbound event was admitted.openclaw channels statusshowed nothing wrong, readiness stayed green, and the health monitor never touched the account because it evaluated as healthy.Slack is the worst case but not a special case: it never publishes
lastTransportActivityAt, soevaluateChannelHealth's stale-socket check is skipped for it entirely. Nothing else in the health snapshot described inbound at all.Why This Change Was Made
Inbound admission is a separate failure domain from transport connectivity, so it gets its own health dimension rather than overloading
connected— which is deliberately tri-state since #114970, with 17 of 27 channel plugins relying on "absent" meaning "no transport signal".The shared ingress monitor now rethrows a typed
ChannelIngressUnavailableErrorwhen it cannot open its durable queue (#114998 made that failure reach the caller; this makes it classifiable). The channel supervisor records it asingressUnavailableon the account, andevaluateChannelHealthreportsingress-unavailable.Deliberate boundaries:
ingressUnavailable?: true— there is nofalseto collapse into a misleading negative, which is the mistake fix(channels): stop restart-looping channels that report no transport connectivity #114970 had to undo forconnected. Channels that never report ingress are untouched.reason: ingress-unavailableinstead of the genericstuck. The existingisAutoRestartScheduledguard still keeps the supervisor the single restart owner during its backoff ladder.readiness.tswhere that policy already lives, so a retrying channel does not flap readiness. Once the ladder stops settingrestartPending, the account stays red rather than hiding dead inbound.Non-goals: no config surface, no protocol change (the account snapshot schema is intentionally schema-light and
additionalProperties: true), no channel-subsystem refactor.User Impact
Operators can now see, and be alerted to, a channel that is silently unable to receive:
openclaw channels statusreportsChannel cannot admit inbound events; its durable ingress queue is unavailable. Outbound may still work.health-monitor: restarting (reason: ingress-unavailable)), so a repeating restart is readable as dead inbound rather than an anonymous crash.Channels that do not report ingress state, and quiet channels with no traffic, behave exactly as before.
Evidence
Focused tests and the changed gate, on Blacksmith Testbox (this worktree has no usable local
node_modules):New regression coverage, per the two behaviors that matter most:
channel-health-policy.test.ts— a channel with a live transport and dead ingress is unhealthy; a quiet channel with no traffic and no ingress signal stays healthy; socketless channels publishing no connectivity are untouched; the ingress reason survives the stopped state a failed start actually lands in.server-channels.test.ts— the supervisor records the verdict from a typed start failure, and clears it on the next start so a repaired failure does not stay latched.readiness.test.ts— green during restart backoff, red once retries stop, red for a running-but-dead-ingress account.ingress-monitor.test.ts—start()throws the typed error with the original denial ascause, and the guard still matches when a plugin wraps it.At the current head the six suites report 203 tests passed across 6 files, and
check:changedis green (conflict markers, env ratchet, max-lines ratchet, changelog attributions, wildcard re-exports, duplicate scan coverage, dependency pin, format). A targeted-t ingressrun confirmed the new tests actually execute rather than filtering to a zero-test pass.Codex autoreview (
gpt-5.6-sol, high) ran to clean. Two of its findings materially changed the design and are described under "Why This Change Was Made".Unrelated CI failure, resolved by rebase
An earlier head hit
checks-node-compact-large-4failing on threeui/src/pages/config/config-page.test.tsredirect assertions, which this PR does not touch. Root cause was a cross-file state leak:ui/src/pages/agents/panels-tools-skills.browser.test.tsclicks a real<a href="#agent-tool-read">and never restoredlocation.hash, and shards run withisolate=false, so whichever sibling file asserted on the hash next failed depending on shard packing. #115221 landed a file-wideafterEachURL reset that fixes it at the polluter, so this branch simply rebases onto it and carries no UI change.Known gap, filed separately
extensions/nostr/src/nostr-ingress.ts:187-194swallows its own ingress start failure intooptions.onErrorinstead of letting it propagate, so nostr is the one channel of 21 that will still report healthy with dead inbound. Every other durable-ingress channel propagates. Fixing it is a plugin-owner behavior change and is tracked separately, along with a resource leak this work surfaced:extensions/slack/src/monitor/provider.ts:578arms ingress outside thetrythat owns teardown, so a throwing ingress start leaks the Bolt app, HTTP handler and undici dispatcher (extensions/feishu/src/monitor.account.ts:564has the same shape).