Skip to content

fix(gateway): removed channel plugins remain falsely healthy after reload - #128503

Merged
steipete merged 1 commit into
mainfrom
codex/gateway-health-removed-plugin-20260823
Aug 24, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/gateway-health-removed-plugin-20260823

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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'
    Test Files  2 passed (2)
         Tests  40 passed | 394 skipped (434)
    
  • 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.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 04:58
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 2:01 AM ET / 06:01 UTC.

ClawSweeper review

What this changes

The PR updates Gateway health-cache invalidation so supported plugin reloads immediately expose added or removed channel plugins and accounts.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The 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
Reviewed head: 5b796c5b6dfa8cbec85519f682611fea3c452e01
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch and focused regression coverage are strong, with exact-head merge and CI refresh still needed before landing.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the PR body supplies a targeted health-handler test transcript.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the PR body supplies a targeted health-handler test transcript.
Evidence reviewed 5 items Current-main behavior: Current main compares only entries present in the live runtime maps and then returns false, so it does not detect a channel remaining solely in cached health after both runtime maps lose that plugin.
Runtime owner: The channel manager builds both runtime maps by iterating the currently loaded channel plugins, so checking cached channel keys against both maps is at the owning topology boundary.
Implementation and regression coverage: The inverse membership check catches whole-plugin removal, while the missing-cached-account return catches newly visible lifecycle-sparse plugin/account snapshots; the table-driven suite covers five reload transitions.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/gateway/server-methods/server-methods.test.ts --configLoader runner -t 'gateway healthHandlers.health cache freshness'

Result: PASS (completed)

node scripts/run-vitest.mjs src/gateway/server-methods/server-methods.test.ts --configLoader runner -t 'gateway healthHandlers.health cache freshness'
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128503-viKdp1/target$ node scripts/run-vitest.mjs src/gateway/server-methods/server-methods.test.ts --configLoa
der runner -t 'gateway healthHandlers.health cache freshness'
node scripts/run-vitest.mjs src/gateway/server-methods/server-methods.test.ts --configLoader runner -t 'gateway healthHandlers.health cache freshness'
[test] starting test/vitest/vitest.gateway.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128503-viKdp1/target

 ✓  gateway-server-isolated  ../../src/gateway/server-methods/server-methods.test.ts (217 tests | 197 skipped) 604ms
 ✓  gateway-methods  ../../src/gateway/server-methods/server-methods.test.ts (217 tests | 197 skipped) 633ms

 Test Files  2 passed (2)
      Tests  40 passed | 394 skipped (434)
   Start at  06:02:47
   Duration  20.93s (transform 15.71s, setup 874ms, import 18.41s, tests 1.24s, environment 0ms)

[test] passed 1 Vitest shard in 27.51s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128503-viKdp1/target$ node scripts/run-vitest.mjs src/gateway/server-methods/server-methods.test.ts --configLoa
der runner -t 'gateway healthHandlers.health cache freshness'
































Assertions:

  • PASS expect_output: gateway healthHandlers.health cache freshness

How this fits together

Gateway 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]
Loading

Decision needed

Question Recommendation
After refreshing this branch against current main and re-running required checks, should the Gateway health-cache repair be merged? Refresh and merge: Rebase or regenerate the merge result, require green exact-head checks, then merge the bounded cache-freshness repair.

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

  • Resolve merge risk (P1) - Production code grows by five net lines; that growth is narrowly justified by the missing inverse channel-membership comparison after both runtime maps have been checked.
Agent review details

Security

None.

PR surface

Source +5, Tests +22. Total +27 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 7 2 +5
Tests 1 94 72 +22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 101 74 +27

Review metrics

Metric Value Why it matters
Production versus test delta production +5 net; tests +22 net Production growth is limited to the missing inverse channel-membership comparison; the test rewrite consolidates five topology transitions into one table.

Merge-risk options

  • The branch is behind current main and the provided CI state has failed or incomplete required checks, so the exact merge result has not yet been validated.

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This repairs bounded incorrect Gateway health reporting after supported plugin reloads.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The author is a repository member, so the external-contributor proof gate does not apply; the PR body supplies a targeted health-handler test transcript.

Evidence

What I checked:

  • Current-main behavior: Current main compares only entries present in the live runtime maps and then returns false, so it does not detect a channel remaining solely in cached health after both runtime maps lose that plugin. (src/gateway/server-methods/health.ts:100, c43166a9208c)
  • Runtime owner: The channel manager builds both runtime maps by iterating the currently loaded channel plugins, so checking cached channel keys against both maps is at the owning topology boundary. (src/gateway/server-channels.ts:1353, 5b796c5b6dfa)
  • Implementation and regression coverage: The inverse membership check catches whole-plugin removal, while the missing-cached-account return catches newly visible lifecycle-sparse plugin/account snapshots; the table-driven suite covers five reload transitions. (src/gateway/server-methods/health.ts:51, 5b796c5b6dfa)
  • Related history: The linked merged predecessor repaired account removal in the same cache-freshness owner; this PR extends that invariant to full-plugin removal and sparse additions. (src/gateway/server-methods/health.ts:74, bdc595d1bd56)
  • Current review state: The supplied context reports a cleanly mergeable branch that is behind current main, with failed or incomplete required CI; this blocks exact-head validation rather than identifying a source defect.

Likely related people:

  • steipete: Authored the current cache-topology repair and the related merged account-removal change in the same owner surface. (role: recent Gateway health-cache contributor; confidence: high; commits: 5b796c5b6dfa, bdc595d1bd56; files: src/gateway/server-methods/health.ts, src/gateway/server-methods/server-methods.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase or refresh the merge result and obtain green required checks on the exact head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-24T05:05:41.244Z sha 5b796c5 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit d094418 into main Aug 24, 2026
476 of 478 checks passed
@steipete
steipete deleted the codex/gateway-health-removed-plugin-20260823 branch August 24, 2026 06:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 25, 2026
steipete added a commit that referenced this pull request Oct 14, 2026
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.
steipete added a commit that referenced this pull request Oct 14, 2026
* 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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant