Skip to content

fix(doctor): preserve legacy upgrade state and diagnostics - #186506

Merged
vincentkoc merged 10 commits into
mainfrom
fix/legacy-operator-exec-policy-fixture-20261028
Nov 2, 2026
Merged

vincentkoc merged 10 commits into
mainfrom
fix/legacy-operator-exec-policy-fixture-20261028

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Related: #177381

Problem and repair

Legacy upgrades can fail backup discovery before Doctor retires valid heartbeat configuration, emit a false unknown-lifecycle warning for imported native assignments when both optional revisions are absent, or report pending state migrations when current database contents are valid behind a deliberately deferred published header.

The repair uses the validated read-only heartbeat projection for backup discovery, preserves exact assignment identity checks, and reads canonical effective state content version with full read-only maintenance admission. Original backup bytes, writable retirement ordering, uncertain-identity refusals, strict port admission and existing snapshot ownership remain intact. No configuration surface, schema version, protocol, execution permission or publication fence changes.

Current candidate and source proof

Signed successor fccef9e696563e4b76b1b1ad2c127dd28d892e1c, tree 96b83960f21ba5d1e0024faddf187d989db00818, frozen baseline a113c483403a5e2f37a965837d600f4414333a26. The native baseline composition preserves main's batching, lazy reads and hexadecimal snapshot comparison. The original Doctor fixes remain; packaging is now baseline-identical, including the landed exclusions from #188097 and #190030.

Against this baseline: seven paths; production +44/-18 (net +26) and tests +171/-5 (net +166). The production additions protect backup-only validation, optional-revision classification and canonical state-health admission. Root and AI package manifests are 2026.10.9; earlier 10.8 wording is historical and does not describe this candidate.

  • Fresh complete source review passed all four actual owners: config projection, original-config archive integration, native-assignment classification and state diagnostics. All seven changed paths and 218 whole source/guidance contexts were covered, with zero findings. All source and process-settlement guards passed. Earlier incomplete or engine-failed attempts provide no clean credit.
  • Matched diagnostic-owner RED uses the entire current 24-case file with only the frozen baseline owner substituted: 19 passes / five intended assertion failures, zero framework or unhandled errors, complete JSON/JUnit agreement. After restoring the exact candidate owner, 24/24 pass. This is controlled owner substitution, not a packaged reproduction.
  • Focused Linux proof passes 366 unique tests on each of Node 24.22.1 and pinned Bun 191755, including full backup/config/native-assignment/diagnostic suites, current lazy snapshot admission and logical selected-owner worker reads. Repeated log footers are excluded from the count.
  • Canonical line/test-line ratchets and targeted format/lint passed without raising a ceiling. The initial proof attempt completed static phases but rejected an incorrect 25-case classifier; it restored the owner and earned no valid RED credit. The corrected 24-case continuation was independently reviewed and supplied the positive evidence above.
  • The workload, source restoration and local child/pipe settlement passed. Its original outer STOP_UNCONFIRMED result remains failed; a separate audited read-only native receipt confirmed exact resource disposal. No cleanup waiver or repeated resource mutation was used.

Final packaged compatibility proof

R2 passed in Package Acceptance 41427083767, attempt 1. The qualified workflow harness is 04114baa735c98b950ba0195857ce7029c4734b7; the candidate remains exact fccef9e696563e4b76b1b1ad2c127dd28d892e1c / 2026.10.9.

