Skip to content

fix(update): complete deferred model repair when plugins are unchanged - #165148

Merged
steipete merged 2 commits into
mainfrom
codex/fix-deferred-retirement-run-context
Oct 4, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-deferred-retirement-run-context

Conversation

@steipete

@steipete steipete commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes updates silently skipping deferred model-retirement repair when plugin payloads are unchanged and the parent updater has no ambient update-run selector.

User Impact

Updates finish their own deferred Doctor work before reporting completion. Another update's pending marker no longer triggers unnecessary repair. Package updates that delegate convergence to the new candidate benefit immediately. If an older updater retains convergence and leaves a deferred receipt, run the newly installed openclaw doctor --fix once.

Why This Change Was Made

The admitted parent already carries its exact run ID and state environment, but both completion gates looked only at process environment variables. Both now pass the existing run context to the canonical query, including the standalone finalizer's run-ID hint. Doctor's published environment/result-channel contract and lifecycle authority checks remain intact. No configuration or schema changes.

The current head integrates main's removal of the redundant freshDoctorRequired argument. All three production callers supplied pluginUpdate.changed; the existing owner now reads that field directly. The selected-run repair is unchanged, and the newly added test no longer supplies the retired argument.

Evidence

  • Pre-fix tests demonstrated five missing/wrong-run dispatch failures and the distinct already-current outer-gate failure. All ten focused cases passed after the repair.
  • All 146 sibling tests passed before main integration (300.70 s). The 140 affected caller/lifecycle/fresh-Doctor tests passed again after integration (78.01 s); the six unchanged durable Doctor-receipt tests retain their earlier passing evidence.
  • The original required changed gate passed, including core and all 27 test type graphs. The integrated gate and exact-head CI are still running; merge remains pending their verification.
  • Isolated P2 reviews of the original and integrated patch found no actionable issues.
  • Both packaged update cells passed on one 16-class Blacksmith Testbox run. The native command completed with exit 0; the lease and all clients are closed.
Package cell Native update time Observed outcome
Published 2026.9.8 → candidate 186.479 s Candidate admission protocol 1; retirement completed; plugins unchanged
Fixed candidate → version-only forward fixture 182.983 s Retirement completed after the package Doctor; plugins unchanged

Both native runs finished/succeeded, replaced the Gateway, passed readiness, preserved the durable session ID/content, and discarded incognito content after restart. The same authenticated endpoint, port, and synthetic credential worked before and after. Native config-change receipts contain only meta, wizard, and the supported webhook-listener migration in the published cell, and no config changes in the fixed-caller cell. A full config-byte comparison was not captured.

Package identity and integration qualification

The package cells tested reviewed head caa717474ed2188670bb24635ca9261a89f1c6f1, tree 5116bb50115c909c6a7b789ed6523db94c5887a9. The native source capsule used carrier commit 958974952d331e25d213b60b316c7babe933496e with that exact tree.

  • Candidate package SHA-256: 1453913d4d8430dd0c2210e69c30a6e7323d4c29646001b523b4b88ae3de8db6.
  • Forward fixture SHA-256: bb4b2edba84ebc3f3c0f4f9f555213f9fe830ae38134bb2e6b6e303e0a361891. The canonical fixture changes only package.json, dist/build-info.json, and the content inventory; schemas and compiled code remain unchanged.
  • Published-cell run: 47a0c27d-f3a2-4cb1-8a91-c26d2c695061.
  • Fixed-caller run: 3cb476f0-04b8-4255-87f1-e844e7f5ed52.
  • Both recorded finalize:doctor:model-retirement as completed and plugins.changed=false; the fixture injected neither a retirement receipt nor an ambient update correlation.

The package proof is retained as evidence for that original head, not relabeled as a new run. Integration head 4bb8a00b699cf29e269106f61c64c9cc3d62e038 preserves the query repair while absorbing main's equivalent inline .changed condition and removing the obsolete test argument. The run-history helper, Doctor process launcher, and durable retirement producer are unchanged by that main adjustment; package/workspace manifests and lockfile are identical. Current affected tests and review passed, with current type/CI gates required before merge.

@clawsweeper

clawsweeper Bot commented Oct 4, 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 docs Improvements or additions to documentation cli CLI command changes size: S labels Oct 4, 2026
@steipete
steipete marked this pull request as ready for review October 4, 2026 22:10
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 6:56 PM ET / 22:56 UTC (Revision 3).

ClawSweeper review

What this changes

The updater checks its own recorded run for deferred model repairs, completes them even when plugins are unchanged, and documents recovery for older updaters.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main. The package evidence resolves the earlier upgrade-proof blocker, and no actionable introduced defect was found.

Priority: P2
Reviewed head: 4bb8a00b699cf29e269106f61c64c9cc3d62e038

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and package upgrade evidence; no substantive review blocker remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Recorded native package updates exercise the changed completion owner with unchanged plugins: both the published-driver transition and fixed-driver forward update completed the deferred retirement receipt and recovered the Gateway with session/authentication continuity. Those runs cover caa7174; the inspected integration preserves the repair through an equivalent condition simplification. No stored-data contract changes require migration proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded native package updates exercise the changed completion owner with unchanged plugins: both the published-driver transition and fixed-driver forward update completed the deferred retirement receipt and recovered the Gateway with session/authentication continuity. Those runs cover caa7174; the inspected integration preserves the repair through an equivalent condition simplification. No stored-data contract changes require migration proof.
Evidence reviewed 9 items Introduced production repair: The pinned introduced diff passes the admitted run environment and ID through both completion gates, including the standalone finalizer hint. The canonical reader still ignores terminal runs and preserves the existing published-Doctor selector fallback.
Current main still needs the fix: The fetched main’s inner Doctor gate still calls the retirement query without the admitted run context; the already-current outer gate also retains that ambient-only call.
Latest release retains the old lookup: The v2026.9.8 source resolves the update solely from ambient environment selectors and exposes no explicit run-ID query argument.
Findings None None.
Security None None.

