Skip to content

fix(update): explain what holds a blocked update - #182774

Merged
fuller-stack-dev merged 1 commit into
mainfrom
fix/update-retained-custody-message-20261024
Oct 24, 2026
Merged

fuller-stack-dev merged 1 commit into
mainfrom
fix/update-retained-custody-message-20261024

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes: another update is reported as “already running” when a failed or cancelled updater has exited but its installation custody is still retained.

User Impact

The refusal now names the lease type, owner, lease version, helper/executor PIDs, observed process identity state, and last activity. It gives profile-aware status and repair commands instead of suggesting that waiting will necessarily finish the update. RPC, CLI and automatic-update history preserve the explanation; chat no longer claims the updater is running.

This does not delete locks or weaken admission. Live or unverified writers remain protected. An older installed Gateway/CLI needs this code before its messages change.

Why This Change Was Made

The underlying cancelled-custody repair already landed in #177932 (45314c992e24721bba62685795f1be533807656b), including recovery after Doctor failure/deferral without restarting the cancelled family’s grace period. Current-main tests confirm that repair settles dead custody and permits the next update, while retaining live children and unverified recovery. This PR fixes the remaining misleading report at both fresh-helper and cached-handoff admission. It adds no new state or recovery policy.

Evidence

  • New production-boundary regression: a real child acquires and cancels an update lease, exits, then a real managed helper and its concurrent cached join both refuse with the actual dead owner’s details. A live-owner control and unchanged-custody assertions protect admission. The missing message fails on base; both cases pass with the fix, including profile-specific repair/status guidance.
  • Existing repair cancellation (3), recovery (33), reclamation (12), and finalization refusal (17) cases exercise release/retry, failed/deferred repair, retained live children and unchanged custody protections.
  • Gateway RPC/history tests: 36 passed. Handoff single-flight/cross-process plus startup consumers: 84 passed, one Windows-only case skipped on macOS. Final changed startup/busy suites: 47 passed; notice renderer: 10 passed. New busy test execution is about three seconds; CI duration will be available on this PR.
  • Targeted CLI/update and Gateway-methods type graphs, scoped oxlint, oxfmt and diff checks pass. The compiler requires checkout-local declaration inputs, so only this disposable checkout used a project virtual store with the same global content store and import method auto; no per-task package store.
  • An initial baseline assertion used a very long private TMPDIR and hit the existing 2048-character ledger detail limit; the same repair suite passed with a shorter private TMPDIR. No production expectation was weakened.
  • Whole touched-test-file audit retained distinct outcome, timing, custody and failure coverage; no source-text mirrors or mocked lease/reclamation logic were introduced. No live Gateway, configuration, lease or database was changed.

Independent API-only full review found one P2 (profile-aware recovery commands); it is fixed and the independent delta review is P0–P2 clean. To satisfy existing line-cap ratchets, the unchanged root-identity assertion moved to a sibling module (same export) and the unchanged startup fixture type moved to its existing test-support module. No coverage was removed. Exact-head required CI remains the landing gate.

@clawsweeper

clawsweeper Bot commented Oct 24, 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes size: M labels Oct 24, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review October 24, 2026 18:30
@fuller-stack-dev
fuller-stack-dev enabled auto-merge (squash) October 24, 2026 18:38
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR explains retained update custody and carries that explanation into CLI output, Gateway responses, automatic-update history, and chat summaries.

Example: The cancelled updater previous-update-owner has exited while its version-4 custody remains.

  • Before: The next update says another update is already running.
  • After: The refusal identifies cancelled custody, its owner and process states, and suggests status and repair commands.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful and narrowly scoped, with production-owner subprocess coverage, but the recovery guidance has one concrete targeting defect.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor-proof gate; its supplied evidence reports real subprocess custody tests and consumer regressions, with no shipped-entry-point capture of the changed reporting.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A blocked update tells the operator an updater is running even after that updater has exited.
Reason: The maintainer-authored direction corrects a false explanation while preserving existing admission and repair ownership.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR addresses misleading update refusals on current main, but its new recovery commands lose custom installation paths and need a focused correction.