The native artifact route reused the original candidate tarball without rebuilding it: SHA-256 0bcf8a96fda525232efd8d2843560f73e6928523ff4eabfc1c4f4fbe5e7c772f. Current artifact 13132781086, archive digest aed0f54f6e25ab9ecc476b6a9204796b0c5ad0d7fdcda5ba77281b5cd4047597, supplied integrity, npm installation and both upgrade cells.

  • Integrity and installed budget: producer and separate integrity job passed. Node 24.22.1/npm 12.0.2 installed 46,872 entries / 596,462,015 file bytes (568.8 MiB), below 47,500 / 900 MiB. The complete inventory matches its footer; no source-module ledgers or dist/*.br remain. Compared with the earlier install, npm's permitted token-types 6.1.2→6.2.0 resolution accounts for one directory and 1,622 bytes; the TGZ did not change.
  • Published 9.2 upgrade: job 125222693400 passed all 56 phases. The positive deferred-schema witness retained physical/metadata 15/15, with content, expected and Doctor versions 39, zero pending migrations, documented informational exit 1, and unchanged primary database identity/bytes. The canonical assertion parsed the complete bounded Doctor JSON, required exactly one matching state finding and no issues. Candidate/installed payload identity, settings/data survival, Cron ownership, mock turn, no-op update and strict Doctor-clean passed. Rollback is not applicable to 9.2.
  • Published 10.9 same-version upgrade: job 125222693687 passed all 53 phases. Actual updater installation plus candidate/installed identity checks proved the application payload against the TGZ, despite equal version strings. Settings/data survival and strict Doctor-clean passed. Backup/rollback passed from baseline state/agent 20/25 through candidate 39/39, including verified non-dry archive, separate-target restore, retained baseline runtime, exact read-only schema/session checks and preserved inventories.
  • Settlement: each cell ran once, with status 0, no timeout and joined cleanup. All 25 jobs are terminal: 10 succeeded and 15 unselected jobs were skipped. The final package aggregate passed.

The canonical harness repairs are landed in #190798 and #190878. They preserve strict identity/Doctor assertions and explicitly author the fixture's Workshop opt-out through each supported baseline schema.

Evidence limits remain explicit: the initial 9.2 observer changed sidecars; the primary database, Doctor's SQLite-family observation and subsequent observer equality passed. Raw Doctor JSON and identity files are not separately exported; their complete validation is enforced by the successful canonical assertions. firstHopPostCore is unavailable, some redacted text logs are truncated at 16 KiB, and dependency inventory metadata is not a full dependency-byte/SRI attestation. Structured deferred-schema and rollback receipts are complete. This is the selected two-cell proof, not a full release matrix or a claim of zero total warnings.

History and remaining landing gates

Earlier fccef run 41380411856 remains failed: 9.2 reached the identity/deferred-schema phases but failed strict Doctor-clean because the old fixture left Workshop auto enabled behind a restrictive plugin policy. The fixture was repaired independently; its earlier 10.9 success is not spliced into the current aggregate. Historical dc4 package proof and the earlier 2a6112 package-budget failure remain candidate-bound history, not current credit.

Exact-fccef CI and required security/dependency status checks are successful in CI 41379977288 and enforced status publication 41382144986. Optional CodeQL is neutral and provides no full-scan claim. Fresh exact-fccef ClawSweeper review reports zero findings, nothing before merge and no remaining Rank-up moves. It correctly separates the focused optional-revision regression from the packaged upgrade scenarios. Native correction preparation passed; normal final required-check, security, overlap and squash admission remain authoritative. No CI waiver is requested.

Direct upstream contract inspection used openai/codex@414782450952a196bbb64b1605a458c2531c47b6: codex-rs/app-server-protocol/src/protocol/v2/thread_data.rs:135-183, codex-rs/app-server-protocol/src/protocol/v2/thread.rs:316-430,1254-1266, codex-rs/app-server/src/request_processors/thread_processor.rs:668-674,2153-2243, and codex-rs/core/src/tools/handlers/multi_agents/spawn.rs:120-208. Lifecycle revision remains OpenClaw-owned; the upstream wire contract is unchanged.

@vincentkoc vincentkoc self-assigned this Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Oct 28, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review October 28, 2026 03:45
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Current head: 76b49d7dab9b3ce0b975066d15a41ddeae14a419. This fixture-only correction aligns requested execution modes with the existing host-policy specimens, preserving host restrictions and the strict Doctor oracle. Runtime proof remains pending. Fresh exact-head CI is pending.

@clawsweeper

clawsweeper Bot commented Oct 28, 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: 🦐 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. 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 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR repairs legacy backup discovery, optional Codex lifecycle warnings, and deferred-schema Doctor diagnostics.

Example: An upgrade from OpenClaw 2026.9.2 leaves state headers at 15 while canonical content reaches schema 39.

  • Before: Doctor reports the older header as pending migrations and refuses otherwise valid state.
  • After: Doctor admits the canonical content and reports version 39 with zero pending migrations without changing the primary database.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused repairs with packaged upgrade evidence, preserved ownership boundaries and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The current maintainer report and successful Package Acceptance run bind the installed candidate to fccef9e and exercise published 2026.9.2 and 2026.10.9 upgrades, strict Doctor acceptance, data preservation and applicable rollback. The 9.2 witness reports headers 15/15, content/expected/diagnostic version 39, zero pending migrations and unchanged primary database bytes. Direct log/artifact downloads were blocked by the review environment; the native optional-revision classification remains supported by focused tests rather than these selected cells.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Legacy upgrades can fail backup discovery or leave Doctor reporting false assignment and schema warnings despite valid retained state.
Reason: The maintainer-authored direction restores supported upgrade behavior without adding configuration, schema, protocol or permission surfaces.

Merge readiness

✅ Ready for maintainer review

This PR merits landing: the three repairs preserve existing ownership boundaries, the reported conflict is resolved, and no introduced defect was found.

Priority: P2
Reviewed head: fccef9e696563e4b76b1b1ad2c127dd28d892e1c

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The selected packaged upgrade cells do not seed the Codex both-absent revision case; its warning classification has focused owner-test coverage.
Agent review details

How this fits together

Doctor consumes legacy configuration, persisted Codex assignments, and private database snapshots to prepare backups, repair obsolete metadata, and report storage health.

flowchart TD
  A[Legacy installation] --> B[Doctor]
  B --> C[Backup discovery projection]
  C --> D[Original byte archive]
  B --> E[Codex assignment repair]
  B --> F[State maintenance admission]
  F --> G[Database diagnostics]
Loading

Technical review

Best possible solution:

Land the focused repair using the existing backup, assignment and state-maintenance owners.

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

Current-main source exposes all three failure paths; the submitted packaged upgrade evidence exercises the deferred-header case, while focused regressions cover heartbeat backup discovery and optional revisions.

Is this the best way to solve the issue?

The patch is a small complete repair: reuse validated heartbeat projection only for discovery, compare optional revisions after existing identity checks, and delegate diagnostic admission to the canonical state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Backup discovery and writable config repair keeps the original intent (52e43a4: Automatic repair and its later Doctor-only cutover preserve recoverable configuration and keep backup discovery separate from durable retirement.)
  • Codex optional lifecycle classification keeps the original intent (275c611: Repair only proven obsolete assignments and preserve uncertain ownership; this patch retains those outcomes while avoiding a warning when both optional revisions are absent.)
  • State diagnostic schema observation changes intended behavior with a stated reason (6cf7c47: Report truthful per-store physical observations; the PR explains why health admission must use canonical content rather than the deliberately deferred publication header.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +26, Tests +166. Total +192 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 44 18 +26
Tests 4 171 5 +166
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 215 23 +192

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +44/-18; tests +171/-5 Growth is focused on backup-only projection, optional-revision classification, canonical admission and distinct preservation/refusal regressions.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Focused legacy-upgrade and diagnostic repairs with demonstrated maintainer value and limited scope.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 (5 earlier review cycles)
  • reviewed 2026-10-28T03:50:22.220Z sha 76b49d7 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-28T05:34:36.889Z sha 6ba5d96 :: blocked before merge. :: none
  • reviewed 2026-10-28T06:40:35.660Z sha 55de928 :: blocked before merge. :: none
  • reviewed 2026-10-29T19:26:15.808Z sha 2a6112c :: blocked before merge. :: none
  • reviewed 2026-11-01T22:23:04.630Z sha dc4ac0b :: blocked before merge. :: none

Reviewed November 2, 2026, 6:14 AM ET / 11:14 UTC (Revision 6).

@vincentkoc vincentkoc changed the title fix(e2e): align legacy operator execution policy fix(doctor): preserve legacy upgrade backups and native assignments Oct 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Current head: a8866dc. Please review the complete seven-path legacy-upgrade repair: backup-only heartbeat validation with original-byte preservation, native optional-lifecycle matching after the existing identity guards, and the retained execution-policy fixture setup. Full-PR autoreview and independent owner reviews are clear; successor runtime proof is pending. Prior package failures, source-review limitations, and the separate unchanged installed-tree budget are recorded in the updated body.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations extensions: codex size: S and removed size: XS labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc marked this pull request as draft October 28, 2026 04:56
@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. labels Oct 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head fccef9e696563e4b76b1b1ad2c127dd28d892e1c. The current native baseline composition preserves main's batching/lazy-read ownership; no source changes were made after its complete four-owner source review and 366 passing focused tests per runtime.

Candidate-bound R2 is now complete: https://github.com/openclaw/openclaw/actions/runs/41427083767 (attempt 1). Integrity, npm 12 installation at 46,872 entries / 596,462,015 file bytes, and both published 2026.9.2 and 2026.10.9 legacy-state upgrades passed against the same TGZ 0bcf8a96fda525232efd8d2843560f73e6928523ff4eabfc1c4f4fbe5e7c772f.

The positive 9.2 witness retained physical/metadata 15/15 with content/expected/Doctor version 39, zero pending migrations and unchanged primary database identity/bytes. The 10.9 same-version update passed exact installed application payload identity, settings/data preservation and applicable backup/rollback. Both single-attempt cells and joined cleanup passed; no omitted selected scenario or historical-result splice.

The updated body links the exact jobs/artifact, distinguishes the repaired harness from the unchanged candidate, and records observer-sidecar, raw-export, truncated-text, first-hop and dependency-inventory limitations. Required CI/security and native landing remain independent gates; no waiver is requested.

@clawsweeper

clawsweeper Bot commented Nov 2, 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: 🐚 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. and removed 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 2, 2026
@vincentkoc
vincentkoc merged commit f61cb97 into main Nov 2, 2026
165 checks passed
@vincentkoc
vincentkoc deleted the fix/legacy-operator-exec-policy-fixture-20261028 branch November 2, 2026 11:26
@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 3, 2026
…186506)

* test(e2e): align legacy operator requested exec policy

* fix(doctor): preserve legacy upgrade backups and native assignments

* fix(doctor): retain opt-in backup discovery typing

* test(doctor): compare captured file bytes directly

* fix(doctor): inspect admitted state schema content

* fix: refresh the reviewed correction baseline

Baseline-Refresh: e20ab99aad2669c5ee844498d5e939d0a1031cd8

* test(doctor): avoid shadowing state descriptor

* fix(package): restore installed entry budget (openclaw#188097)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 1864046)

* fix(packaging): exclude source-build ledgers from npm packages (openclaw#190030)

* fix(packaging): omit source-build ledgers from published packages

Keep source-module URL metadata in build trees for source AOT compilation, while excluding it from root and separately packed AI publication. Preserve runtime resources and canonical distribution inventories.

Allocate exactly 143 net regression-test lines for real npm/pnpm root and bundled-AI pack coverage, runtime exports, and inventory agreement; leave the shared baseline unchanged.

* test(packaging): type fixture package names

* test(packaging): complete declared publication fixture inputs

* test(anthropic): cover repeated stdin failure notifications (openclaw#190335)

* fix(anthropic): validate cancellation across stdin notifications

* test(process): avoid returning from close promise executor

* test(process): preserve typed stdin error identity

(cherry picked from commit 0285717)
(cherry picked from commit dcfd10f)

* fix: refresh the reviewed correction baseline

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

Labels

commands Command implementations extensions: codex 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: M 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.

2 participants