Repository navigation
feat(update): recover failed updates with bounded repair - #139495
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 6, 2026, 7:01 AM ET / 11:01 UTC. ClawSweeper reviewWhat this changesAdds bounded model-assisted recovery to failed updates, with disposable candidate repair, updater-controlled service recovery, and operator-visible attempt reports. Merge readiness⛔ Blocked before merge - 2 items remain Keep open as useful, maintainer-owned work. The earlier isolation and requester-authority findings are addressed, and no remaining blocking defect was established. The previous generic compatibility warning does not identify an additional unresolved contract change. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s updater receives CLI or Gateway update requests, validates a candidate installation, and controls activation and recovery. Repair uses configured inference, while independent checks determine whether the installation can proceed or must report failure. flowchart TD
A[CLI or Gateway update request] --> B[Stage and validate candidate]
B --> C{Validation passes}
C -->|No| D[Bounded repair in disposable state]
D --> B
C -->|Yes| E[Activate and verify installation]
E --> F{Recovery needed}
F -->|Yes| G[Rollback or bounded installed repair]
F -->|No| H[Record verified outcome]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep repair inside the existing updater lifecycle, with disposable pre-activation state, current requester checks at effects, and independent verification deciding every recovery outcome. Do we have a high-confidence way to reproduce the issue? Not applicable as a new recovery capability; current main’s validation callback establishes the missing integration, and the supplied boundary runs exercise repaired and revoked outcomes. Is this the best way to solve the issue? Yes. Reusing the existing repair loop while retaining deterministic validation, isolated rehearsal and updater-owned lifecycle control is a coherent extension; the prior concrete findings are addressed. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c56ee41de73. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
ee7e4c6 to
b39ca93
Compare
ffdc2a6 to
f452852
Compare
The regression "settles Windows recovery after candidate repair and plugin activation" failed for both terminal outcomes because the latest suspension retained signal listeners and an exit gate. Resolve the same current stop for restoration, plugin maintenance, and final settlement. Both cases and 103 surrounding tests now pass.
Run pre-activation repair against a disposable rehearsal shared by every turn and oracle. Reject required config edits without promoting copies, then independently validate surviving candidate changes before activation. Carry the admitted chat requester's command-owner predicate into both repair paths and revalidate it immediately before tool effects. Record requester revocation and the repair target class in the update ledger. Add observable helper authority, staged isolation, and activation regressions. Preserve installation-scoped recovery guidance. Refs #139495
Read core config before staging and for command-owner policy checks. Skipping plugin validation still materializes metadata and reads the serving SQLite index, changing WAL shared-memory read marks even when config observation is disabled. Load full metadata under the disposable target instead. Resolve the helper fixture's packaged snapshot worker from its canonical runtime entrypoint descriptor. Both staged-isolation cases and all four requester-effect cases pass their assertions. The E2E process still fails teardown on the existing service child cleanup identity error; that upstream blocker remains visible.
Load the spawn recorder through explicit arguments for the owned relay and anchor. Use the production daemon entry for requester checks so source plugin compilation does not consume the fixture deadline.
e8504dc to
ec44c83
Compare
|
Merged via squash.
|
* origin/main: (47 commits) ci: record CPU time for Node test jobs (openclaw#140054) test(crabbox): consolidate wrapper boundary coverage (openclaw#140058) fix(test): keep native filesystem access checks portable (openclaw#140047) fix: preserve models when OAuth preparation fails (openclaw#139951) feat(update): recover failed updates with bounded repair (openclaw#139495) refactor(plugins): share managed npm package traversal (openclaw#140040) chore(ui): refresh control ui locales (openclaw#140059) refactor(auth): share profile failure state reset (openclaw#140049) fix(cron): surface skipped on-exit payloads when jobs are busy (openclaw#139987) fix(codex): preserve exec-server WebSocket backpressure under Bun (openclaw#140048) fix(agents): ground exec approvals in tool results (openclaw#140043) refactor(policy): reuse authored policy value helpers (openclaw#140019) docs: keep ClawSweeper status inspection read-only (openclaw#139958) fix: reduce task maintenance stalls with large histories (openclaw#140038) fix(code-mode): identify unawaited promise output (openclaw#140028) fix(test): release memory search fixtures after failed phases (openclaw#140013) test(gateway): isolate Serve hello lifecycle fixtures (openclaw#140044) fix(microsoft-foundry): bound Entra token retention across accounts (openclaw#127216) fix(process): preserve the cause of cleanup observation failures (openclaw#140015) fix: clear Side chat when its parent conversation is deleted (openclaw#139974) ...
…9495) * feat(update): integrate bounded repair and harden activation ownership Run bounded candidate validation repair before activation and verification repair when rollback cannot recover. Keep service authority with the orchestrator, record attempts live, and use a fresh candidate worker after activation. Preserve Windows suspension and compensation through terminal verification, including cancellation at native mutation boundaries. Preserve restored runtime identity through failed rollback verification and report repair of the previous release as rolled back, keeping the update failure and nonzero exit. Close native staging and Git promotion races. Share run vocabularies and validation shapes, make ledger redaction precise and JSON bounding non-mutating, and improve failure reasons, reports, phase visibility, and unattended-repair documentation. Validation: full changed-file gate including Knip, full build, focused integration and native repair E2E, UI E2E, and Codex P0/P1 autoreview. The explicitly protected lifecycle test remains unchanged; its source loading exceeds the 30-second harness deadline even with fresh dist. (cherry picked from commit d37a9418d9468c3e0894fd6d3cebf74b9c6051f4) * fix(update): await origin notice before managed activation Connect transferred helper activation to the serving gateway notice callback over the existing control pipe, with a ten-second bound before service parking. Preserve helper-owned cancellation and activation checks. Record failure excerpts only for failed steps, so completed managed handoffs no longer report an unknown exit code. Cover internal transcript custody with the real helper and bounded simulated service-manager flows. (cherry picked from commit 8a4db45aff48f6fc7b44add16e5756505450e26f) * refactor(update): share repair budgets and validation cleanup * fix(update): preserve transaction outcomes through repair * refactor(update): remove unused package activation flags * fix(update): settle the current Windows recovery owner The regression "settles Windows recovery after candidate repair and plugin activation" failed for both terminal outcomes because the latest suspension retained signal listeners and an exit gate. Resolve the same current stop for restoration, plugin maintenance, and final settlement. Both cases and 103 surrounding tests now pass. * fix(update): align shared types and repair test ownership * docs(update): place fallback scope beside candidate staging * fix(update): isolate staged repair and enforce requester authority Run pre-activation repair against a disposable rehearsal shared by every turn and oracle. Reject required config edits without promoting copies, then independently validate surviving candidate changes before activation. Carry the admitted chat requester's command-owner predicate into both repair paths and revalidate it immediately before tool effects. Record requester revocation and the repair target class in the update ledger. Add observable helper authority, staged isolation, and activation regressions. Preserve installation-scoped recovery guidance. Refs openclaw#139495 * fix(update): defer plugin metadata until repair isolation Read core config before staging and for command-owner policy checks. Skipping plugin validation still materializes metadata and reads the serving SQLite index, changing WAL shared-memory read marks even when config observation is disabled. Load full metadata under the disposable target instead. Resolve the helper fixture's packaged snapshot worker from its canonical runtime entrypoint descriptor. Both staged-isolation cases and all four requester-effect cases pass their assertions. The E2E process still fails teardown on the existing service child cleanup identity error; that upstream blocker remains visible. * fix(update): sanitize rehearsal env and remove helper cycle * test(update): preserve repair proof across env sanitization Load the spawn recorder through explicit arguments for the owned relay and anchor. Use the production daemon entry for requester checks so source plugin compilation does not consume the fixture deadline. * fix(update): preserve requester errors and prepare helper tests * test(update): follow the shared stdin write contract * refactor(update): separate admission and failure reporting
Related: #124396 (transactional update flow), #137580 (update outage), #136997 (no-op update restart).
PR D (#138839) has landed. This branch is based on main and the diff is now E-only: it connects the bounded repair capability from #138738 to transactional updates.
What Problem This Solves
Resolves a problem where a candidate that fails validation, or an activated installation that cannot safely roll back after verification fails, has no bounded repair attempt in the update flow. Managed updates also need to deliver the activating notice before parking the serving Gateway and report completed handoffs without a misleading failure excerpt.
Why This Change Was Made
The deterministic update orchestrator invokes bounded repair using the operator's configured inference. Before activation, the candidate-rehearsal owner supplies disposable configuration, state, workspace, home, and temporary paths shared by repair and validation. Candidate-root repairs can proceed to activation, but configuration changes are not promoted:
repair-requires-config-changereports the changed top-level keys for operator action. After activation, inference runs in a candidate-owned IPC worker, while the parent retains service ownership, validation, cancellation, and transaction settlement.Both repair paths carry the requester predicate owned by
src/infra/update-requester-authority.ts. It is revalidated before tool effects, including after pending inference, and a revoked requester stops withrequester-revoked. Rehearsal environment overrides are limited to isolation paths and pass through the existing host-env sanitizer; executable lookup and inherited credentials remain host-owned.Recovery returns through the shared restart step so a repaired candidate continues plugin convergence. Failed repair preserves rollback refusal reasons; repair of a restored previous generation remains a rollback outcome. Windows settlement uses the current service-stop owner. The helper's
before-parkmarker waits for the activating notice, and completed handoff steps no longer carry anExit code: unknownfailure excerpt.User Impact
CLI, chat, Control UI, and unattended update runs can attempt bounded repair while the orchestrator retains installation and service lifecycle authority. A rejected staged candidate leaves serving configuration and state unchanged. Revoked chat authority cannot retain repair tool access. Operators see attempts and precise stop reasons in the ledger, reports, and notices, with
openclaw doctor --fixoropenclaw triageguidance when configuration needs an operator change.No new config keys or schema changes.
Evidence
The CI repair declares the helper lifecycle suite's runtime prerequisite and preserves config/plugin load errors while denying effects; regressions reproduce both failures, and extracting database-context inspection and Windows error composition keeps the updater within the existing lint limit.
The two ClawSweeper P1 findings are repaired at their owners:
src/infra/update-candidate-rehearsal.tsandsrc/cli/update-cli/update-command-repair.ts;staged CLI repair isolation > discards config and doctor repairs without changing serving filesverifies live-file bytes, inode, and mtime remain unchanged and reportsrepair-requires-config-change. Its siblingkeeps candidate-root repairs eligible for activationprotects activation of a candidate-only repair.src/infra/update-requester-authority.ts, carried through the CLI repair and candidate worker. The built-helper lifecycle casesguards validating/verifying repair effects with the current chat requester (revoked=false/true)exercise both paths. Allowed runs record repair and execute the second spawn, command, and write. Revocation while inference is pending prevents those second effects and recordsrequester-revoked.The exact-head CI failures were traced to two owners. The helper test-support cycle is removed by a shared leaf contract; both import-cycle checks reproduced the original failure and pass after the fix. Both Opengrep OSS and Scan changed paths reported the same
openclaw-skill-env-host-injectionfinding in the repair runtime. The saved scan log'supdate-cli.test.tsentries are timeout warnings, not a credential finding. The newrepair rehearsal environment > keeps disposable selectors but rejects hostile overrides before child executionregression fails on the old runtime when a synthetic loader override reaches a real child; it passes with the sanitizer and restricted overrides. The helper recorder uses explicit Node arguments for its exact relay/anchor workers, so the proof remains observable afterNODE_OPTIONSis scrubbed. Requester checks use the same stable built daemon entry as production, avoiding source-plugin compilation inside the test deadline. No assertion or timeout was weakened, and no scanner suppression, baseline, or allowlist was changed.Earlier local proof: the 49-file focused run passed 1,348 tests with one platform skip. All four built-helper allowed/revoked cases passed in both the focused harness run and the broader suite. Full
pnpm check:changed, all three Knip export scans, and both import-cycle checks passed.pnpm buildpassed before and after the main rebase with zero[INEFFECTIVE_DYNAMIC_IMPORT]warnings. Branch and final-candidate Codex reviews were clean at P0/P1.The earlier repair E2E run passed both staged-isolation cases and the existing validating case. The existing verifying case failed its expected repair-summary assertion: the repaired marker and successful oracle were present, but supervisor cleanup returned
service child cleanup identity lost: write EPIPE, replacing the final summary. The same failure appeared again during global cleanup. This is the separate suspected EPIPE race documented in #139887, not an all-assertions-passing EPERM-only teardown. No assertion, timeout, or process-supervisor code was changed to conceal it. CI passed for d4b18e843258 (run 34027969226).Historical campaign-branch proof, not rerun here: run 9 at source
8a4db45aff4passed 90 assertions across seven scenarios (preflight,success,webchat,noop,poison,canary,rollback), withmechanicsPass=true. The poisoned canary attempted repair while preserving the serving old PID; the poison-download E500 failed before repair. Acknowledgement, activating, verifying, and terminal notices were observed.The macOS process-supervisor teardown limitation is tracked separately in #139887. Its standalone reproduction does not require repair code. Linux CI remains the arbiter for that cleanup path; the repair changes do not weaken teardown assertions or alter
src/process/*.