Repository navigation
feat(update): keep progress and reports across restarts - #138737
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: blocked before merge. Reviewed September 5, 2026, 1:48 AM ET / 05:48 UTC. ClawSweeper reviewWhat this changesThe PR gives chat, CLI, and Control UI a shared update progress view and retained reports that survive Gateway restarts. Merge readiness⛔ Blocked before merge - 8 items remain Keep open: the native retry finding is resolved, but both acknowledged lifecycle blockers remain. Current main contains the ledger foundation, not this PR’s complete UI and notification behavior. Priority: P2 Review scores
Verification
How this fits togetherUpdate requests enter through chat, the CLI, or Control UI and write progress to a shared SQLite ledger. The Gateway observes those records to notify conversations and refresh browser controls after restart. flowchart LR
A[Chat or Control UI request] --> C[Update orchestrator]
B[Standalone CLI update] --> C
C --> D[Durable run ledger]
C --> E[Gateway restart]
E --> F[Gateway watcher and recovery]
D --> F
F --> G[Chat notices and retained UI reports]
Decision needed
Why: The remaining repair changes persistent lifecycle ownership; the discussion explicitly leaves that design unaccepted, and a surviving detached updater makes heuristic cleanup unsafe. Before merge
Findings
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the ledger as the single outcome owner, with accepted writer-transfer reconciliation, cross-process discovery, and visible recovery that safely releases stranded controls. Do we have a high-confidence way to reproduce the issue? Yes for the remaining findings: source establishes a stranded interlock after CLI death before sentinel publication, and missed updates when standalone CLI admission occurs after the Gateway watcher becomes idle. These scenarios were not executed during this read-only review. Is this the best way to solve the issue? The shared-ledger direction is sound, but incomplete: reconciliation and discovery belong in the updater/Gateway owners, rather than browser timeouts or another client-side outcome model. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7b1217e2e79e. 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 (3 earlier review cycles)
|
Keep phase history and notice custody through bounded diagnostic eviction, close interrupted steps at terminalization, and move unchanged validation out of browser imports. No schema or stored-shape change. (cherry picked from commit 03b41549c8db17757ac0a0ef4e9c57f4a7c9d1f1)
Use the shared renderer for acknowledgement, activation, boot verification, and terminal reports. Deduplicate durable outbound intent ownership and internal transcript appends, and return the gateway acknowledgement from chat commands. Await the activation notice before parking the exact managed helper owner. (cherry picked from commit 522cd3be2e2016f87c9e3338f5cfe16eced6a3ef)
Observe the command-owned ledger timeline through restart verification, replay fast recorded transitions once, and print the shared terminal report. Include the durable run row in JSON and remove divergent step labels and the unused step-info re-export. (cherry picked from commit 87179747ba0a686f60b4d77fa3bab58f3145fe0e)
Drive the body-mounted dialog, Settings update view, and sidebar from the server run row across reconnects. Show canonical phases, bounded details, oracle marks, and success or failure reports; scope browser acknowledgements and retire reports on permission changes. Delete browser verification, sessionStorage execution reconciliation, the success toast, and its obsolete reload helper. Document and prove the flow with mocked gateway browser coverage. (cherry picked from commit 180d3a61b11d329a58fd06d06e74ed8578a3ebd0)
(cherry picked from commit 58eacd94b85b9ec753844bd2dbac685f1dc2d1e5)
Keep simulated run snapshots independent, expand fixture control-flow braces, distinguish the retained run failure from sentinel failure, and mark the acknowledgement callback as this-free. Runtime behavior and test assertions are unchanged. (cherry picked from commit 628f69103caeeaae742766080124ac98c69c3e5f)
… plugin (cherry picked from commit 54c28e839d67e40861d9c298ec9b2b2fcc3361e7)
Resolve update notice destinations through one owner shared by admission, phase notifications, and restart recovery. Existing internal sessions need only sessionKey: record their internal delivery channel without changing API trigger classification, append durable notices to their transcripts, and avoid a model wake after completed updates without a continuation. Remove the duplicate notifier and sentinel routing logic. Preserve external notice custody and sessionless system-route/thread behavior, with boundary coverage using the real session store, update ledger, and transcript writer. Document the sessionKey-only contract for Control UI and webchat callers. (cherry picked from commit 8a90fc8ea00a73e70a35ea5d70d88cd2725fd93f)
Port the repair-visibility projection from d37a9418d94: hide Repairing until the run records or enters it, with component and browser proof. Preserve canonical phase and record ownership after the ledger-parent refresh. Keep the polling test independent of host load, retire the deleted browser-verifier reload test, and remove a redundant nested sidebar condition. Native Mac update controls and terminal reload protection remain intact.
Align history RPC metadata with the September release train, preserve Git revision identity in shared reports, and migrate sibling UI fixtures to durable run records and explicit dismissal. Project CLI triage assertions away from inherited environment data.
) * refactor(update): preserve run facts and separate runtime validation Keep phase history and notice custody through bounded diagnostic eviction, close interrupted steps at terminalization, and move unchanged validation out of browser imports. No schema or stored-shape change. (cherry picked from commit 03b41549c8db17757ac0a0ef4e9c57f4a7c9d1f1) * feat(update): deliver durable run phase notices Use the shared renderer for acknowledgement, activation, boot verification, and terminal reports. Deduplicate durable outbound intent ownership and internal transcript appends, and return the gateway acknowledgement from chat commands. Await the activation notice before parking the exact managed helper owner. (cherry picked from commit 522cd3be2e2016f87c9e3338f5cfe16eced6a3ef) * feat(update): render CLI progress from canonical run phases Observe the command-owned ledger timeline through restart verification, replay fast recorded transitions once, and print the shared terminal report. Include the durable run row in JSON and remove divergent step labels and the unused step-info re-export. (cherry picked from commit 87179747ba0a686f60b4d77fa3bab58f3145fe0e) * feat(ui): resume update runs and retain terminal reports Drive the body-mounted dialog, Settings update view, and sidebar from the server run row across reconnects. Show canonical phases, bounded details, oracle marks, and success or failure reports; scope browser acknowledgements and retire reports on permission changes. Delete browser verification, sessionStorage execution reconciliation, the success toast, and its obsolete reload helper. Document and prove the flow with mocked gateway browser coverage. (cherry picked from commit 180d3a61b11d329a58fd06d06e74ed8578a3ebd0) * style(update): make empty progress reads explicit (cherry picked from commit 58eacd94b85b9ec753844bd2dbac685f1dc2d1e5) * style(ui): align update fixtures and callbacks with lint rules Keep simulated run snapshots independent, expand fixture control-flow braces, distinguish the retained run failure from sentinel failure, and mark the acknowledgement callback as this-free. Runtime behavior and test assertions are unchanged. (cherry picked from commit 628f69103caeeaae742766080124ac98c69c3e5f) * test(gateway): give the update notice fixture a send-capable outbound plugin (cherry picked from commit 54c28e839d67e40861d9c298ec9b2b2fcc3361e7) * fix(update): deliver reports to internal origin sessions Resolve update notice destinations through one owner shared by admission, phase notifications, and restart recovery. Existing internal sessions need only sessionKey: record their internal delivery channel without changing API trigger classification, append durable notices to their transcripts, and avoid a model wake after completed updates without a continuation. Remove the duplicate notifier and sentinel routing logic. Preserve external notice custody and sessionless system-route/thread behavior, with boundary coverage using the real session store, update ledger, and transcript writer. Document the sessionKey-only contract for Control UI and webchat callers. (cherry picked from commit 8a90fc8ea00a73e70a35ea5d70d88cd2725fd93f) * fix(update): align run surfaces with current owners Port the repair-visibility projection from d37a9418d94: hide Repairing until the run records or enters it, with component and browser proof. Preserve canonical phase and record ownership after the ledger-parent refresh. Keep the polling test independent of host load, retire the deleted browser-verifier reload test, and remove a redundant nested sidebar condition. Native Mac update controls and terminal reload protection remain intact. * fix(update): preserve run reports across current surface contracts Align history RPC metadata with the September release train, preserve Git revision identity in shared reports, and migrate sibling UI fixtures to durable run records and explicit dismissal. Project CLI triage assertions away from inherited environment data. * docs(update): qualify managed update phase notices * fix(update): preserve notice ordering and campaign interlocks Record activation before the pre-park notice and preserve newer campaign installation interlocks without losing queued manual failure triage. Repair the reproduced CLI typecheck and gallery navigation fixture failures. * fix(ui): preserve native ownership for update report retries Reuse the live Mac update bridge when retrying retained failed or skipped sidebar reports. Extend browser ownership coverage across fresh updates and both retained outcomes, including the native-decline handoff.
ui/src/e2e/logs-lifecycle.e2e.test.ts failed deterministically on main (5/5 on Testbox) at line 214: after a real Gateway restart the sidebar showed "Refresh required" instead of "Reconnecting…". Main-push CI skips UI e2e, so only PRs selecting that shard inherited the red. Culprit: 1c3468f (fix(updates): refresh target when opening updater, #158053) added `connectedEpoch++` to the scope-change branch of synchronizeGateway as an async-work fence. Since 9b1d9c2 (#138737) the same counter also meant "this client lifetime connected before" (`connectedEpoch > 1`), which gates the legacy version-only build comparison to reconnects. The first authenticated hello changes the profile scope, so the first connection now counted as a reconnect and a version-only mismatch latched controlUiRefreshRequired; the status then read "Refresh required" through the later transient reconnect, a state reloading cannot clear. Keep connectedEpoch as the fence and track the reconnect fact separately, reset with the epoch on a fresh client lifetime. The overlay regression test now gives the fresh lifetime's first hello a profile, which fails on the pre-fix code.
ui/src/e2e/logs-lifecycle.e2e.test.ts failed deterministically on main (5/5 on Testbox) at line 214: after a real Gateway restart the sidebar showed "Refresh required" instead of "Reconnecting…". Main-push CI skips UI e2e, so only PRs selecting that shard inherited the red. Culprit: d313ec2 (fix(updates): refresh target when opening updater, openclaw#158053) added `connectedEpoch++` to the scope-change branch of synchronizeGateway as an async-work fence. Since 8b46aba (openclaw#138737) the same counter also meant "this client lifetime connected before" (`connectedEpoch > 1`), which gates the legacy version-only build comparison to reconnects. The first authenticated hello changes the profile scope, so the first connection now counted as a reconnect and a version-only mismatch latched controlUiRefreshRequired; the status then read "Refresh required" through the later transient reconnect, a state reloading cannot clear. Keep connectedEpoch as the fence and track the reconnect fact separately, reset with the epoch on a fresh client lifetime. The overlay regression test now gives the fresh lifetime's first hello a profile, which fails on the pre-fix code.
What Problem This Solves
Update progress and completion reports can disappear when the Gateway restarts, leaving Control UI, chat, and CLI users with different accounts of the same update. Internal sessions also need a durable final report without an unnecessary model turn.
Related: #124396 (transactional update flow), #137580 (extended update outage). Parent #138690 is now merged as
2bf30bac7b5cc815b3d628fd90d6d5f951fd78fe; C is rebased ontomainwithout replaying A. PR A owns durable run history and the shared report; transactional activation and inference repair remain separate campaign work.Why This Change Was Made
The Gateway ledger owns update identity, phases, and outcomes. Control UI resumes that record after reconnect, shares one phase/details/verification view between the dialog and Settings, and retains terminal reports. Browser storage holds acknowledgment and triage receipts only. The browser verifier, inferred-success flow, success toast, and obsolete reload helper are removed; native Mac controls are preserved.
Chat uses stable per-run delivery identities for acknowledgment, activation, verification, and the final report, with a shared destination resolver for external delivery custody and idempotent internal transcript appends. CLI progress follows recorded phases and flushes before the shared final report; JSON includes the durable row. Unused Repairing stays hidden until entered.
This continuation replaces the main merge with a linear stack, first on rewritten A and then on main after A landed. The unrelated iOS history-request test commit is dropped: neither of the two reported failing jobs executes Swift, and there was no exact-head evidence requiring it. The CLI
expectDefinedcontext fix is retained after reproducing TS2554. The gallery timeout was reproduced as missing route-levelsessions.resolvemetadata afterchat.startup; its diagnostics-only edit was discarded. Main's #138793 independently fixed that fixture before the final rebase, so C keeps main's typed resolution/shared page-lifecycle implementation and cold-route reload coverage rather than carrying a duplicate patch.Two additional ordering repairs are included. The pre-park callback records activation before awaiting its notice; waiting for a phase recorded only after park skipped the notice. A retained terminal UI row now releases only its own campaign's stale applying metadata, never a newer campaign's install interlock. New campaign admission retires queued old diagnostics without discarding a manual terminal failure waiting for its request lock to release.
The refreshed ClawSweeper review also found that retrying a retained failed or skipped sidebar report bypassed native Mac ownership. That entry point now reads the same live native bridge as the normal sidebar action. The existing browser ownership scenario covers fresh updates and both retained outcomes, including exactly one native start message, no premature Gateway mutation, and exactly one Gateway handoff if the native owner declines.
User Impact
Operators can follow an update across a restart, inspect its result after reopening Control UI, and receive a durable final report in its originating session. Failed updates keep recovery actions visible. C adds no dependency, configuration option, database schema, or protocol version beyond its parent.
Evidence
Final-head local proof at
0847f56ccf74b3aa9edfb63699df1632705e63f8: 702 targeted tests passed—535 Gateway/CLI/helper tests across seven files, 134 overlay/triage tests across seven files, 31 mocked browser scenarios across seven files, and two built-CLI process previews. The process previews preserve malformed/migration-pending config and state while checking matching durable run identities and terminal dry-run reports. The fullpnpm check:changedpassed, including every core-test typecheck shard.pnpm buildpassed with UI included (346,300 B startup JavaScript gzip against the unchanged 350,953 B limit), with no ineffective dynamic-import warning. Independent Codex autoreview of the complete staged candidate against pinned maina44ab9a58fe5113a72c2e4d0344d1a03c8ba59bfis P0/P1 scoped-clean. All proof was rerun after A's squash merge and C's final rebase, then rerun for the native-retry repair. Prior head838309172d83dc9ac3513341920ef2bb64aca79fpassed exact-head CI in run 33942741164, including both originally failing checks and without the unrelated iOS commit. Final exact-head CI also passed in run 33946418237: the required watcher exited 0 withSUCCESS, zero pending checks, andGREEN. No CI job rerun was needed for the final head; intermittent GitHub metadata-read failures only delayed observation.The reproduced regressions cover the original missing TypeScript argument and gallery timeout, pre-park notice ordering/deduplication, newer campaign interlock and stale diagnostic admission, manual terminal-failure presentation, and native-owned sidebar retries. With the native repair removed, the fresh-update case passes while failed/skipped retries show “Update Gateway” instead of “Update Mac app + Gateway”; all three pass after the one-line owner-routing repair. The final overlay/confirmation suites pass 117 tests and triage runtime passes 17. The seven-file mocked Control UI matrix passes all 31 scenarios with exact assertions retained. Native proof reaches the browser-to-Mac message boundary and decline handoff; it is not an actual Sparkle installation.
C-only LOC versus pinned main: production/tooling +1,727/−1,513 (+214); tests/support +2,468/−3,316 (−848); docs +70/−16. The continuation repairs themselves are net-neutral production (+10/−10), including the native retry's +1/−1. Feature growth supplies the shared report/phase view and durable notice routing while removing browser execution-state inference and duplicate output/destination paths. Schema extraction is a move, not an added database schema. The behavior-neutral deslop audit found no further cleanup worth changing; the same-campaign fixture correction belongs to the interlock repair.
The two-tab dashboard request-count flake recurred during native-fix validation: dashboard demand stayed at two requests, but one additional non-dashboard
sessions.listappeared. The counter calls all non-dashboard requests “canonical,” so this alone does not establish duplicate roster demand. An isolated diagnostic run, a diagnostic matrix, and the final exact-source seven-file matrix subsequently passed. Its precise request owner remains unproven; no speculative production fix, relaxed assertion, or diagnostics-only patch is included. Named follow-up: capture the extra request's parameters and tab, then attribute it to canonical refresh or an independent session query before repairing ownership or startup synchronization.Review Follow-through and Remaining Blockers
The four-message documentation qualifies standalone managed systemd/launchd updates, where intermediate notices depend on restart timing. Before-park notice delivery is covered at the actual callback ordering boundary, without claiming universal timing for watchdog/EOF paths.
The ClawSweeper interruption-recovery finding remains a pre-landing blocker: a killed CLI updater can leave a running row that keeps update/config controls busy after reconnect. Safe recovery needs an accepted run-owned claim and helper-to-updater transfer/reconciliation design in the ledger/orchestrator owners. A helper may die while its updater survives; an age cutoff or helper-PID-only workaround would be unsafe. No unapproved persistent-store design is added here.
The standalone CLI-to-idle-Gateway watcher discovery finding also remains open. Current local watcher tests do not prove cross-process admission/completion notifications without a Gateway restart. Both corresponding Rank-up moves are explicitly deferred to their owners, not claimed resolved. The third Rank-up move, native routing for retained sidebar retries, is addressed with red/green browser proof. A has landed, but the two pre-landing owner tasks remain; green CI and P1-scoped autoreview do not supersede these broader review blockers. This PR is not being merged by this continuation.
Earlier Campaign Proof
Campaign proof, not rerun on this recut branch: AWS proof run 9 at
8a4db45aff48f6fc7b44add16e5756505450e26frecorded all seven scenarios on September 4, 2026: healthy preflight/dry-run; successful update (32.626 s downtime); internal webchat with exactly one transcript report (32.074 s); already-current skip; poisoned-package staging failure; candidate-canary verification failure; rollback to the previous running version (32.369 s).This is integrated campaign evidence, not proof that standalone C already provides the complete live managed-install four-message timing flow.
Inspected synthetic Control UI screenshots
These existing captures show the update-flow states; the continuation retains their view and adds ordering/interlock coverage.