Repository navigation
fix(gateway): make hot reload transactional - #105289
Conversation
Replace partial reload side effects with a deferred transaction that publishes config, secrets, auth, and subsystem state together, and drains in-flight reload work before shutdown. Co-authored-by: LZY3538 <[email protected]>
Keep derived runtime snapshots in place for main-store state mutations so order refreshes do not look like credential replacement.
|
Codex review: needs real behavior proof before merge. Reviewed July 12, 2026, 9:12 PM ET / July 13, 2026, 01:12 UTC. Summary PR surface: Source +5442, Tests +11827. Total +17269 across 79 files. Reproducibility: yes. The linked issue provides a concrete current-main path that holds active work during a combined hooks, cron, and channel reload and observes new global config alongside stale live subsystem references. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Merge only after an exact-head live gateway scenario demonstrates coherent success publication, failed-reload rollback, auth/secret refresh behavior, and shutdown during an admitted reload, while the focused tests and required CI remain green. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue provides a concrete current-main path that holds active work during a combined hooks, cron, and channel reload and observes new global config alongside stale live subsystem references. Is this the best way to solve the issue? Yes, provisionally. A single staged activation edge with ownership-checked rollback is more maintainable than independently publishing selected subsystems early, but the expanded solution needs exact-head live proof before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4afcbea5c580. Label changesLabel justifications:
Evidence reviewedPR surface: Source +5442, Tests +11827. Total +17269 across 79 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (2 earlier review cycles)
|
…d-transaction # Conflicts: # CHANGELOG.md # docs/.generated/plugin-sdk-api-baseline.sha256 # src/commands/doctor-session-sqlite.test.ts # src/gateway/server-reload-handlers.test.ts # src/gateway/server-reload-handlers.ts # src/gateway/server.impl.ts
|
Land-ready proof for
Known proof gap: Vercel production rollout and host-side integration remain outside this OpenClaw PR. No new config, protocol, docs, or public plugin SDK surface. |
|
Merged via squash.
|
* fix(gateway): make hot reload transactional Replace partial reload side effects with a deferred transaction that publishes config, secrets, auth, and subsystem state together, and drains in-flight reload work before shutdown. Co-authored-by: LZY3538 <[email protected]> * fix(auth): preserve state-only credential ownership Keep derived runtime snapshots in place for main-store state mutations so order refreshes do not look like credential replacement. * fix(gateway): close reload transaction gaps * fix(gateway): close merged reload gaps * chore: move reload note to PR context * fix(gateway): exclude restart emission root --------- Co-authored-by: LZY3538 <[email protected]>
Share existing config-path and retired-media traversal owners. Remove speculative rollback, retry, reentry, and diagnostic freshness machinery while preserving security effect checks, ordinary cleanup settlement, resource bounds, and public config, CLI, protocol, and persisted-data shapes. Phase E is untouched. Production delta: 335 net lines removed (+97/-432) across 16 old files. Focused proof: 311 tests in 25 files; final embedding/shutdown proof: 91 tests in 4 files. Independent scoped review found no actionable P0-P2 findings. Published as a branch only under the campaign's below-500 rule, not a PR. Best-effort tradeoffs accepted - Overlapping failed env publications may require reload/restart instead of ordered compensation; #105289/#103736 document synthetic harness proof, not a human actual-use report. - Failed in-process restart preparation/emission requires explicit config reapply or manual restart; #105289/#160375 describe synthetic timing, not a transient transport failure. - A mount changed during sampling may briefly be attributed to its parent filesystem until the next snapshot; #149792 uses forced mount fixtures, without a human incident. - CLI provider cleanup is attempted once; #113471's blocked-close fixtures do not establish a transient failed-close incident, and the CLI exits on cleanup failure. - Requested-head CI details are a snapshot until refresh; #148464's synthetic push/rerun interleavings do not justify rereading the head and check inventory after fetching jobs. - A malformed catalog resolver may repeat rejection until the existing 16-fallback bound instead of an earlier identity bailout; #92175/#89456 are synthetic trust-harness work, and every trust check remains. - Model normalizers must not reenter the same resolver; #156076's callback reentry is synthetic. Measured lookup caches and ordinary callback errors/order remain. - Offline plugin-state imports assume no unsupported same-destination writer after capacity preflight; #109679's ordinary near-capacity import remains fixed, while concurrent eviction compensation came from synthetic sibling seeding. - A delayed update verification reply may repeat a terminal broadcast or briefly show old status; #160592 supplies synthetic ordering proof, while durable effect idempotency, FIFO, repair authority, and shutdown joining remain. - A malformed reply from the fixed inline CA worker may fail instead of using a dedicated invalid-result fallback; #112338/#112336 do not report a human malformed-message incident. Timeout/error/exit handling remains. - Failed Gateway embedding cleanup blocks only its agent/provider scope until restart instead of retaining provider objects and retrying close; #113471 documents synthetic blocked-close proof, not a human failed-close incident. Local FIFO cleanup, remote concurrency, abort handling, authority, and normal shutdown settlement remain.
…#170826) * refactor: simplify older agent and channel execution paths Consolidate duplicate payload and metadata projections under their existing owners. Simplify internal bookkeeping and bounded cache invalidation while retaining public SDK contracts, security-effect authority, ordinary concurrency, and durable user state. * refactor: retain branch cache pending complete old-code cutover Withdraw the branch-cache cluster because completing its unused-export cleanup requires an infra owner touched this week. Preserve the original cache, regression assertions, and docs. The remaining old-code lane removes 424 net production lines and is branch-only under the campaign BELOW-500 rule. * refactor: simplify old gateway, config, and CLI bookkeeping Share existing config-path and retired-media traversal owners. Remove speculative rollback, retry, reentry, and diagnostic freshness machinery while preserving security effect checks, ordinary cleanup settlement, resource bounds, and public config, CLI, protocol, and persisted-data shapes. Phase E is untouched. Production delta: 335 net lines removed (+97/-432) across 16 old files. Focused proof: 311 tests in 25 files; final embedding/shutdown proof: 91 tests in 4 files. Independent scoped review found no actionable P0-P2 findings. Published as a branch only under the campaign's below-500 rule, not a PR. Best-effort tradeoffs accepted - Overlapping failed env publications may require reload/restart instead of ordered compensation; #105289/#103736 document synthetic harness proof, not a human actual-use report. - Failed in-process restart preparation/emission requires explicit config reapply or manual restart; #105289/#160375 describe synthetic timing, not a transient transport failure. - A mount changed during sampling may briefly be attributed to its parent filesystem until the next snapshot; #149792 uses forced mount fixtures, without a human incident. - CLI provider cleanup is attempted once; #113471's blocked-close fixtures do not establish a transient failed-close incident, and the CLI exits on cleanup failure. - Requested-head CI details are a snapshot until refresh; #148464's synthetic push/rerun interleavings do not justify rereading the head and check inventory after fetching jobs. - A malformed catalog resolver may repeat rejection until the existing 16-fallback bound instead of an earlier identity bailout; #92175/#89456 are synthetic trust-harness work, and every trust check remains. - Model normalizers must not reenter the same resolver; #156076's callback reentry is synthetic. Measured lookup caches and ordinary callback errors/order remain. - Offline plugin-state imports assume no unsupported same-destination writer after capacity preflight; #109679's ordinary near-capacity import remains fixed, while concurrent eviction compensation came from synthetic sibling seeding. - A delayed update verification reply may repeat a terminal broadcast or briefly show old status; #160592 supplies synthetic ordering proof, while durable effect idempotency, FIFO, repair authority, and shutdown joining remain. - A malformed reply from the fixed inline CA worker may fail instead of using a dedicated invalid-result fallback; #112338/#112336 do not report a human malformed-message incident. Timeout/error/exit handling remains. - Failed Gateway embedding cleanup blocks only its agent/provider scope until restart instead of retaining provider objects and retrying close; #113471 documents synthetic blocked-close proof, not a human failed-close incident. Local FIFO cleanup, remote concurrency, abort handling, authority, and normal shutdown settlement remain. * refactor: defer pricing cache cleanup touched on main Withdraw the usage-format production and paired test changes after main landed afc559c, keeping the hard seven-day old-code exclusion. Both files match the pre-campaign base, so main retains its interrupted-stream usage repair. The remaining reviewed o05/o06 union removes 713 net production lines across 42 files.
…openclaw#170826) * refactor: simplify older agent and channel execution paths Consolidate duplicate payload and metadata projections under their existing owners. Simplify internal bookkeeping and bounded cache invalidation while retaining public SDK contracts, security-effect authority, ordinary concurrency, and durable user state. * refactor: retain branch cache pending complete old-code cutover Withdraw the branch-cache cluster because completing its unused-export cleanup requires an infra owner touched this week. Preserve the original cache, regression assertions, and docs. The remaining old-code lane removes 424 net production lines and is branch-only under the campaign BELOW-500 rule. * refactor: simplify old gateway, config, and CLI bookkeeping Share existing config-path and retired-media traversal owners. Remove speculative rollback, retry, reentry, and diagnostic freshness machinery while preserving security effect checks, ordinary cleanup settlement, resource bounds, and public config, CLI, protocol, and persisted-data shapes. Phase E is untouched. Production delta: 335 net lines removed (+97/-432) across 16 old files. Focused proof: 311 tests in 25 files; final embedding/shutdown proof: 91 tests in 4 files. Independent scoped review found no actionable P0-P2 findings. Published as a branch only under the campaign's below-500 rule, not a PR. Best-effort tradeoffs accepted - Overlapping failed env publications may require reload/restart instead of ordered compensation; openclaw#105289/openclaw#103736 document synthetic harness proof, not a human actual-use report. - Failed in-process restart preparation/emission requires explicit config reapply or manual restart; openclaw#105289/openclaw#160375 describe synthetic timing, not a transient transport failure. - A mount changed during sampling may briefly be attributed to its parent filesystem until the next snapshot; openclaw#149792 uses forced mount fixtures, without a human incident. - CLI provider cleanup is attempted once; openclaw#113471's blocked-close fixtures do not establish a transient failed-close incident, and the CLI exits on cleanup failure. - Requested-head CI details are a snapshot until refresh; openclaw#148464's synthetic push/rerun interleavings do not justify rereading the head and check inventory after fetching jobs. - A malformed catalog resolver may repeat rejection until the existing 16-fallback bound instead of an earlier identity bailout; openclaw#92175/openclaw#89456 are synthetic trust-harness work, and every trust check remains. - Model normalizers must not reenter the same resolver; openclaw#156076's callback reentry is synthetic. Measured lookup caches and ordinary callback errors/order remain. - Offline plugin-state imports assume no unsupported same-destination writer after capacity preflight; openclaw#109679's ordinary near-capacity import remains fixed, while concurrent eviction compensation came from synthetic sibling seeding. - A delayed update verification reply may repeat a terminal broadcast or briefly show old status; openclaw#160592 supplies synthetic ordering proof, while durable effect idempotency, FIFO, repair authority, and shutdown joining remain. - A malformed reply from the fixed inline CA worker may fail instead of using a dedicated invalid-result fallback; openclaw#112338/openclaw#112336 do not report a human malformed-message incident. Timeout/error/exit handling remains. - Failed Gateway embedding cleanup blocks only its agent/provider scope until restart instead of retaining provider objects and retrying close; openclaw#113471 documents synthetic blocked-close proof, not a human failed-close incident. Local FIFO cleanup, remote concurrency, abort handling, authority, and normal shutdown settlement remain. * refactor: defer pricing cache cleanup touched on main Withdraw the usage-format production and paired test changes after main landed 7a00a9f, keeping the hard seven-day old-code exclusion. Both files match the pre-campaign base, so main retains its interrupted-stream usage repair. The remaining reviewed o05/o06 union removes 713 net production lines across 42 files.
What Problem This Solves
Hot reload could expose a mixed gateway generation when channel reload was deferred: config and secret state could advance while channel/runtime subsystems still represented the prior generation. Shutdown could also race an in-flight reload transaction.
Fixes #103736. Replaces #103880 because GitHub rejected maintainer writes to its fork branch and the repo-native GraphQL fallback cannot safely publish the 4,551-file rebase delta.
Why This Change Was Made
The gateway now stages reload work as one transaction, publishes config, secrets, auth snapshots, and subsystem state at the activation edge, and drains admitted reload work before teardown. The replacement commit preserves the reviewed tree from #103880, rebased onto current
main, with contributor credit for @LZY3538.User Impact
Vercel and other long-lived gateway hosts can reload configuration without observing partially advanced runtime state. Failed or cancelled reloads retain the prior coherent generation, while shutdown waits for admitted reload work to finish.
Evidence
e24aa321267bbc7653926493f5ac406aca97e57c. Relative to the fully proved code head9174b447372f5426df85e7d24d016808df3ee2a7, it removes the release-owned root changelog entry and fixes the CI-revealed restart-emission self-count.tbx_01kxccrq7t981qv7te8c163ydk: focused reload, restart, auth DB, config, secrets, and gateway surface, 748/748 tests passed.pnpm check:changedpassed in 11m31s, including formatting, conflict scan, changelog attribution, SDK baseline, core and test typechecks, core and script lint, database/storage guards, and runtime import-cycle checks.pnpm plugin-sdk:surface:checkpassed with zero forbidden package-exported subpaths.tbx_01kxcfmf82307j1hay6m1fr2a5: the two failed CI files plus restart/infra invariants passed 81/81; a two-filepnpm check:changedpassed in 3m16s; fresh autoreview reported no actionable findings.autoreview --mode uncommittedpassed with no accepted or actionable findings after whole-function review.git diff --checkpassed.Agent transcript omitted because publication was not approved.