Skip to content

fix(update): repair young runs after recorded drivers exit - #143136

Merged
steipete merged 1 commit into
mainfrom
steipete/upd-update-ledger-141617
Sep 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/upd-update-ledger-141617

Conversation

@steipete

@steipete steipete commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #141617
Refs #141562

Additional instructions

This branch is in the upstream repository and is editable by maintainers.

What Problem This Solves

Fixes an issue where users running openclaw update repair would be told an update was still in progress for 30 minutes after its recorded updater had exited, even when the Gateway was healthy on the installed version and build. The abandoned requested/running row kept the update-in-progress state visible across reconnects.

Why This Change Was Made

Explicit reconciliation now checks recorded process ownership without requiring inactivity when every recorded driver is provably dead and no adopter is marked driver:identity-unavailable. Missing PIDs and changed process-start identities use the existing liveness checks. The ledger rechecks ownership in its terminal write transaction, preserves the original history as failed/abandoned, and the existing repair path acknowledges the outcome without entering Doctor, maintenance, or failure triage.

Identityless rows and rows marked driver:identity-unavailable retain the inactivity requirement. Live or uninspectable recorded drivers still block repair. Automatic reconciliation, post-core convergence, schema, and retention behavior are unchanged. Documentation explains the explicit-repair rule.

User Impact

Operators can immediately clear a young abandoned update with openclaw update repair when its recorded drivers are dead and the installed Gateway generation is healthy. No service stop, database deletion, or coding-agent launch is needed for ledger-only recovery. Reconnects read the terminal outcome; they cannot recreate the old running row.

Evidence

Added public-command coverage using real SQLite state and real local process inspection, with controlled Gateway health responses. It covers an exited child PID, a reused PID identity, and a young live driver. Extended existing ledger coverage for young retained parents, an unrecorded adopter, and adoption between inspection and reconciliation.

Before changing production code:

node scripts/run-vitest.mjs src/cli/update-cli/update-repair-command.test.ts
Tests  2 failed | 39 passed (41)
Expected: phase=finished, status=failed, reason=abandoned
Received: phase=requested, status=running, reason=null

Both failures were the new young/dead-driver regressions. The young live-driver refusal already passed.

After the repair:

node scripts/run-vitest.mjs src/cli/update-cli/update-repair-command.test.ts src/infra/update-run-abandonment.test.ts src/infra/update-run-driver.test.ts src/infra/update-run-ledger.test.ts src/commands/status.update-ledger.test.ts src/cli/update-cli/status.test.ts
Tests  83 passed + 45 passed + 12 passed (140 total)

node scripts/run-vitest.mjs src/gateway/update-run-watcher.test.ts src/gateway/update-run-notice.test.ts src/gateway/server-restart-update-run.test.ts
Tests  24 passed (24)

The command regression verifies the original row becomes terminal and acknowledged, no replacement row is created, no full finalizer is invoked, and the user sees the no-maintenance success message. Existing watcher tests verify terminal broadcasts and polling cessation; ledger tests preserve first-terminal-wins and reject later adoption.

Additional checks passed before a documentation-only rebase: node scripts/check-changed.mjs (format, core/test types, lint, ratchets, and architecture guards), pnpm docs:check-mdx (1,196 files), and git diff --check. The first changed-file run found one formatting issue, corrected with the repository formatter before the successful rerun.

Main moved the database reference into topic pages while CI ran. The explanation now lives in docs/reference/database-schemas/layout.md; production and test files are byte-identical across the rebase. Final-head verification reran node scripts/run-vitest.mjs src/cli/update-cli/update-repair-command.test.ts src/infra/update-run-abandonment.test.ts (84 passed), checked formatting on the relocated page, and passed pnpm docs:check-mdx (1,215 files) and git diff HEAD^ HEAD --check.

The final-head changed-file gate also passed:

