Skip to content

fix(update): preserve unrelated notices during handoff recovery - #188212

Merged
vincentkoc merged 16 commits into
mainfrom
fix/update-handoff-sentinel-owner-20261030
Oct 31, 2026
Merged

vincentkoc merged 16 commits into
mainfrom
fix/update-handoff-sentinel-owner-20261030

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

A detached managed update could rewrite an unrelated restart notice sharing its handoff ID, or borrow a failure reason from another installation.

User Impact

Recovery preserves notices belonging to other runs and installations while the real updater and local lease continue to authorize restoration. No config, schema, protocol or public SDK change.

Why This Change Was Made

Capture the canonical SQLite inspection and outcome writers before package replacement. Share outcome preparation with the PostgreSQL transport; remove duplicate SQLite policy and the PostgreSQL-only result-source module. Revision, consumed-notice, cancellation and terminal-settlement checks remain. The helper retains the shared launchd parser from PR #188226.

Application runtime −116 lines; acceptance infrastructure/catalog/Knip/budget record +656; tests +422. Combined non-test growth is +540: it supplies the required executable packaged older-runtime compatibility proof. The separate test allocation covers only this PR's regression growth.

The fixture isolates published SDK, ledger and notice operations from candidate process-global registries. It publishes through the real canonical writer before forwarding the updater's actual close event. Notice preservation is observed after the canonical owner commits its refusal, including when the updater has already verified recovery and the helper correctly skips another restart. Missing rows and observation errors fail the full-row assertion.

Evidence

  • Signed head 504a6686d67677da187086ca81b8e5bb624215e7: CI SUCCESS, 51 successful jobs, 27 skips, zero failures. Scripts lint, script types and test-line budget passed. Diagnostics passed 17 cases in 3171 ms; the actual-preload no-restart observation regression passed in 24 ms.
  • Exact harness head Package Acceptance SUCCESS. The single older-runtime lane completed in 642 seconds, exit 0, with neither deadline nor output timeout. The public artifact records the selected lane, passing outcome and joined cleanup.
  • That case separately installed published [email protected] and ran the candidate-generated sealed helper against its real CLI. It verified exact candidate/restored package payloads, settings, workspace contents and SQLite plugin data; the unrelated notice's full raw row/revision at the post-refusal observation; fresh Gateway identity and HTTP readiness; terminal rolled-back history; lease release; and sensitive-file cleanup. The published runtime lacks the new operation export. No parameters, lease history or recovery results are fabricated.
  • Acceptance reused the verified package artifact: source f22a2670eaf09742beff52aeaa568705114356d7, version 2026.10.9, tarball SHA-256 a5b09e9fb6620ef2ca3d1a012591a0565837f807388bd7e938f411994a6ed63b. Application source is byte-identical; subsequent commits touch excluded harness/tests/budget metadata only. The producer was cancelled after artifact publication.
  • Both ownership regressions failed on unchanged production: RED job. Prior application-source proof passed 600 handoff cases across 34 suites, with 15 skips; all three general PostgreSQL stripes passed. The observer regression also failed with the old observer. Independent scoped review, syntax, formatting, diff/privacy checks and signed hooks passed. No local dependency-backed suite ran.

The disposable service adapter reports observed Gateway identity; it does not prove real transient systemd/cgroup custody or native macOS execution. No live operator update was performed.

Five generated-helper PostgreSQL cases remain skipped; general conformance does not replace them. Follow-up: generated-helper PostgreSQL execution inventory. Prior package validation passed published 10.9 authenticated restart/full payload checks; its separate 10.8 secondary UI specimen exceeded the deadline. Follow-up: isolate that specimen's receipt/phase timing. The new lane joins unfiltered Docker-all; explicit release profiles remain unchanged.

@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Oct 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 30, 2026 09:17
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The managed updater uses canonical notice operations to preserve unrelated notices and the current update’s failure diagnostics.

Example: Recovery encounters a notice with handoff ID systemd-boundary but run ID another-run.

  • Before: The helper can rewrite that notice or borrow its unrelated-update-failure reason.
  • After: The notice remains unchanged and the current run retains candidate-failed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused ownership repair with packaged compatibility evidence, successful exact-head checks, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The exact-head packaged acceptance scenario exercises the captured helper against published [email protected] through the real updater CLI and Gateway, with assertions for rollback, unrelated-notice preservation, retained settings/data, and cleanup; it addresses the previous review’s requested compatibility scenario, although this environment blocks downloading the linked logs and artifact.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A failed managed update can alter another run’s notice or display another installation’s failure reason.
