Repository navigation
fix(gateway): removed channel plugins remain falsely healthy after reload - #128503
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 2:01 AM ET / 06:01 UTC. ClawSweeper reviewWhat this changesThe PR updates Gateway health-cache invalidation so supported plugin reloads immediately expose added or removed channel plugins and accounts. Merge readinessThe focused Gateway health-cache repair has no source-backed correctness finding, but it remains open for maintainer handling because the branch is behind main and its exact-head required checks are not green. Likely related people: steipete (high confidence). Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway health returns a cached channel-status snapshot to RPC and CLI callers, comparing it against the current channel manager’s runtime maps before using the fast path. Reloading a channel plugin changes those maps, so the freshness decision determines whether callers see the updated topology. flowchart LR
A[Plugin reload] --> B[Channel manager runtime maps]
C[Cached health snapshot] --> D[Gateway freshness comparison]
B --> D
D --> E{Topology or lifecycle changed?}
E -->|Yes| F[Refresh health snapshot]
E -->|No| G[Return cached response]
Decision needed
Why: The PR is maintainer-authored and carries the protected maintainer label, so this workflow must leave the final landing choice to a human despite the clean source review. Before merge
Agent review detailsSecurityNone. PR surfaceSource +5, Tests +22. Total +27 across 2 files. View PR surface stats
Review metrics
Merge-risk options
Maintainer options:
Technical reviewBest possible solution: Keep the generic bidirectional topology check in the health-cache owner, then rebase or refresh its merge result and obtain green required checks on the exact head before maintainer approval. Do we have a high-confidence way to reproduce the issue? Yes: current main’s runtime-map loops omit cached-only channel keys, and the focused table exercises the removed-plugin and sparse-addition transitions at the health RPC owner boundary. Is this the best way to solve the issue? Yes: comparing cached keys with the channel manager’s two authoritative live maps is the narrowest owner-boundary repair and preserves the normal cache throttle. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c43166a9208c. 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)
|
|
Merged via squash.
|
Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (#143372, #143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (#128222, #128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (#134943, #169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (#85645). The Phase E standalone session memory backend and its tests are untouched.
* refactor(gateway): consolidate reply and worker preparation paths Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (#143372, #143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (#128222, #128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (#134943, #169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (#85645). The Phase E standalone session memory backend and its tests are untouched. * refactor(gateway): consolidate dispatch and trusted result projections * refactor(workers): trust admitted preparation facts
…2342) * refactor(gateway): consolidate reply and worker preparation paths Share completion projection and settlement, reuse existing command gates and session-source preparation, and remove duplicate response/receipt mirrors. Keep private-source authority, approvals, FIFO, transcript durability, bounded retry behavior, and write-capable shutdown settlement at their existing owners. Best-effort tradeoffs accepted: - Idle source/config changes may retain unused capacity until expiry; allocation and private-source transfer still authorize use (openclaw#143372, openclaw#143410). - Mid-read model configuration and native availability may keep prepared display facts for that read; catalog/account authority remains (openclaw#169253). - Cosmetic health topology and clock rollback use normal refresh or an explicit probe; live lifecycle mismatch checks remain (openclaw#128222, openclaw#128503). - Bootstrap enrollment overlapping shutdown/reload may fail and retry rather than reject every post-await close interleaving (openclaw#133037). - Late internal completion reducers are not persisted; completion stays idempotent and final-intent receipt validation remains (openclaw#168592). - An in-flight plugin UI catalog may finish against its selected registry; HTTP asset disclosure still checks current authority (openclaw#134943, openclaw#169449). These removed guards have speculative/synthetic provenance, not cited human actual-use incidents. Keep the human-reported memory-flush retry bound (openclaw#85645). The Phase E standalone session memory backend and its tests are untouched. * refactor(gateway): consolidate dispatch and trusted result projections * refactor(workers): trust admitted preparation facts
Related: #122620
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where Gateway operators who removed a channel plugin through hot reload would continue to see that nonexistent channel reported as healthy for up to a minute. Re-added channels and newly added accounts could also remain invisible while their runtime lifecycle fields had not initialized.
Why This Change Was Made
The Gateway health owner now validates channel membership in both directions across its two authoritative runtime maps and treats newly observed channels or accounts as stale even before they publish lifecycle fields. This preserves intentionally sparse runtime snapshots, existing account-removal behavior, normal request-refresh throttling, and the previously fixed clock-rollback safeguards. The five additional production lines are needed to recognize whole-plugin removal, which the existing account-level comparison cannot observe.
User Impact
Gateway health immediately reflects channels and accounts added or removed during supported in-process plugin reloads. Removed channels no longer remain falsely healthy, and newly added channels become visible immediately. Authentication, public APIs, configuration, protocol, and persistence behavior are unchanged.
Evidence
Before the fix, the actual Gateway health RPC failed three independent hot-reload transitions in both real Gateway Vitest projects: removing an entire channel plugin, re-adding an uninitialized channel plugin, and adding an uninitialized account. Each failure reproduced the real request order with an already-primed refresh throttle.
After the fix, all five table-driven transitions pass in both projects, including existing initialized-account addition and account-removal controls.
The complete affected health-handler owner suite passes: 40 tests across two Gateway test projects, with 394 unrelated tests intentionally filtered:
OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/tmp/openclaw-health-vitest-cache \ node scripts/run-vitest.mjs src/gateway/server-methods/server-methods.test.ts \ --configLoader runner -t 'gateway healthHandlers.health cache freshness'Core production typechecking, Gateway test-graph typechecking, targeted lint, formatting, the max-lines ratchet, and the assertion-safety ratchet all pass.
An independent source review and fresh authenticated Codex reviews of both the uncommitted change and exact committed branch reported no actionable findings.