node scripts/check-changed.mjs -- docs/cli/update/repair-and-recovery.md docs/reference/database-schemas/layout.md src/cli/update-cli/update-repair-command.test.ts src/infra/update-run-abandonment.test.ts src/infra/update-run-activity.ts
Exit code 0

Exact-head CI is blocked by checks-node-changed-extensions-bundle-10, with the required CI gate failing as a consequence. The failed test is the unchanged extensions/codex/src/app-server/settled-turn-finalizer.native.test.ts case runs and cancels ephemeral side forks without changing the parent:

CodexAppServerLocalRequestCancellationError: turn/start aborted
code: CODEX_APP_SERVER_LOCAL_REQUEST_CANCELLED
Tests  1 failed | 257 passed (258)

Its stack runs through the Codex attempt deadline handler; this native side-fork path does not exercise update repair. The affected test and deadline/client files are unchanged from this branch's original base. The underlying native-test failure still needs separate diagnosis; no timeout, assertion, or CI retry was changed to conceal it. All PR checks have settled.

Validation limitations: Gateway probes are controlled boundary tests, not a live macOS/Homebrew or Raspberry Pi upgrade. Driver metadata has no separate boot ID or executable identity; a coincident PID/start identity after reboot remains conservatively protected. A terminal abandoned outcome may remain as a dismissible history card, but it is no longer an update-in-progress card.

@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 9, 2026 13:49
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 9, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 10:56 AM ET / 14:56 UTC (Revision 3).

ClawSweeper review

What this changes

Allows explicit update repair to clear recent abandoned update records immediately when every recorded updater process is provably dead, with regression coverage and recovery documentation.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and v2026.9.3 still enforce the unnecessary wait. No blocking introduced defect was found, and the existing ownership and recovery safeguards remain intact.

Priority: P2
Reviewed head: 50f6dff98deae770c22da55bba8c0df263af6a72

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage, matching documentation, and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its command tests exercise real ledger writes and process inspection with controlled Gateway responses; they do not establish a live macOS/Homebrew or Raspberry Pi upgrade.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its command tests exercise real ledger writes and process inspection with controlled Gateway responses; they do not establish a live macOS/Homebrew or Raspberry Pi upgrade.
Evidence reviewed 10 items Current main still requires the wait: The fetched main implementation rejects every running record within the 30-minute inactivity window before checking process death, including explicit repair.
Latest supplied release retains the same restriction: The v2026.9.3 source also applies the inactivity window before process inspection; this PR's immediate explicit recovery is not present there.
Narrow recovery predicate: The introduced predicate retains inactivity requirements for automatic reconciliation, identityless records, and unrecorded adopters. Every current and retained driver must still inspect as dead.
Findings None None.
Security None None.

How this fits together

The update ledger stores progress and outcomes consumed by update status and the Gateway. Explicit repair checks process ownership and Gateway health before recording an abandoned run as terminal.

flowchart TD
  A[Operator runs update repair] --> B[Read update history]
  B --> C{Recorded updaters provably dead}
  C -->|No or uncertain| D[Preserve active run]
  C -->|Yes| E[Check Gateway and unfinished work]
  E --> F[Revalidate ownership in transaction]
  F --> G[Retain abandoned outcome and acknowledge recovery]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +7, Tests +53, Docs +4. Total +64 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 3 +7
Tests 2 65 12 +53
Docs 2 8 4 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 83 19 +64

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #141617
Summary: This PR is an explicit candidate for the linked recovery report, focused on the remaining young dead-driver case.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep immediate explicit recovery in the canonical ledger classifier while preserving conservative automatic recovery, terminal history, and post-core convergence checks.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: explicit repair of a running record younger than 30 minutes is rejected on current main even when its recorded updater has exited. This review did not execute the reproduction.

Is this the best way to solve the issue?

Yes. Adjusting the shared abandonment classifier fixes the unnecessary wait without introducing a competing recovery path or bypassing ownership revalidation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4b9ff9dd206b.

Labels