Priority: P2
Reviewed head: 23afb52206ff42d1abab7baadd1d68948521188d

Before merge

  • Preserve installation paths in the recovery commands (P2) - When a Gateway service uses OPENCLAW_PROFILE=work with OPENCLAW_STATE_DIR=/srv/openclaw/work and OPENCLAW_CONFIG_PATH=/etc/openclaw/work.json, these calls print only openclaw --profile work update status and update repair. In the independent terminal requested by the message, those service-only environment values are absent, so the commands select ~/.openclaw-work and its config instead of the diagnosed state. Status therefore shows unrelated history, and repair targets unrelated state. Use resolveInstallationTarget(env) with the existing formatInstallationTargetCommand for both commands, and extend the boundary regression to verify custom selectors survive the handoff.

Findings

  • [P2] Preserve installation paths in the recovery commands — src/infra/update-managed-service-handoff-diagnostics.ts:67-68

Tests

  • Missing end-to-end proof: The supplied evidence does not show an installed CLI or Gateway displaying the new refusal and recovery commands in a fresh terminal with service-only path selectors.
Agent review details

How this fits together

CLI, Gateway RPC, and automatic updates request admission from the managed-handoff owner, which reads installation custody and returns either a prepared helper or a refusal consumed by update reporting.

flowchart TD
  A[CLI update] --> D[Managed handoff owner]
  B[Gateway update RPC] --> D
  C[Automatic update campaign] --> D
  D --> E[Existing custody and process identities]
  E --> F[Blocker explanation]
  F --> G[CLI response and update history]
  G --> H[Concise chat notice]
Loading

Technical review

Best possible solution:

Keep the shared custody explanation and generate its recovery commands through the existing installation-target formatter.

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

Current-main source supplies already-running wording for joined custody regardless of observed liveness, and the supplied regression constructs an exited cancelled owner; this read-only review ran no target code.

Is this the best way to solve the issue?

One explanation from the existing handoff owner is the smallest complete approach, provided its recovery commands retain the diagnosed installation's selectors.

Full review comments:

  • [P2] Preserve installation paths in the recovery commands — src/infra/update-managed-service-handoff-diagnostics.ts:67-68
    When a Gateway service uses OPENCLAW_PROFILE=work with OPENCLAW_STATE_DIR=/srv/openclaw/work and OPENCLAW_CONFIG_PATH=/etc/openclaw/work.json, these calls print only openclaw --profile work update status and update repair. In the independent terminal requested by the message, those service-only environment values are absent, so the commands select ~/.openclaw-work and its config instead of the diagnosed state. Status therefore shows unrelated history, and repair targets unrelated state. Use resolveInstallationTarget(env) with the existing formatInstallationTargetCommand for both commands, and extend the boundary regression to verify custom selectors survive the handoff.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/infra/update-managed-service-handoff-busy.test.ts src/gateway/server-methods/update.test.ts src/infra/update-startup.test.ts src/infra/update-run-notice.test.ts --maxWorkers=1
  • pnpm exec oxfmt --check src/infra/update-managed-service-handoff-diagnostics.ts src/infra/update-managed-service-handoff-busy.test.ts
  • pnpm exec oxlint -c .oxlintrc.json src/infra/update-managed-service-handoff-diagnostics.ts src/infra/update-managed-service-handoff-busy.test.ts
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e1a7008 adds src/infra/update-managed-service-handoff.ts:1379 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e1a700840a76; files: src/infra/update-managed-service-handoff.ts)

PR surface

Source +68, Tests +141. Total +209 across 13 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 107 39 +68
Tests 5 157 16 +141
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 264 55 +209

Labels

Label changes:

  • add P2: This is a useful, bounded improvement to update-recovery diagnostics with a focused command-targeting defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This is a useful, bounded improvement to update-recovery diagnostics with a focused command-targeting defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 24, 2026, 2:47 PM ET / 18:47 UTC.

@fuller-stack-dev
fuller-stack-dev merged commit 87aa01a into main Oct 24, 2026
225 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/update-retained-custody-message-20261024 branch October 24, 2026 18:57
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant