Repository navigation
fix(gateway): preserve pending config restarts across repeated writes and reverts - #128127
aniruddhaadak80 wants to merge 8 commits into
Conversation
|
🦞👀 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 10, 2026, 8:47 AM ET / 12:47 UTC (Revision 20). ClawSweeper reviewWhat this changesThe branch changes Gateway restart acceptance to check an explicit application disposition and adds regression coverage for repeated writes, reverts, skipped writes, and shutdown. Merge readiness⛔ Blocked before merge - 9 items remain Keep open: this remains an actively owned fix candidate, but both previous correctness findings remain unresolved and the required restart/revert proof is outstanding. No verified merged replacement resolves the remaining work. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway configuration reloader receives saved settings and filesystem notifications, then decides whether to update running services or defer a process restart. Its restart coordinator must preserve pending work without treating inactive settings as already applied. flowchart TD
A[Saved settings and file notifications] --> B[Validate and compare configuration]
B --> C{Application disposition}
C -->|Applied| D[Publish active runtime]
C -->|Restart pending| E[Restart coordinator]
C -->|Skipped| F[Keep runtime unchanged]
E --> G[Drain work and restart Gateway]
B -->|Revert| E
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +323. Total +323 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Carry applied, restart-pending, and skipped outcomes consistently through the canonical reload owner, preserve active baselines until publication, and demonstrate restart and revert behavior while respecting disabled reloads. Do we have a high-confidence way to reproduce the issue? Yes, from source: every acceptance producer omits the newly read field, and the regression fixture lacks an unconditionally invoked restart callback. No tests or contributor code were executed during this read-only review. Is this the best way to solve the issue? No. The owner-level approach is appropriate, but changing only the consumer condition cannot establish the promised application states or preserve the active baseline. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against af50bd6c7684. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (19 earlier review cycles; latest 8 shown)
|
|
Pushed 7bac997a52a — a corrected version of the restart-debt fix after CI surfaced two things:
Verification: |
f8e6bc1 to
ba17633
Compare
|
The focused maintainer repair is on this existing PR, preserving Aniruddha Adak's credit rather than opening a duplicate. Runtime repair: ba17633. Current head, with a test-only CI follow-up: 697040a. The original cancellation shortcut is replaced by the canonical active-versus-accepted owner repair extracted from 97c6b86. No guided-setup GUI, SDK, installer, or provider-allocation code is included. Current-main write receipts remain intact. The reviewed plugin-install baseline defect and a reproduced metadata-refresh-after-revert failure are covered. The fresh ClawSweeper review found no introduced correctness defect and confirmed the prior finding is addressed. Source verification: 561 tests across 12 files passed; the changed gate (including all 14 core-test type shards), full build, exact-commit rebuild, and fresh isolated Codex P0-only autoreview passed. Production delta remains -4 lines. The first CI run https://github.com/openclaw/openclaw/actions/runs/33118704789 failed two preexisting Brave cancellation tests: a one-second polling deadline let an unfinished request leak into the next fixture. The test-only follow-up cancels at the existing transport boundary and awaits terminal rejection, without increasing timeouts or weakening assertions. The original 1,215-test / 67-file shard, scoped check gate, and fresh P0 autoreview passed. Exact-head CI is now green at This is not yet merge-ready. The real-Chrome restart/revert recording remains mandatory. The historical guided-setup JSON has no preserved restart video; consent/cancellation footage is a different flow. Native review initialization succeeded, but artifact writes remain blocked by the agent-worktree fence even after the documented directory-access grant. Owned review inputs are preserved; no shell/copy, permission-setting, or parent-agent workaround is being used. No prepare/merge, operator-state change, or browser fallback has been attempted. Exact commands, provenance, CI failure details, and remaining gates are in the updated PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep restart-pending and skipped candidates separate from the active config and plugin-install comparison baseline. Equivalent writes and watcher echoes retain restart debt without publishing inactive services or secrets. Exact reverts cancel only config-owned debt, and signaled plugin metadata stays pending until its running generation is replaced. Extract the generic owner repair from 97c6b86 without the guided cloud setup feature. Preserve current-main config-write application receipts. Extend the original revert scenario through residual plugin-index and metadata work, with real managed-secret/reloader regressions. Fixes openclaw#119360. Related to openclaw#131067 and openclaw#130713. Co-authored-by: Aniruddha Adak <[email protected]>
697040a to
c0d1c05
Compare
…reverted-restart # Conflicts: # docs/gateway/configuration.md
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(gateway): preserve pending config restarts across repeated writes and reverts This is item 2/3 in the current shard. Shard 73/89. This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Closing due to inactivity. |
Fixes #119360 — reverting a deferred restart-required edit still restarts the Gateway.
Related: #131067 — the guided cloud-setup draft independently exposed an equivalent Save → Apply failure.
Additional instructions
Maintainer repair of the existing contributor PR; no duplicate PR. Preserve Aniruddha Adak's original contribution and regression scenario. This update is AI-assisted. The guided cloud-setup feature branch is unchanged, and none of its GUI, SDK, installer, or provider-allocation changes are included.
Do not merge until the real restart-flow video and exact-head CI gates below are complete. Passing source tests is not a waiver.
What Problem This Solves
Fixes an issue where users save a restart-required configuration and then apply equivalent settings before the Gateway restarts: the pending restart can be paused and never rearmed, while the saved configuration remains inactive. A metadata-only follow-up can instead publish the pending configuration as active too early. Reverting a deferred edit can also request a needless restart or lose still-unapplied plugin work.
Why This Change Was Made
The reload owner now distinguishes applied, restart-pending, and explicitly skipped candidates. Accepted source journaling remains separate from active service, secret, and plugin-install comparison state. Equivalent writes and watcher echoes carry the candidate's recorded disposition through the existing restart coordinator; only actual runtime publication advances the active baseline. Environment ownership still advances at its existing runtime/restart commit edge.
This replaces the previous PR's additional runtime baseline and cancellation shortcut with the canonical owner-boundary repair extracted from 97c6b86. A connected regression found during extraction also required retaining signaled plugin-metadata work until the running plugin generation is replaced—not merely until a restart is admitted. No retries, fallback restart path, public option, SDK export, dependency, schema, protocol, or permission change is added. Current-main config-write application receipts are preserved.
User Impact
Repeated Save/Apply and watcher echoes no longer erase pending restart work or declare inactive settings applied. Exact reverts cancel config-owned work without hiding pending plugin-install changes. Signaled plugin metadata still refreshes if a deferred configuration change is reverted. Invalid or explicitly skipped candidates remain non-applied, and shutdown does not rearm them.
The existing secret equality/revision guards, shared-generation checks, restart preflight, restart emission policy, source CAS, and journal/storage formats are unchanged. Two existing include-file tests now use their own temporary state directory instead of selecting host-default state.
Evidence
Reproduced before the repair
On current-main baseline
6e827231257cf7c9c26ecd54fdc73d8c30afa5d8, the new managed-reloader regression file failed 6 of 8 cases. Equivalent writes failed withGatewayConfigReloadSupersededError: config reload superseded by a newer runtime config source; metadata follow-ups incorrectly advanced active source from A to B. Two additional exact-revert/plugin-index cases also failed: an unnecessary second restart and a lost plugin-install restart reason.The initially extracted owner fix exposed a further connected failure: signaled metadata + deferred restart + exact revert yielded zero plugin hot reloads instead of one. Removing premature metadata-consumption calls repaired that sequence. These are source-boundary reproductions, not live browser evidence.
Final focused source verification
561 tests across 12 files passed in one invocation, with three serial wrapper shards: 523 Gateway tests, 36 runtime-environment tests, and 2 secret-store tests. The new managed cases use the real core reloader, managed callbacks, restart coordinator, runtime-secret preparation, isolated secret store, and root-work admission. The watcher event source and final restart emitter are controlled fixtures; no actual process restart is claimed from those tests.
The final changed-file gate passed, including core types, all 14 canonical core-test type shards, targeted lint, formatting, and the selected static guards. The full
pnpm buildpassed in 6m 40.6s without an ineffective dynamic-import warning. Validation used Node 24.20.0. The final isolated Codex autoreview completed with no actionable findings at its default P0-only threshold; it is not all-priority certification or live proof. The unchanged sensitive managed-secrets module was inspected locally rather than bypassing the review helper's exclusion policy.CI fixture follow-up
The first exact-head CI run, https://github.com/openclaw/openclaw/actions/runs/33118704789, failed only the Brave cancellation test job and its aggregate gate. Two existing in-flight tests used a one-second fetch-start poll: the first saw zero calls, then its unfinished request reached the next case's global fetch mock, which saw two. The unchanged 67-file shard passed locally, confirming the failure was timing-sensitive.
Test-only follow-up 697040a cancels at the existing mocked transport boundary after the abort listener is registered, awaits terminal rejection, and retains exact call-count and aborted-signal assertions. No timeout increase, production change, new seam, or SDK mock was added. The original 1,215-test / 67-file shard, the scoped changed gate, and fresh isolated P0 autoreview passed. This is separate from the 561-test owner batch, not a rerun of it.
The published head is
697040a81eeb26a8ea947cec01b544125c3d98c0. The source build is bound to its production-identical parentba17633d92151e063135d3467c5fe0044b1dd807(2026.8.1-ba17633d9215-2026-08-27T21-33-56.621Z); the sole intervening change is the Brave test fixture. Exact-head CI is now green: https://github.com/openclaw/openclaw/actions/runs/33123143221, attempt 2, at697040a81eeb26a8ea947cec01b544125c3d98c0.Attempt 1 of that run failed the existing OC Path parser performance check: the best of three samples was 3,295 ms against its unchanged 800 ms CI budget. The unchanged 11-test performance file passed locally under its stricter 200 ms local budget; the same full extension shard had also passed in the prior run. One rerun of only the failed job and its dependent gate passed at the identical head. No parser code, threshold, sample count, coverage, timeout, or baseline was changed. This is an observed performance-gate failure followed by a passing diagnostic retry, not a claimed parser fix.
Named follow-ups from that failed full-extension run: profile OC Path's full-shard timing variance without weakening the budget; investigate the Reef test-worker termination timeout logged after its test passed. Neither is attributed to the restart-owner repair or presented as resolved here.
Live proof and landing gates
33123143221, attempt 2, head697040a81eeb26a8ea947cec01b544125c3d98c0.scripts/prreview artifact validation, thenOPENCLAW_TESTBOX=1 scripts/pr prepare-runandscripts/pr merge-run. Native review initialization succeeded, but the agent-worktree fence still refuses writes to the native review artifacts even after the documented directory-access grant. Prepared inputs are preserved in the owned worktree; no shell, copy, permission-setting, or parent-agent workaround is being used.The current browser automation route is unavailable. No isolated-browser fallback, operator Gateway/config/state, credential, account, or allocation operation was used to bypass that limitation. The historical guided-setup Save/Apply JSON reports a new boot and matching applied revision, but its script explicitly disabled video; the draft's attached consent/cancel video shows a different flow and is not reused as restart proof.
Review closure and provenance
The previous ClawSweeper plugin-install finding is addressed by keeping the canonical install-record baseline active until runtime publication, with a config-revert-plus-index regression. The related signaled-metadata lifecycle is covered as well. Real-behavior proof remains explicitly open.
Blame identifies 3616fba from #105289 (transactional hot reload), authored and merged by Peter Steinberger (@steipete), July 13, 2026. Its parent already advanced the acceptance baseline before restart, so this is carried-forward behavior, not a claim that this PR first introduced it. The latest stable tag
v2026.7.1-2also contains premature baseline advancement atsrc/gateway/config-reload.ts:253–255; the exact source-supersession failure above was reproduced on current main.Production LOC: +49/-53 (net -4). Tests: +440/-64 (net +376), including the real managed boundary fixture, expanded original regression scenarios, and the test-only CI follow-up; pure table reindentation is not new behavior. Documentation: +5/-0. No baseline or budget was relaxed.
Thanks to @aniruddhaadak80 for the original fix attempt and revert scenario, and @ape-deft for the original report. Documentation: https://docs.openclaw.ai/gateway/configuration#reload-planning