Label justifications:

  • P2: This is a bounded recovery improvement for abandoned updater records, with live updater protection preserved.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its command tests exercise real ledger writes and process inspection with controlled Gateway responses; they do not establish a live macOS/Homebrew or Raspberry Pi upgrade.

Evidence

What I checked:

  • Current main still requires the wait: The fetched main implementation rejects every running record within the 30-minute inactivity window before checking process death, including explicit repair. (src/infra/update-run-activity.ts:45, 4b9ff9dd206b)
  • Latest supplied release retains the same restriction: The v2026.9.3 source also applies the inactivity window before process inspection; this PR's immediate explicit recovery is not present there. (src/infra/update-run-activity.ts:45, 1391f7cd2d40)
  • Narrow recovery predicate: The introduced predicate retains inactivity requirements for automatic reconciliation, identityless records, and unrecorded adopters. Every current and retained driver must still inspect as dead. (src/infra/update-run-activity.ts:48, 50f6dff98dea)
  • Transactional ownership revalidation: Reconciliation rereads selected records inside the write transaction, reapplies abandonment classification, and preserves the whole explicit selection when any record is ineligible. Adoption refuses terminal records. (src/infra/update-run-ledger.ts:361, 50f6dff98dea)
  • Existing repair boundaries remain: The command retains state-write admission, installed-version/build and Gateway health checks, post-core convergence routing, and another ownership check after asynchronous health probes. (src/cli/update-cli/update-repair-command.ts:147, 50f6dff98dea)
  • Focused behavioral regression coverage: The complete command test exercises an exited child PID and changed start identity with real SQLite/process inspection, while mocking Gateway probes and finalization. It verifies terminal retained history, acknowledgment, no replacement record, and no finalizer invocation. Ledger coverage also preserves live/unknown parents and intervening adoption. Tests were inspected, not executed during this read-only review. (src/cli/update-cli/update-repair-command.test.ts:150, 50f6dff98dea)

Likely related people:

  • Peter Steinberger: Raw commit 7f9bf1d adds src/infra/update-run-activity.ts:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7f9bf1d79aef; files: src/infra/update-run-activity.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-09T13:54:46.607Z sha 4d69221 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-09T14:30:49.197Z sha 50f6dff :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/upd-update-ledger-141617 branch from 4d69221 to 50f6dff Compare September 9, 2026 14:23
@steipete
steipete merged commit 12a5f80 into main Sep 9, 2026
307 of 310 checks passed
@steipete
steipete deleted the steipete/upd-update-ledger-141617 branch September 9, 2026 15:16
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 9, 2026
…er-ownership-20260909

* origin/main: (147 commits)
  fix(cli): reject blank account selectors before command startup (#143088)
  fix(update): repair young runs after recorded drivers exit (#143136)
  test(telegram): close model callback fixture connections (#143197)
  improve(test): reduce Telegram policy fixture startup overhead (#143192)
  test(ci): stabilize systemd manager shim timing (#143134)
  fix(test): retire chat preview Escape listeners during teardown (#143191)
  test(memory-wiki): share visibility test callbacks (#143181)
  fix(ci): accept native iOS keychain filenames (#142968)
  fix(ci): show publication observations in FRV status (#143171)
  fix(github): point the stuck-FAQ auto-response at a live anchor (#143194)
  docs: correct verified accuracy defects in CLI, tools, and automation pages (#143179)
  refactor(tests): remove duplicate Mistral cache-cost test (#143172)
  fix(doctor): complete canonical model-reference migration (#142284)
  fix(ci): reject stale and empty timing sample cohorts (#143182)
  fix(ui): remove first-reply confetti from chat (#143167)
  docs: split help/faq into 13 topic pages (#143150)
  refactor(docs): require caller-owned route indexes (#143164)
  fix(android): distinguish connection status from chat readiness (#143128)
  refactor: share agent-turn execution test defaults (#143166)
  fix(cli): print immutable-config refusals without crash framing (#143140)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 2026.9.2 npm update remains stuck at requested/running after supported repair

1 participant