Reason: The maintainer-authored repair restores an existing ownership contract without adding configuration, schemas, or public APIs.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main notice ownership defect; no actionable introduced bug was found.

Priority: P2
Reviewed head: 504a6686d67677da187086ca81b8e5bb624215e7

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied packaged lane does not cover native macOS execution, real systemd custody, or the five existing skipped generated-helper PostgreSQL cases.
Agent review details

How this fits together

The detached update helper receives the updater’s result, records restart notices and terminal history, and uses the existing local lease and recovery decision to restore the Gateway.

flowchart TD
A[Managed update request] --> B[Captured detached helper]
B --> C[Real updater CLI]
C --> D[Child result and recovery decision]
D --> B
B --> E[Canonical notice owner]
E --> F[Selected state database]
B --> G[Gateway recovery and run history]
Loading

Technical review

Best possible solution:

Use the captured canonical notice owner while preserving the existing updater, lease, recovery, and terminal-settlement responsibilities.

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

Current-main source shows both ownership gaps, and the added run/root regressions directly exercise them; the supplied evidence records their failure before the fix, while this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete ownership repair: reuse the existing canonical operations, remove duplicated SQLite policy, and retain packaged proof for recovery through an older runtime.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Child failure diagnostics and terminal settlement keeps the original intent (61ef2a4: Preserve the direct child’s actionable refusal reason and diagnostics in update history.)
  • Published SQLite recovery compatibility changes intended behavior with a stated reason (d5f7874: Keep SQLite recovery working when the restored published runtime lacks the engine-aware sentinel operation.)
  • Installed recovery evidence and private diagnostics keeps the original intent (cdff9b0: Provide executable installed-package recovery scenarios while keeping raw failure evidence private.)
  • Service fixture environment handling keeps the original intent (83dce46: Model managed service definitions and their independently controlled restart behavior.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

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

PR surface

Source -116, Tests +422, Other +656. Total +962 across 24 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 116 232 -116
Tests 8 437 15 +422
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 11 696 40 +656
Total 24 1249 287 +962

Review metrics

Metric Value Why it matters
Application versus proof growth Application +116/−232 LOC; acceptance infrastructure +696/−40; tests +437/−15. Application policy shrinks; infrastructure growth supplies the packaged older-runtime recovery proof requested by the previous review.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: The defect affects notice integrity and failure diagnostics during managed-update recovery, with limited scope.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-30T09:44:17.970Z sha 11bffde :: blocked before merge. :: none
  • reviewed 2026-10-30T15:50:00.491Z sha 4dddf32 :: blocked before merge. :: none

Reviewed October 31, 2026, 1:38 AM ET / 05:38 UTC (Revision 3).

@vincentkoc
vincentkoc force-pushed the fix/update-handoff-sentinel-owner-20261030 branch from 11bffde to 4dddf32 Compare October 30, 2026 14:46
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@vincentkoc
vincentkoc merged commit f92366d into main Oct 31, 2026
192 checks passed
@vincentkoc
vincentkoc deleted the fix/update-handoff-sentinel-owner-20261030 branch October 31, 2026 05:45
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
…claw#188212)

* test(update): expose cross-run handoff notice mutation

* fix(update): use canonical handoff sentinel ownership

* fix(update): preserve handoff diagnostic failure boundaries

* test(update): exercise packaged rollback through an older runtime

* test(update): satisfy rollback harness lint rules

* test(update): bind the recovery observer event receiver

* test(update): use the service account home for rollback proof

* test(update): report packaged recovery failure coordinates

* test(update): bound the published recovery state fixture

* fix(update): reconcile captured notice owner with launchd identity

* test(update): complete the packaged handoff service fixture

* test(update): brace survivor service fixture branches

* test(update): preserve failed recovery startup diagnostics

* test(update): prioritize recovery failure causes

* test(update): isolate published recovery runtime

* test(update): observe notice preservation at canonical refusal

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker and sandbox tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: XL 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.

1 participant