Repository navigation
fix(gateway): apply settings without unnecessary restarts - #154792
Conversation
8b48daf to
06b2033
Compare
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
|
Codex review: needs real behavior proof before merge. Reviewed September 21, 2026, 2:05 PM ET / 18:05 UTC (Revision 5). ClawSweeper reviewWhat this changesApplies more Gateway settings live, preserves service and capture lifetimes, rechecks request authority before protected effects, and updates Settings guidance. Merge readiness⛔ Blocked before merge - 5 items remain Keep open as useful, maintainer-owned work: current main’s Labs support covers only part of the requested behavior. The earlier code findings are repaired. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway accepts configuration changes from Settings and CLI clients, then reconciles running services. Its request-authority checks determine whether authenticated clients may still receive protected data or perform actions after policy changes. flowchart TD
A[Settings and CLI] --> B[Configuration validation]
B --> C{Reload policy}
C --> D[Reconcile service owners]
C --> E[Restart for listener changes]
D --> F[Publish current access policy]
F --> G[Recheck pending request authority]
G --> H[Allow or reject protected effects]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep service-owned live reconciliation and request-bound revocation, with final-effect evidence covering both authorized requests and requests whose authority expires during preparation. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s reload rules still restart for several affected settings, and the prior authority gaps are visible in the introduced repairs. This read-only review did not execute a reproduction. Is this the best way to solve the issue? Yes, the existing reload and service owners are the appropriate repair boundary; the remaining concern is final-effect proof rather than a competing implementation or new configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b25f3d82963c. 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 (4 earlier review cycles)
|
16da3bf to
b91188f
Compare
b91188f to
6243368
Compare
|
Merged via squash.
|
…54792) * fix(gateway): apply settings without unnecessary restarts Apply operation settings through their existing runtime owners, retire stale request authority, and retain accepted work through cleanup. Preserve current visitor grants and cancellation while consolidating desktop, secrets, transcript, and UI ownership. * refactor(gateway): consolidate history and audit test wiring * test(gateway): observe plugin approval response completion Replace the plugin approval fixture's one-second polling deadline with observation of the existing response callback. Keep acceptance, payload, visibility, decision, and handler-settlement assertions intact. Worker-backed registration can legitimately finish after the unrelated polling deadline. The unchanged full file reproduced nine acceptance-wait failures out of 35 cases (341.72s). All nine affected cases passed with the repair. The repaired full file passed 34/35 (462.81s); an untouched resolve case reported a SQLite lock error without an operation stack. A bounded replay of that case and its immediate predecessor passed 2/2 with 33 cases filtered (77.50s), so the lock cause remains unestablished and is not claimed fixed. The owning gateway-methods type graph (44.54s), typed lint (89.54s), formatting, and diff checks passed. Independent review found no actionable P0-P2 findings. No production code, retries, or timeout values changed. Co-authored-by: Peter Steinberger <[email protected]>
|
Follow-up: #159939 has merged, fixing the overly broad identity-scope invalidation in this reload path. Verified WebSocket connections and accepted runs now survive changes to another login's grants, while changes to their own resolved grants still revoke authority. This is a focused follow-up to this PR's broader live-settings work, not a replacement for it. |
What Problem This Solves
Saving ordinary Settings could restart the Gateway, retain stale service policy, or leave an already authenticated request using permissions that had just been revoked.
User Impact
Desktop, Cloud Worker profiles and pools, ACP policy, meeting capture, Browser relay authentication, audit collection, worktree acceleration, and Gateway access policies apply without a Gateway restart. Changed capture sources drain accepted speech while unchanged sources continue; existing workers retain their admitted provisioning settings. A policy-changing configuration writer receives its result before affected clients reconnect.
Media, avatar/icon, bootstrap, and cancellation requests recheck authority after asynchronous preparation and before protected responses or effects. Policy changes invalidate plugin-frame cookies even when credentials stay the same; a bootstrap response rejected after policy revocation discards its staged grant cookie.
Listener bind/port, effective authentication mode, and TLS topology retain their restart requirement. Audit changes affect future collection rather than reconstructing past events. No new settings, schemas, dependencies, or retention changes.
Why This Change Was Made
Each existing service owns its live reconciliation. Desktop stream custody, secrets publication/cleanup, HTTP authority checks, and UI request ownership replace duplicate state and wrappers. Manual meeting captures retain their actual plugin owner after the initiating chat turn ends, and Gateway shutdown drains them before plugin retirement. Committed policy changes revoke retained authority while failed tentative updates preserve it.
Against main base
2d71ebc9426ecb14d0353e113265598959a45e07, production code decreases by 26 code lines (cloc) and 64 physical lines (+2,415 / −2,479) across 109 production paths. Tests, test support, documentation, and generated files are excluded. The production source seal remains unchanged (3554fc4149ef4b36968a0004448065c8d8dbd60e04ae02dcf793bcfb31c80148) and binds to current tree1a2ab59aa8ffa7a06519900441c6ed0a371f2455.Evidence
Final candidate:
c54ef83dc51bde7047a6d47a158c1b196323b7c9, source tree1a2ab59aa8ffa7a06519900441c6ed0a371f2455, based on main2d71ebc9426ecb14d0353e113265598959a45e07. The only change from the live-tested2dd4d6503689bfab31bf4417dd8f838bb5970a77issrc/gateway/server-methods/plugin-approval.test.ts; all Gateway production bytes and the production source seal are identical. Remote receipts remain labeled2dd4d650rather than being relabeled as this head. The candidate also inherits the landed CI-output repair and upstream directive-test repair087ccde.config.patch, desktop replacement, worker-provider activation/catalog changes, worktree allocation, ACP admission/dispatch, audit enable/disable, and transcript drainage with unchanged sibling retention. The recorded desktop/transcript replay retained the original operator connection. On committed candidate06b203337e502767109e3d317c6bd4db1903f449, all five role/proxy/identity cases and all three legacy-relay authentication states passed without a Gateway process restart; eight policy writes were acknowledged before revocation. The Browser replay closed obsolete relay connections, rejected disabled legacy authentication, retained v2, and preserved the operator connection.2dd4d650: 428/428 tests across 14 complete files passed with zero skips, todos, or snapshot updates (265.545 s combined standalone wrapper wall; 58.554 s native test-case span). The real Gateway auth replay passed all five scenarios and eight config writes, with every writer acknowledged before its own revocation and the same Gateway PID/instance throughout. Browser legacy authentication enabled → disabled → enabled passed: disabled legacy requests returned 401, v2 remained usable, obsolete relay connections drained, and the original operator socket survived. The Testbox run used carriercf1d2d33b510dadf156443d244095f4c0a88bf09for treeed9251ed7023cc851811a6d81e7ab222f4c4c9d5; source stayed unchanged. Owned processes/listeners stopped, and lease cleanup completed with no active owned commands or leases.c54ef83d: complete executed harnesses and sanitized receipts close the admission-to-effect gap. Five media scenarios and two cancellation cases passed on Blacksmith Testbox, using the production HTTP router/authentication, canonical records, real client responses, and actual effect owners. Allowed media requests received the exact fixture bytes; credential or proxy-policy revocation after the real file-open barrier returned 401 without protected bytes or representation headers. Authorized cancellation sent SIGTERM to the owned child and persistedcancelled; revocation after the real lifecycle-queue barrier returned 401 with no abort, a responsive child, and task state stillrunningbefore separate cleanup. Media/cancellation phases took 11.400 s / 8.561 s; source, input hashes, and cleanup were verified. The runtime handle is an owned fixture connected to a real child process, and only its unrelatedagent.waitcompletion monitor returns a synthetic pending result. Policy is published through the canonical runtime snapshot owner; the CLI replay above provesconfig.patchcontinuity.[email protected]updater installed candidate2026.9.5; thecustom-plugin-siblingsbaseline, canary, and candidate runtime checks passed in 141.037 s. This used manual restart mode and does not establish managed-restart timing. Package/update proof belongs to source treed8933e042d9b18eeb2069b3f24dd1f3d067a9230at06b203337e502767109e3d317c6bd4db1903f449, carried remotely by46285c4c9c6b15406ce9d441e0dfaea1f944ecfc; source remained unchanged.1ccccb02788a6bbc8eb9448faa96f4842720ebe6: 115,891 bytes smaller, with 12,964 files each. Both exceed the unchanged 246,415,360-byte (235 MiB) release-size limit. The base comparison establishes that excess predates this branch; it does not make the size check pass. Candidate SHA-256:2e1856e9afb8acc713e4fa8d7b98facd8964a468b97ebf7883ed7f66048ad896. Earlier plugin-version/locale release-preflight failures remain recorded; these results do not claim release readiness or completion of the separate installed bundled-channel smoke.861b59985878c7bd3a40a287896cd8597d2577c9. All 25 core-test type graphs, core production, and root HTTP consumer types passed on integration treeae3f087e0d12eb6c2f6ea87d67d5d5817b4290f9(commit567d696f93110689f4bc7202e4fe2a3369133d99); the small subsequent cleanup passed core types and the affected Gateway-server test graph. The full static run’s line-cap and lint findings were addressed in that cleanup; the full-PR line-cap recheck and scoped type-aware lint both passed.62433684098f8be17562d1f5a2f44423b51b4afa(103.020 s wrapper wall). Core production types (12.447 s), the affected agents/tools type graph (63.083 s), overlap formatting, and committed whitespace checks also passed with unchanged source and index. The fixture merge retains upstream clock bindings and summary-file assertions alongside the reviewed provider ownership cutover.2d71ebc9426ecb14d0353e113265598959a45e07, removes unused Node matrix runtime/task fields. All 644 workflow guard tests passed (248.114 s), with 12 existing skipped cases; static workflow checks passed (11.662 s). Real planner/consumer comparison preserved all 133 rows and consumer plans for both release-gate modes while reducing each UTF-16 payload by 9,842 bytes (86.316 s). The repair’s independent review was scoped-clean through P2. The hosted preflight job on the prior62433684head passed. That full run was superseded after stale directive-test failures were fixed upstream in087ccde, which this candidate inherits. This establishes the prior head’s hosted preflight only; the later2dd4d650run is recorded separately below.2dd4d650: run 35629712958 finished with 152 successful, 12 skipped, and three failed jobs (167 total). Preflight passed in 91 s. Two unchanged-main tests failed; the third failed job was the aggregate gate. Session-history eviction observed 1,849,376 bytes against a 1,482,751-byte high-water assertion; a bounded local full-file replay passed 27 tests but retained a termination warning, and neither the failure nor warning cause is established. The PR-refresh fixture failed to spawn its executable withETXTBSYbefore checkpoint logic; the writable holder remains unknown. Passing replays are not claimed as fixes, and no retry or timeout workaround was added.--maxWorkers=1), with the remaining case reporting a SQLite lock. An ordered two-case replay passed 2/2 with 33 deliberately filtered cases (77.50 s); this does not establish a fix for the lock. The repair landed on main as703dc02bc3ea4a5d20ce5bfebddc856e46725285and was cherry-picked into this PR asc54ef83dc51bde7047a6d47a158c1b196323b7c9. It changes only the test fixture.c54ef83dc51bde7047a6d47a158c1b196323b7c9: 153 successful jobs, 12 skipped, zero failures, includingopenclaw/ci-gate. The job containing the approval test passed in 560 s of whole-job wall time, not per-file timing. This changed-input run does not establish the causes of the earlier unrelated archive, SQLite-lock, or executable-spawn failures.678cdf4246e7through the native maintainer workflow after current-head CI and the requested supplemental HTTP proof passed. The completed Crabbox proof remains tied to2dd4d650, whose Gateway production bytes are unchanged at this head; older feature/package/updater receipts retain their original source scope.The runtime proof uses real CLI Gateways with synthetic loopback worker, model, transcript, proxy, and extension-protocol peers. It does not prove external cloud provisioning, Browser relay integration with real Chrome, a Tailscale network, or an external identity provider. The inspected before/after screenshots below use synthetic UI fixtures.
Final Crabbox boundary costs on 2dd4d65
Each command selected one complete file through the repository Vitest wrapper with
--maxWorkers=1. Wrapper wall includes preparation and imports; native test-case span excludes setup before the first case and teardown after the last. Compiled-worker and filesystem module caches were reused sequentially where supported. These are standalone Testbox measurements, not PR CI job seconds, and are separate from earlier repeated-file ledgers.src/gateway/managed-image-attachments.authority.test.tssrc/gateway/session-kill-http.test.tssrc/gateway/control-ui.response-authority.test.tssrc/gateway/control-ui-plugin-auth-cookie.test.tssrc/gateway/user-profiles-http.auth.test.tssrc/gateway/channel-avatar-http.test.tssrc/gateway/workspace-icon-http.test.tssrc/gateway/plugin-icon-http.test.tssrc/gateway/control-ui-plugin-assets.test.tssrc/gateway/server.plugin-frame-auth.test.tssrc/gateway/server/plugins-http.runtime-scopes.test.tstest/plugins/team-reports-http.gateway.test.tssrc/gateway/managed-image-attachments.test.tssrc/agents/subagents/registry/subagent-control.concurrency.test.tsRecorded integration test costs
Authentication and downstream rows ran through the repository wrapper with
--maxWorkers=1; the four WebSocket files and the three cleanup files ran as the named groups. Authentication receipt hashes remained unchanged. Cleanup test and type receipts bind to their recorded pre-rebase inputs; the broader type graph result is reused only for unchanged inputs. These wall times are independent of the older 50-file ledger and PR CI job durations.src/gateway/control-ui.response-authority.test.tssrc/gateway/server/plugins-http.runtime-scopes.test.tssrc/gateway/control-ui-plugin-auth-cookie.test.tssrc/gateway/user-profiles-http.auth.test.tssrc/gateway/http-auth-utils.test.tssrc/gateway/http-utils.authorize-request.test.tssrc/gateway/http-endpoint-helpers.test.tssrc/gateway/openai-compatible-agent-run.test.tssrc/gateway/tools-invoke-http.abort.test.tssrc/gateway/server/ws-connection/authenticated-request-dispatch.abort.test.ts + src/gateway/server/ws-connection/authenticated-request-dispatch.lifetime.test.ts + src/gateway/server/ws-connection/authenticated-request-dispatch.mutation-authority.test.ts + src/gateway/server/ws-connection/authenticated-request-dispatch.policy-close.test.tsserver-runtime-subscriptions.test.ts + sessions-history-http.revocation.test.ts + sessions-history-http.test.tssrc/agents/tools/transcripts-tool.lifecycle.test.ts— post-rebase head62433684Later repair and HTTP authority costs
These are working-tree repairs after
06b203337e502767109e3d317c6bd4db1903f449, not final-head receipts. Files ran individually through the repository wrapper with--maxWorkers=1unless a combined scope is named. Times are measured wrapper wall; the topology and auth/config JSON receipts include the outer invocation, while the fixture/status logs report the wrapper's own wall. PR CI job durations remain separate and pending. The architecture receipt also verifies unchanged source hashes before/after its three focused test commands.src/secrets/runtime-state.clear.test.tssrc/secrets/runtime-provider-and-media-surfaces.test.tssrc/gateway/server-startup-config.secrets.test.tssrc/gateway/server.auth.modes.test.tssrc/gateway/server-methods/config-write-flow.test.tssrc/gateway/server-methods/config.shared-auth.test.tssrc/gateway/server/ws-origin-policy.test.tsextensions/google-meet/lazy-import.test.tssrc/gateway/config-reload-plan.test.tssrc/gateway/config-reload.operation-policy.test.tssrc/transcripts/status.producer.test.tssrc/transcripts/status.producer.shutdown.test.ts + status.occupancy.test.ts + status.provider-reload.test.tsThe HTTP table keeps passing full-file receipts and the later repaired media/response-authority receipts. It omits the superseded failing media rows from passing results. The two
-tselections below deliberately excluded five and 156 cases respectively; those are filtered cases, not disabled tests or a claim that the full later file ran. Intermediate cookie receipts establish their measured revision only; the newer candidate completed its generation cutover before this final current-main integration. The completed local integration proof and remaining remote/CI checks are distinguished above.src/gateway/session-kill-http.test.ts— full filesrc/agents/subagents/registry/subagent-control.concurrency.test.ts— selected caller-control casessrc/gateway/http-byte-range.test.ts— full filesrc/gateway/http-utils.authorize-request.test.ts— full filesrc/gateway/control-ui.http.test.ts— full filesrc/gateway/user-profiles-http.auth.test.ts— full filesrc/gateway/user-profiles-http.test.ts— full filesrc/gateway/user-profiles-http.gravatar.test.ts— full filesrc/gateway/channel-avatar-http.test.ts— full filesrc/gateway/workspace-icon-http.test.ts— full filesrc/gateway/plugin-icon-http.test.ts— full filesrc/gateway/managed-image-attachments.authority.test.ts— full file; later repairsrc/gateway/managed-image-attachments.test.ts— full file; later repairsrc/gateway/control-ui.response-authority.test.ts— full file; later repairsrc/gateway/control-ui.http.test.ts— selected successful plugin-grant casessrc/gateway/http-auth-utils.paired-device.test.ts— full file; later repairsrc/gateway/control-ui-plugin-auth-cookie.test.ts— earlier cookie-policy revisionsrc/gateway/control-ui-plugin-assets.test.ts— earlier cookie-policy revisionsrc/gateway/server.plugin-frame-auth.test.ts— earlier cookie-policy revisionsrc/gateway/server/plugins-http.runtime-scopes.test.ts— earlier cookie-policy revisionsrc/gateway/control-ui.response-authority.test.ts— earlier cookie-policy revisionStandalone test costs and source provenance
Each row ran one file through the repository test wrapper with
--maxWorkers=1; UI files used the owning UI configuration. Wrapper wall includes preparation and imports. Native test-case span measures from the first case start to the last case end, excluding setup before the first case and teardown afterward. Compiled-worker caches were reused sequentially where supported. These measurements are separate from PR CI job durations, which are pending.The ledger combines 44 passing unchanged test inputs from source tree
606de21e2428dc522ca3422616116013445bb5b6(carrier163d8b7c29b23127ad6e1d7aa9cf6ecbb58f5455) with six repaired/current files measured on treec97aa26ed92c8685986765630073ec14a7fe9fb9(carrier78b28ea81ea91ca10271ced17a68e48a8ae78b7b). Both runs recorded unchanged remote source. This is the measured test input history, not a claim that the final candidate is identical to those trees. The Testbox workflow identifies the remote environment; per-command exit codes and native reports determine the results.extensions/acpx/register.runtime.test.tsextensions/acpx/src/runtime-probe.test.tsextensions/acpx/src/runtime.test.tsextensions/acpx/src/service.test.tsextensions/browser/src/browser/extension-relay/gateway-relay-route.test.tssrc/acp/control-plane/manager.runtime-handles.test.tssrc/agents/tools/transcripts-tool.account-ownership.test.tssrc/agents/tools/transcripts-tool.lifecycle.test.tssrc/agents/tools/transcripts-tool.selection.test.tssrc/agents/tools/transcripts-tool.session-id.test.tssrc/agents/tools/transcripts-tool.status.test.tssrc/agents/tools/transcripts-tool.test.tssrc/audit/audit-event-writer.test.tssrc/audit/audit-events.test.tssrc/gateway/config-reload.operation-policy.test.tssrc/gateway/config-reload.test.tssrc/gateway/config-reload.transcripts.test.tssrc/gateway/control-ui-assistant-media-policy.test.tssrc/gateway/desktop/attachment.test.tssrc/gateway/desktop/node-source.test.tssrc/gateway/embeddings-http.test.tssrc/gateway/http-endpoint-helpers.test.tssrc/gateway/openai-compatible-agent-run.test.tssrc/gateway/server-aux-handlers.test.tssrc/gateway/server-http.openai-compat.test.tssrc/gateway/server-plugin-in-process-dispatch.authorization.test.tssrc/gateway/server-plugin-in-process-dispatch.continuation.test.tssrc/gateway/server-plugin-reload.installed-package.test.tssrc/gateway/server-plugin-reload.recovery.test.tssrc/gateway/server-reload-handlers.test.tssrc/gateway/server-reload-managed-secrets.test.tssrc/gateway/server-runtime-subscriptions.test.tssrc/gateway/server-startup-post-attach.test.tssrc/gateway/server-startup-transcripts.test.tssrc/gateway/server.plugin-http-role-scopes.test.tssrc/gateway/server/ws-connection/authenticated-request-dispatch.mutation-authority.test.tssrc/gateway/server/ws-connection/connect-device-pairing.test.tssrc/gateway/server/ws-connection/message-handler.post-connect-health.test.tssrc/gateway/server/ws-origin-policy.test.tssrc/gateway/sessions-history-http.revocation.test.tssrc/gateway/tools-invoke-http.abort.test.tssrc/gateway/worker-environments/placement-idle-sweep.test.tssrc/meeting-bot/browser-act-lock.test.tssrc/meeting-bot/session-runtime.test.tssrc/secrets/runtime-state.clear.test.tssrc/secrets/runtime-state.test.tssrc/transcripts/capture-stop.test.tsui/src/e2e/cloud-workers-settings.e2e.test.tsui/src/pages/cloud-workers/cloud-worker-config.test.tsui/src/pages/cloud-workers/cloud-workers-page.test.tsCloud Worker settings before and after
Before:
After:
Meeting capture guidance before and after
Before:
After: