Repository navigation
feat(update): retain run history and share outcome reports - #138690
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. |
d38217f to
11e6797
Compare
|
Codex review: blocked before merge. Reviewed September 4, 2026, 10:57 PM ET / September 5, 2026, 02:57 UTC. ClawSweeper reviewWhat this changesAdds persistent update history and shared outcome reports across the CLI, chat, Gateway restarts, and administrator APIs. Warning SQLite table change This PR modifies persisted SQLite tables in Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 10 items remain Keep open: current main lacks this history foundation, both prior findings remain, and interrupted-run reconciliation is still unresolved. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s updater accepts requests from the CLI, chat, and automatic campaigns, then coordinates installation and Gateway recovery. The new ledger records that work so status commands and completion notices can report the same outcome. flowchart TD
A[CLI or chat request] --> C[Update admission]
B[Automatic campaign] --> C
C --> D[Persistent update history]
C --> E[Updater and service recovery]
E --> D
E --> F[Restart notice]
D --> G[Shared outcome report]
F --> G
G --> H[CLI status and chat]
Decision needed
Why: The dependent PR explicitly leaves this blocked on acceptance of a material persistence design, and helper death alone cannot safely distinguish abandoned work from a surviving updater. 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 one ledger and renderer, with preserved notice ownership, cross-process discovery, safe interrupted-run reconciliation, and verified fresh-install and upgrade behavior. Do we have a high-confidence way to reproduce the issue? Yes, from the pinned PR source: a package-target refusal overwrites absent notice metadata, an idle watcher misses separate-process admission, and a killed updater leaves an active row. These paths were not executed during this read-only review. Is this the best way to solve the issue? The shared ledger and renderer are the appropriate owners, but the implementation is incomplete at admission and lifecycle boundaries; extending the singleton sentinel would not provide retained history. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bb147376f771. 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 (2 earlier review cycles)
|
404939d to
da97b00
Compare
Carry one durable run ID through gateway admission, CLI orchestration, managed handoff, campaigns, restart sentinels, and boot verification. Record refusals and native recovery outcomes so every attempt has an operator-visible result, with bounded redacted metadata in the shared DB. Add update.runs.get/list and update.run.changed without removing existing status fields. Use one report renderer for chat, CLI, status, and restart notices; retain the stable pre-ledger sentinel upgrade adapter. Keep the existing activation order and detached helper process model. (cherry picked from commit 13ca668a9d4f788586f03189978fb8fa9b8c651a)
Describe run IDs, history RPCs, report-backed status and restart notices, and the same-version lazy update_runs table in the shared state DB. (cherry picked from commit 7e798570f7ddd7f5fcdb5b5684d49da523217c43)
Port precise redaction and immutable JSON bounding, share the run vocabulary, and regenerate native protocol models. Preserve phase identities and timestamps when diagnostic details exceed the byte budget. Record Windows cancellation at the recovery owner before releasing its process exit gate, including restoration failure. Remove the redundant outer inference. Cover actual history handlers and retain newer main service-refresh behavior. Independent Codex P0/P1 review found no actionable findings. Focused ledger, report, watcher, protocol and history handler proof passed; cancellation tests failed before the fix and passed afterward. Full validation follows separately.
Admit CLI ledger writes only after validation and ownership checks. Preserve existing history on rejected invocations while verifying valid dry-run records through the built CLI. Align the protocol owner inventory and DDL exemption, and refresh the Workboard asset pointers generated by the additive protocol schemas.
|
Merged via squash.
|
…138690) * feat(update): persist update runs and share outcome reports Carry one durable run ID through gateway admission, CLI orchestration, managed handoff, campaigns, restart sentinels, and boot verification. Record refusals and native recovery outcomes so every attempt has an operator-visible result, with bounded redacted metadata in the shared DB. Add update.runs.get/list and update.run.changed without removing existing status fields. Use one report renderer for chat, CLI, status, and restart notices; retain the stable pre-ledger sentinel upgrade adapter. Keep the existing activation order and detached helper process model. (cherry picked from commit 13ca668a9d4f788586f03189978fb8fa9b8c651a) * docs(update): document durable run history and reports Describe run IDs, history RPCs, report-backed status and restart notices, and the same-version lazy update_runs table in the shared state DB. (cherry picked from commit 7e798570f7ddd7f5fcdb5b5684d49da523217c43) * fix(update): preserve diagnostic paths and terminal run history Port precise redaction and immutable JSON bounding, share the run vocabulary, and regenerate native protocol models. Preserve phase identities and timestamps when diagnostic details exceed the byte budget. Record Windows cancellation at the recovery owner before releasing its process exit gate, including restoration failure. Remove the redundant outer inference. Cover actual history handlers and retain newer main service-refresh behavior. Independent Codex P0/P1 review found no actionable findings. Focused ledger, report, watcher, protocol and history handler proof passed; cancellation tests failed before the fix and passed afterward. Full validation follows separately. * refactor(update): keep Windows autostart recovery in one owner * test(update): align fixtures with recovery ownership * fix(update): preserve state before run admission Admit CLI ledger writes only after validation and ownership checks. Preserve existing history on rejected invocations while verifying valid dry-run records through the built CLI. Align the protocol owner inventory and DDL exemption, and refresh the Workboard asset pointers generated by the additive protocol schemas. * fix(gateway): register update.runs methods on the current protocol train * test(gateway): list update.runs methods on the 2026.8 train * chore(workboard): refresh built Control UI asset pointer for update run schemas * fix(gateway): register update.runs methods on the 2026.9 train * test(gateway): build update run broadcast fixtures with the client registry
* refs/remotes/origin/main: (602 commits) fix(plugins): trace trust refusals and repair legacy provenance (openclaw#138746) perf(sqlite): reuse compiled plugin state point reads (openclaw#138758) refactor: type chat prefetch dependencies and clean loading tests (openclaw#138793) ci: reduce Doctor test startup and core lint jobs (openclaw#138796) feat(update): retain run history and share outcome reports (openclaw#138690) chore(deps): update @openclaw/fs-safe to 0.8.1 (openclaw#138500) fix: preserve global board ownership from pinning to notifications (openclaw#138675) fix(gateway): deliver session catalog updates from slow hosts (openclaw#138674) perf(sessions): index pending conversation replies (openclaw#127182) perf(auth): reuse ordered provider alias entries (openclaw#138805) docs(diagnostics): clarify whole-process CPU metrics (openclaw#138804) perf(memory): narrow source reads and stream embedding cache rows (openclaw#138766) fix: allow older source on newer Testbox checkouts (openclaw#138782) fix(agents): preserve recovered task progress and lifecycle ownership (openclaw#138785) perf(codex): reduce rollout tail scan CPU (openclaw#138784) perf(gateway): stop projecting history deltas at the byte budget (openclaw#138655) fix(build): bound native declaration inputs to checkout (openclaw#138742) fix(cli): preserve foreground Gateway argument handling (openclaw#138765) fix(ui): align task toolbar with side-panel tabs (openclaw#138769) fix(logbook): drain accepted work before closing SQLite (openclaw#138754) ... # Conflicts: # src/agents/embedded-agent-runner/compact.queued.ts
What Problem This Solves
Operators lose a consistent view of an update when the Gateway restarts or the detached updater continues working. Chat, CLI output, and status currently reconstruct different summaries, making a successful maintenance operation hard to distinguish from a failed or abandoned update.
Related: #124396 (transactional update design; this PR supplies its durable history and reporting foundation), #137580 (long detached-update outage with no durable progress view).
Why This Change Was Made
One shared-state
update_runsledger now carries a run ID through Gateway admission, the detached helper, CLI orchestration, the restart sentinel, and boot verification. The first terminal outcome wins, while later observed verification facts can enrich the record. The additive table is lazily ensured at schema version 15; the sentinel keeps ownership of continuation and delivery.One renderer replaces the separate chat, CLI, and status outcome formatters. The cleanup also shares protocol/ledger vocabulary, preserves useful recovery paths during redaction, bounds JSON without mutating its input, preserves phase timestamps when multibyte diagnostics fill the byte budget, and records Windows cancellation before releasing the process-exit gate. Newer main's verified service-refresh fast path and update-check configuration reload behavior are preserved. CLI validation and ownership checks finish before ledger admission, so rejected invocations preserve existing state and orphaned SQLite journals.
User Impact
Update results include
runId; administrators can readupdate.runs.getandupdate.runs.list, inspectactiveRun/lastRunin status, and receive boundedupdate.run.changednotifications while a run is active. History survives sentinel consumption. Chat, CLI, and status use the same recorded outcome and recovery guidance. Dry-run previews leave a skipped history entry.This is the first part of the update-flow campaign. Transactional activation, repair orchestration, and the Control UI flow follow in dependent PRs.
Evidence
Local branch proof:
pnpm protocol:gen,pnpm protocol:gen:swift,pnpm protocol:gen:kotlin, and the Kysely type generator passed; a post-rebase regeneration produced no additional tracked changes.pnpm buildpassed twice on earlier candidates; 53 built module/doctor closures and UI budgets passed, with no[INEFFECTIVE_DYNAMIC_IMPORT]warnings. The refreshed final build also passed in seven minutes with no ineffective dynamic-import warnings.pnpm check:changedpassed on the refreshed head, including all typechecks, architecture/dead-export/lint gates, Android and Swift lint, 1,105 macOS tests across 20 files, schema version 15, and final database/import-cycle/webhook/pairing guards. Earlier attempts exposed a Windows maintenance line limit and obsolete fixtures (fixed), then a missing shared pnpm launcher and disk exhaustion (recovered using the same pinned pnpm 12.1.0).OPENCLAW_STATE_DIR:pnpm openclaw update --dry-run --json, thenpnpm openclaw update status --json. Exactly one terminalskipped/dry-runrecord;lastRunmatched the preview's run ID, and no active run remained. Repeated against the refreshed final production build.2026.9, while current main requires2026.8. The current exact-head CI log confirms these two values are its only completed failure; three iOS jobs remain running. No guard was weakened; this blocker awaits campaign-owner direction.Regression evidence was captured before fixing redaction, phase loss under the multibyte JSON budget, and Windows cancellation during task suspension. Each now passes. Native Windows PowerShell policy, long-path, and reused-PID tests await Windows CI; cancellation assertions cover the Windows owner with mocked native services.
Campaign-branch evidence, not a rerun of this PR: AWS run 9 on September 4, 2026, against campaign commit
8a4db45aff48f6fc7b44add16e5756505450e26fpassed all 90 assertions. Across the six update scenarios, run IDs survived the flow, terminal records remained readable throughupdate.runs.get, CLI status returned the matchinglastRun, and reports contained the expected outcome.succeededsucceeded; completion report in historyskipped/already-currentfailed/global-install-failedfailed/runtime-verification-failedrolled-back/restart-unhealthyThose campaign results include later activation and delivery work. They establish cross-process ledger/report integration, not A-only canary, no-op, or rollback guarantees.
Production LOC: +2,545 / -729 (net +1,816); tests and test support: +1,790 / -531 (net +1,259); generated Swift/Kotlin/Kysely and asset pointers: +226; docs: +77. Production growth provides the durable ledger, cross-process identity, history protocol, active-run watcher, and shared reporting. Removed duplicate outcome formatters, JSON traversal and phase vocabularies, redundant cancellation inference, and a one-use Windows recovery wrapper. The legacy restart-sentinel adapter remains for the shipped payload contract.