How this fits together

OpenClaw’s updater installs the target version, synchronizes plugins, and asks Doctor to finish pending repairs before restarting the Gateway. The update-run ledger records which repairs belong to that update.

flowchart TD
  A[Installed updater] --> B[Target version and plugins]
  B --> C[Update completion]
  D[Selected update history] --> C
  C --> E{Pending repair or changed plugins?}
  E -->|Yes| F[Fresh Doctor repair]
  E -->|No| G[Readiness and Gateway restart]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +9, Tests +61, Docs +2. Total +72 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 20 11 +9
Tests 2 74 13 +61
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 97 25 +72

Review metrics

None.

Technical review

Best possible solution:

Finish the selected update’s pending repairs through the existing Doctor owner while preserving shipped recovery paths and lifecycle fences.

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

Yes, from source: a running admitted update with deferred retirement, unchanged plugins, and no ambient selector is missed by current main’s completion queries. This review did not execute that failing path.

Is this the best way to solve the issue?

Yes. Passing the existing run context into the canonical query fixes both gates without adding another repair owner or changing Doctor’s authority contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Recorded native package updates exercise the changed completion owner with unchanged plugins: both the published-driver transition and fixed-driver forward update completed the deferred retirement receipt and recovered the Gateway with session/authentication continuity. Those runs cover caa7174; the inspected integration preserves the repair through an equivalent condition simplification. No stored-data contract changes require migration proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This repairs a bounded update-completion defect that can leave deferred model maintenance unfinished.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded native package updates exercise the changed completion owner with unchanged plugins: both the published-driver transition and fixed-driver forward update completed the deferred retirement receipt and recovered the Gateway with session/authentication continuity. Those runs cover caa7174; the inspected integration preserves the repair through an equivalent condition simplification. No stored-data contract changes require migration proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded native package updates exercise the changed completion owner with unchanged plugins: both the published-driver transition and fixed-driver forward update completed the deferred retirement receipt and recovered the Gateway with session/authentication continuity. Those runs cover caa7174; the inspected integration preserves the repair through an equivalent condition simplification. No stored-data contract changes require migration proof.

Evidence

What I checked:

  • Introduced production repair: The pinned introduced diff passes the admitted run environment and ID through both completion gates, including the standalone finalizer hint. The canonical reader still ignores terminal runs and preserves the existing published-Doctor selector fallback. (src/infra/update-deferred-model-retirement.ts:7, 4bb8a00b699c)
  • Current main still needs the fix: The fetched main’s inner Doctor gate still calls the retirement query without the admitted run context; the already-current outer gate also retains that ambient-only call. (src/cli/update-cli/update-command-fresh-doctor.ts:541, 989bd3f055fa)
  • Latest release retains the old lookup: The v2026.9.8 source resolves the update solely from ambient environment selectors and exposes no explicit run-ID query argument. (src/infra/update-deferred-model-retirement.ts:7, fc23bc864e45)
  • Selected-run regression coverage: The added cases exercise missing and foreign ambient selectors, a clear selected run, a terminal selected run, and standalone completion through the production completion owner. Separate convergence cases protect the already-current outer gate; transport mocks remain supplemental evidence. (src/cli/update-cli/update-command-doctor-authority-callers.test.ts:551, 4bb8a00b699c)
  • Published-driver and forward-update evidence: The captured PR body records native published 2026.9.8 → candidate and fixed candidate → version-only fixture runs lasting 186.479 s and 182.983 s. Both completed model retirement with plugins.changed=false, succeeded through Gateway replacement/readiness, preserved durable session content and authentication, and discarded incognito content. Configuration receipts list only expected published-cell changes and no fixed-caller changes; a full byte comparison was not captured. The tested source identity is caa7174, tree 5116bb50115c909c6a7b789ed6523db94c5887a9. The linked Testbox workflow https://github.com/openclaw/openclaw/actions/runs/37238835701 ended cancelled after lease cleanup, so it is not counted as a passing CI run. (caa717474ed2)
  • Proof continuity across integration: The pinned GitHub comparison shows the affected production integration removes the redundant freshDoctorRequired argument and replaces its read with pluginUpdate.changed. The explicit run-selection repair remains unchanged, allowing the original-head package evidence to remain relevant without relabeling it as an execution of the integrated head. (src/cli/update-cli/update-command-fresh-doctor.ts:540, 4bb8a00b699c)

Likely related people:

  • Peter Steinberger: Raw commit 8b5fa24 adds src/infra/update-deferred-model-retirement.ts:5 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8b5fa242a2fa; files: src/infra/update-deferred-model-retirement.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-10-04T22:10:04.969Z sha caa7174 :: blocked before merge. :: none
  • reviewed 2026-10-04T22:15:59.145Z sha caa7174 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Oct 4, 2026
@steipete
steipete merged commit 81fd864 into main Oct 4, 2026
140 checks passed
@steipete
steipete deleted the codex/fix-deferred-retirement-run-context branch October 4, 2026 23:06
@steipete

steipete commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

1 participant