Skip to content

perf: finish deferred model retirement with a shorter second Doctor pass - #186231

Merged
steipete merged 11 commits into
mainfrom
dbasync/doctorfast
Oct 30, 2026
Merged

steipete merged 11 commits into
mainfrom
dbasync/doctorfast

Conversation

@steipete

@steipete steipete commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A native openclaw update can repeat all 70 Doctor contributions even when unchanged plugins have converged and deferred model retirement is its only remaining obligation.

User Impact

That second Doctor now finishes through six existing contributions, while keeping complete startup, custody, schema admission and config preparation. The measured second pass used 8,478 fewer SQL statements cold and 8,885 fewer warm, with worker requests falling from 231 to 137 and 234 to 137.

Rollout: the benefit starts once the installed updater includes this change—one update after release. Older installed updaters continue requesting the full Doctor. Standalone Doctor repair remains full.

Why This Change Was Made

The installed updater negotiates the candidate Doctor's existing private child capability and sends an optional stdin selection hint. The config owner independently proves eligibility from its prepared migration plan, applied changes and retirement receipt; the hint grants no authority. The retained contributions run in existing order: initial config persistence, auth/catalog migration, complete session-transcript repair (including post-session plugin detectors/handlers), session-route repair, final config/cron work, and strict final validation.

Warnings, findings, deferrals, unrelated work, plugin changes, incomplete discovery, constrained selections or an unbound migration plan select the full list. A late discovery uses that existing full list in the same admitted context; retained inspections may repeat on this exceptional path. Durable-write receipts avoid duplicate writes, and a later config commit invalidates prior post-write completion. Current refusals stay terminal. Durable config still precedes retirement-ledger completion and cron effects; final validation and real readiness remain mandatory.

No public flag, new cache, generation, manager, schema or SQL syntax is added. Production growth is +219 LOC (+299/−80), carrying owner facts through the existing transport and selection flow. The full implementations remain necessary for standalone Doctor and fallback.

Evidence

Frozen synthetic native-update workload: scripts/perf/doctor-retirement-measure.mts, Node 26.12.1 on macOS arm64, private-QA profile, identical 179-plugin inventories, symlinked .artifacts, isolated real Gateway and qa-channel. Matched baseline installed X → target Y versus candidate X+patch → Y+patch, with one identical complete patch on both candidate versions. All four native updates reached the exact target and passed both Doctors, authoritative retirement skipped → completed, lint and real QA readiness. Both candidate second Doctors received the hint and ran exactly six contributions.

Second Doctor Cold baseline Cold candidate Warm baseline Warm candidate
Contributions 70 6 70 6
SQL statements 38,327 29,849 38,744 29,859
Worker requests 231 137 234 137
Process-main SQL 37,643 29,541 38,038 29,551
Worker-thread SQL 684 308 706 308
Second-Doctor process CPU (s) 41.889 23.690 42.389 32.778

SQL savings are 22.1% cold and 22.9% warm. Request operations: task 210 → 121 cold / 213 → 121 warm; execute 17 → 12 in both; open/close unchanged at 2/2. Whole-update SQL fell 110,751 → 102,344 cold and 98,162 → 86,334 warm.

Acceptance was recorded before capture: frozen v3.1.5 observation, one baseline cold+warm arm then one candidate cold+warm arm, at least 1,000 fewer second-pass SQL statements or a clear CPU reduction, with adverse metrics stopping for review. The approved loaded-host disposition is one count/CPU pair, not a wall-time benchmark. Cold/warm are separate n=1 cells: no latency, median or p95 claim. Process CPU includes that Doctor's threads, not the complete subprocess tree; missing exit counters prevent a total-tree CPU claim. Warm main-thread CPU rose 18.896 → 19.486 s (+3.12%). Complete per-contribution SQL/request attribution and shared/unknown buckets were retained for every Doctor pass before raw capture cleanup.

Accepted one-time startup MAIN difference

Warm final Gateway root SQL rose 75 → 76, with aggregate PRAGMA busy_timeout = ? 12 → 13. This is a one-time post-update startup effect of the state left by the narrower Doctor; the exact differing root call is unresolved at n=1. Total warm Gateway SQL fell 589 → 578, requests 151 → 148; cold final Gateway root SQL fell 89 → 82; canaries were unchanged. No ≥20% adverse count cell occurred.

The maintainer explicitly accepted this startup-only difference after a changed-hunk audit: shared plugin-model-catalog-repair.ts additions only track/return an in-memory boolean from already-parsed data; they add no SQL, file/database I/O, connection, lease, worker request or awaited store work. refreshStartupPluginQuarantine and all following helpers are byte-identical (SHA-256 017df0b30d2d50e086e5fd7ed49ecbe57c1be643ba86889b8532311691d260ba); the changed convergence return belongs to Doctor. update-doctor-result.ts changes only an erased type. Thus changed Gateway-executed code cannot issue the extra connection-open PRAGMA. This waiver does not permit a steady-state or per-turn MAIN increase.

Correctness and checks

Owner/config-flow tests passed 108 + 34 cases; cancellation 13, convergence 9, prompt-prefix stability 13. They cover plugin changes, pending migrations, incomplete discovery, constrained selections, credentials, refusal, restart/resume authority, durable-write/cron ordering, session warnings/deferment and late fallback. T1/dialect ratchets, Madge, line limits and formatting passed. Local check:changed preparation hit the external declaration-custody boundary before type analysis; no local type pass is claimed.

Earlier CI exposed two script/test typing errors and test-line growth; those were corrected without changing production or the measured behavior. Prior-head CI 40594216587 passed, including all three PostgreSQL shards. One initial readiness deadline reproduced on the original baseline and candidate; the deadline and assertion were retained. All final-head checks are recorded below.

Two isolated production-head Codex reviews completed at P0–P2 with no actionable findings after disposition. Script/test corrections received isolated delta reviews. Production remains +219 LOC. Assertion-preserving test consolidations retain distinct fixtures and authority, security, ordering and rejection assertions; the latest cleanup retains all 25 process-respawn scenarios. The complete PR's current test delta is −56 against integrated main 6ac91adabcc2; the ceiling and check are unchanged.

The 2026-10-30 restart preserves both sides of the documentation and two test conflicts. The added/removed production lines are identical to reviewed head d3aecc3e (normalized SHA-256 70b2a5ebffc85a7dbf2c0ce2ebb23e41675732e99ed1bcd2aa6ff1965efaef9b). The prior claim that the prospective merge was clean was corrected: the raw merge output had three docs/test conflict paths. Their resolutions and the extra test-only consolidation passed one isolated Codex delta review (P0–P2; no actionable findings; final source verification passed). Focused tests passed: Doctor contributions 93/93, plugin registry 32/32 and process respawn 25/25. Integration head 97ddb06a2e67b6e1182117d2ff7cb6223afc56d4 retains that exact reviewed tree. Exact-head CI is recorded below.

The previously failing doctor-capture-repeat.test.ts was compared alone on the same host under the proof semaphore, using the default pinned Bun runtime: exact main 0a6415bed1d hit the unchanged 120-second timeout at 120.213 s, and prior head d3aecc3e at 120.377 s (+0.164 s, +0.14%). Head ran first, then baseline after source-snapshot dependency preparation; setup failures before the test ran are excluded. Both hit the same timeout, so the maintainer accepted this as an unrelated slow test. These timeout-censored, loaded-host runs make no general latency claim. No timeout or assertion was relaxed. On the new exact head, a recurrence gets one failed-only rerun before the authorized pre-existing-CI route; all other failures still require attribution.

The cold baseline's fixed installed updater passed the database-backup step with symlinked .artifacts (snapshot exit 0; activation exit 0). All four successful native updates reaffirm #185680, #185789 and #185977, including retained warm agent state.

Reproduction pins, PostgreSQL checklist and overlap

Baseline driver X 22f1ebdbc2bac08e3dc5164a4f7fbdf82f6ad594; baseline target Y 455a9d678baadc72410a3a532400ea3a63e1bc7b. Candidate driver d816fbbe83968ec2f365044dd3162f22865aa16f; candidate target ec6cdc38d526c5d2de4876a1fc56782bbb6fdce8. Identical patch ID a3d704f8740c5fae8efaa05343e574184ddfbc0e. Measured workload SHA-256 ea75f2c1294cde77051c0e1b5e6eac66d8c44ab44d677b1772e1b1bd19ae2ed1; the script-only typed-local correction produces afdf0178636bf8cd4404d5a62d4a00fc7a3fbe2a0a36e03ce5500adb4eb70bad, with unchanged workload behavior; capture probe 5536f9fbb72e35519147d75e5109b51c38c7261610eca0fdd4a8b09def23e41c. All 37 frozen observer files verified; approved capture instrumentation preserves native gates and fixtures.

PostgreSQL reach is yes, through Doctor's existing dialect-neutral config/session/cron owners. No SQL text changes:

  1. Existing statement shapes, transaction/advisory-lock envelopes and cross-store commit ordering are unchanged when retained owners run. Full-only contributions are omitted only after eligibility; durable config remains before ledger/cron.
  2. No expanded query, buffered result, iterator or payload bounds; no work moved to a different query/thread.
  3. Eligibility carries existing owner facts; no cache, revision, generation, freshness probe or external-writer assumption added. Hint is not authority; late discovery falls back under existing custody.
  4. No schema, PRAGMA, identity, permission, admission or recovery change. Full startup/custody/schema/config flow and the bound-plan guard remain.
  5. All statement/request counts above include process-main and workers. The only Gateway MAIN increase is the explicitly accepted startup cell, with no I/O added to Gateway-executable hunks.
  6. PostgreSQL semantic review is approved for ec6cdc38d526c5d2de4876a1fc56782bbb6fdce8 and explicitly carried across the subsequent script/test-only corrections; the Doctorfast production delta is unchanged. Integration also contains main's independent released-upgrade cron fix fix(update): preserve cron selection through released upgrades #185723. All three PG conformance shards executed and passed in CI run 40589353443 (jobs 122490122890, 122490122998 and 122490122970); the final integrated head also passed all three executed PostgreSQL shards in CI run 41059400971 (jobs 124075676522, 124075676364 and 124075676557). SQLite native proof passed; no PostgreSQL timing claim.

Open-PR paired merge-tree comparison is refreshed against the 88 current overlapping peers from the shared index, comparing base-only and base+candidate against each exact PR head. No per-PR GitHub census is used. Previously accepted exact exceptions remain #158723 (one added preflight hunk on an already-conflicting path) and #143781 (credential-result capture, unchanged call arguments/security behavior); Final gate passed all 88 peers against main 6ac91adabcc2 and resolved tree 4b719ee5b22b, with zero unapproved new conflicts; both exception hunks were checked against their accepted versions.

Current integrated head

5a8142b4ff1549b1f379b4fd09d14edfffb6fe5d includes the reviewed main integration plus one test-only mock correction. Normal hooks and the test-line ratchet pass (own delta −56). The 150 conflict-resolution tests and 30 repair-sequencing tests passed. Both the conflict-resolution review and the correction's isolated review completed without actionable findings, including final source verification. The production delta is unchanged from the approved head. Exact-head CI 41059400971 passed, including all three PostgreSQL conformance shards (jobs 124075676522, 124075676364 and 124075676557); each ran its conformance step successfully. The aggregate CI gate passed. No failed-only rerun or admin exception was needed. Local targeted lint was blocked before analysis by the required external dependency-store declaration-custody preflight; CI supplies those static gates.

The first integrated-head CI run 41056424132 exposed one test-only merge interaction: this PR's deferred-retirement mock omitted the warning constant added by main PR #187208. The mock now preserves actual module exports while overriding the two ledger operations. No assertion or production behavior changed; the focused repair-sequencing suite passed 30/30. The correction received an isolated delta review. No competing PR touches the corrected test file; the 88-peer overlap comparison and its two accepted exceptions remain valid.

@clawsweeper

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T12:38:06.409144Z 97ddb06 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling size: XL labels Oct 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec6cdc38d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +705 to +707
await runDoctorHealthContributionList(
ctx,
contributions.filter((entry) => retained.has(entry.id)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve deferred inspection selectors in the shortened pass

During an update using post-activation inspection reporting, a successful retirement-only second pass publishes deferredInspectionCheckIds: []: runDoctorHealthContributionList initializes that receipt, but the filtered contributions contain none of the deferred inspections. runPostActivationInspections in src/cli/update-cli/update-command-post-activation-inspections.ts consumes the last Doctor's receipt and returns immediately for an empty list, so inspections deferred by the first Doctor are silently dropped. The intervening readiness lint does not recover them because it runs with severity error rather than the optional inspection profile. Preserve or republish the outstanding selectors when shortening the second pass so those diagnostics still run after restart.

AGENTS.md reference: AGENTS.md:L78-L78

Useful? React with 👍 / 👎.

@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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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-repro Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR lets eligible native updates finish deferred model retirement through six Doctor contributions instead of repeating the full flow.

Example: A native update has unchanged plugins and only deferred model retirement remaining.

  • Before: The second Doctor runs 70 contributions; the recorded cold workload executes 38,327 SQL statements.
  • After: The second Doctor runs six contributions; the recorded cold workload executes 29,849 SQL statements.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Recorded native measurements support the optimization, but the confirmed loss of deferred diagnostics blocks this patch.
Proof confidence 🐚 platinum hermit (4/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body records matched native cold/warm updates, retirement completion, reduced second-pass work, and real Gateway/QA readiness.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Native updates repeat the full Doctor contribution flow after unchanged plugins have converged.
Reason: The maintainer-authored direction removes measured redundant work without adding a public option, persistent cache, or competing repair owner.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep open: this PR provides a measured update improvement, but its shortened Doctor pass silently drops deferred post-activation inspections.

Priority: P2
Reviewed head: ec6cdc38d526c5d2de4876a1fc56782bbb6fdce8

Before merge

  • Preserve deferred inspection selectors when shortening Doctor (P2) - During a native update using post-activation inspection reporting, this filtered list contains no deferred inspections. runDoctorHealthContributionList nevertheless initializes deferredInspectionCheckIds to [], and successful retirement-only completion returns without rebuilding it. The updater consumes the latest Doctor's receipt, so runPostActivationInspections returns immediately and silently drops checks deferred by the first Doctor. Readiness lint uses severity error and does not recover the optional inspection profile. Derive the final selectors from the complete candidate contribution graph independently of the execution filter, and add a regression through receipt consumption. This confirms the earlier finding at perf: finish deferred model retirement with a shorter second Doctor pass #186231 (comment).
  • Explain or restore the original intent of Deferred post-activation inspection receipts - 6021928: The latest target Doctor must report its actual deferred selectors so the updater can execute them after readiness without importing replaced parent code.

Findings

  • [P2] Preserve deferred inspection selectors when shortening Doctor — src/flows/doctor-health-contributions.ts:705-707

Provenance

  • Deferred post-activation inspection receipts changes intended behavior without addressing why it exists (6021928: The latest target Doctor must report its actual deferred selectors so the updater can execute them after readiness without importing replaced parent code.)

Tests

  • Missing end-to-end proof: The supplied native scenario does not verify that deferred inspection selectors survive the shortened second Doctor and execute after Gateway readiness.
Agent review details

How this fits together

The installed updater negotiates candidate Doctor capabilities and sends a work-selection hint; Doctor independently checks eligibility, performs guarded repairs, and returns completion and deferred-inspection receipts to update finalization.

flowchart TD
  A[Installed updater] --> B[Candidate capability negotiation]
  B --> C[Doctor startup and config preparation]
  C --> D[Eligibility decision]
  D --> E[Six retained contributions]
  D --> F[Full Doctor flow]
  E --> G[Completion and inspection receipts]
  F --> G
  G --> H[Readiness and post-restart inspections]
Loading

Technical review

Best possible solution:

Keep the six-contribution optimization while deriving and publishing deferred inspection selectors from the candidate's complete contribution graph.

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

The selector-loss path is deterministic in source: report mode initializes an empty receipt, the filtered list adds no inspection selectors, and the final consumer skips execution; no target code was run during this read-only review.

Is this the best way to solve the issue?

Selecting less work through existing Doctor owners is appropriate, but execution filtering must preserve the complete target-owned inspection obligation.

Full review comments:

  • [P2] Preserve deferred inspection selectors when shortening Doctor — src/flows/doctor-health-contributions.ts:705-707
    During a native update using post-activation inspection reporting, this filtered list contains no deferred inspections. runDoctorHealthContributionList nevertheless initializes deferredInspectionCheckIds to [], and successful retirement-only completion returns without rebuilding it. The updater consumes the latest Doctor's receipt, so runPostActivationInspections returns immediately and silently drops checks deferred by the first Doctor. Readiness lint uses severity error and does not recover the optional inspection profile. Derive the final selectors from the complete candidate contribution graph independently of the execution filter, and add a regression through receipt consumption. This confirms the earlier finding at perf: finish deferred model retirement with a shorter second Doctor pass #186231 (comment).
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Delegated Doctor capability negotiation and authority keeps the original intent (1232d3f: Candidate-runtime finalization must retain live executor/requester authority and supported older-target behavior.)
  • Deferred model retirement and durable repair ordering keeps the original intent (8b5fa24: Retired routes must preserve billing and account selection, with deferred retirement completed by candidate Doctor.)
  • Generated catalog repair keeps the original intent (eb8a6a8: Repair persisted generated catalog metadata without changing unrelated authored content; the patch adds inspection-completeness facts around that owner.)
  • Config advisories and prepared plugin metadata keeps the original intent (80da616: Doctor reuses authoritative prepared plugin metadata rather than repeatedly rediscovering it; the advisory regrouping retains that scope and existing warning calls.)
  • Findings, refusals, and recoverable diagnostics keeps the original intent (5e6d56a: Doctor must distinguish unresolved failures from historical notices and verified repairs; late findings return the shortened pass to the existing full flow.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/flows/doctor-health-contributions.test.ts src/flows/doctor-health-contributions.cancellation.test.ts
  • pnpm test src/cli/update-cli/update-command-post-activation-inspections.test.ts src/cli/update-cli/update-command-doctor-capability.test.ts
  • Verify the new selector-preservation regression fails on the reviewed head and passes with the repair.
  • Complete required checks on the resulting head, including all three PostgreSQL conformance shards.

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5282242 adds src/cli/update-cli/update-command-fresh-doctor.ts:598 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 52822426d6ab; files: src/cli/update-cli/update-command-fresh-doctor.ts)
  • Ayaan Zaidi: Raw commit aa42103 adds src/flows/doctor-health-contributions.ts:516 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: aa42103a719b; files: src/flows/doctor-health-contributions.ts)
  • Dallin Romney: Raw commit 5e6d56a adds src/flows/doctor-health-contributions.ts:651 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 5e6d56ae46f4; files: src/flows/doctor-health-contributions.ts)

PR surface

Source +219, Tests +581, Docs +7, Other +751. Total +1558 across 46 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 24 299 80 +219
Tests 19 804 223 +581
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 2 752 1 +751
Total 46 1862 304 +1558

Review metrics

Metric Value Why it matters
Production versus test growth Production +299/−80 LOC; tests/support +804/−223 LOC Growth carries eligibility facts through existing owners and adds distinct transport, fallback, refusal, ordering, and malformed-discovery coverage.

Labels

Label changes:

  • add P2: The optimization has measurable value, while the introduced defect suppresses optional diagnostics without preventing required update readiness.
  • add merge-risk: 🚨 compatibility: Eligible native upgrades would stop honoring the existing post-activation inspection receipt contract.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The optimization has measurable value, while the introduced defect suppresses optional diagnostics without preventing required update readiness.
  • merge-risk: 🚨 compatibility: Eligible native upgrades would stop honoring the existing post-activation inspection receipt contract.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🐚 platinum hermit and patch quality is 🦪 silver shellfish.
  • 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 27, 2026, 3:31 PM ET / 19:31 UTC.

@steipete steipete changed the title improve: finish deferred model retirement with a shorter second Doctor pass perf: finish deferred model retirement with a shorter second Doctor pass Oct 30, 2026
@steipete
steipete merged commit f61e550 into main Oct 30, 2026
155 of 157 checks passed
@steipete
steipete deleted the dbasync/doctorfast branch October 30, 2026 13:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…ass (openclaw#186231)

Use the existing private Doctor child capability to request the six required contributions when deferred model retirement is the only post-plugin obligation. Keep complete admission and config preparation; warnings, findings and deferrals retain the full fallback.

The benefit starts once the installed updater includes the change, one update after release. Matched synthetic native updates saved 8,478 cold and 8,885 warm second-pass SQL statements, with requests falling to 137 in both phases.

Preserve both sides of main integration and consolidate repeated test setup without losing scenarios. Production delta remains identical to the approved and measured change.
obviyus added a commit that referenced this pull request Nov 23, 2026
Related: #203946

## What Problem This Solves

An update from a published release says it will run optional Doctor inspections after restart, but a later, shorter Doctor pass replaces their pending check list with an empty list. The updater then skips the inspections.

## User Impact

The first update from v2026.11.7 or v2026.11.10-beta.1 can run the deferred inspections after Gateway readiness and retain their results in update history. Advisory findings do not turn a successful activation into a failed update.

Release-path updates remain outside this implementation. They still need post-commit advisory inspection; the separate design records that gap.

## Why This Change Was Made

Retain eligible inspection contributions in the existing retirement-only pass. The existing selector owner records their IDs without executing the checks in the stopped window. No new flags, receipt fields, or inspection runner are added.

After proving those inspections run, remove the synthetic “inspection deferred until activation” warning producer. Actual health findings, required validation errors, and incomplete-inspection warnings remain.

Simply omitting the empty receipt would not preserve the earlier list: the fresh-Doctor caller deliberately publishes missing selectors as `null`, and shipped updaters use the latest target Doctor's receipt. The narrow repair optimization therefore stays, but cannot cancel the deferred inspection obligation.

The deferral predicate moves unchanged into its existing utility module to keep the contribution module within its line cap. The regression lives in a small sibling suite for the same reason.

The empty-list initialization came from `60219285580` (#169940), which correctly made the target Doctor own inspection selectors. `f61e550d22c` (#186231) later filtered the retirement-only pass to six repairs. That pass then emitted an empty selector receipt without evaluating the inspection contributions. This preserves both owners instead of removing the narrow repair optimization.

## Evidence

- The regression fails on the pinned main baseline because it receives `[]` instead of the inspection selector; it passes with the fix.
- Nine focused suites pass (244 tests), including Doctor scope/cancellation, fresh-process handoff, post-activation inspections, and update lint warnings.
- Final consumer proof passes: 16 files / 110 tests, including the changed lint contract and selector regression. The regression took 5.52 seconds of test time (14.37 seconds for the file including import/setup); it took 1.23 seconds in the earlier focused run. CI timing is not available yet.
- A Linux systemd user service installed by `gateway install` was updated by a published v2026.11.7 Control UI click through the real HTTPS channel lookup to a source-built .11.8 fixture. Selector-only run `50b6b3b3-9fda-4a22-917d-cd13c8aabf4b` succeeded in 154.32 seconds, migrated schema 36 → 41, and recorded completed post-activation inspections **before** removing the notices.

The inspection receipt was `{"exitCode":1,"termination":"exit","signal":null,"killed":false,"counts":{"error":0,"warning":0,"info":11},"errors":[],"omitted":0}`. This is a completed lint command, not an interrupted check: [lint exit codes](https://docs.openclaw.ai/cli/doctor/lint) define `1` as findings at the selected threshold (`info` here), and `2` as command/runtime failure. The shipped inspection owner also checks that every requested selector ran before recording completion. The UI showed this inspection as **Complete**, seven completed phases, and a successful update.

- Full declaration build and canonical packed-tarball integrity/import checks pass. The .11.8 proof fixture differs from the PR source only in `package.json.version`; its CLI and Control UI were built with that version, not restamped afterward.
- Changed-file format/lint, test type checks, SQLite worker/dialect ratchets, and import-cycle checks pass. `check:changed` exits nonzero because its global Knip scan lists unused exports in untouched files; none are the changed Doctor symbols.
- Final-head UI click `70422447-6b70-4650-a022-940c1a6214d7` succeeds in 143.31 seconds. The final row contains **post-activation doctor inspections: completed**, its lint receipt, and no failed steps. Planned scope-warning count is **0**. The UI shows **“✅ OpenClaw updated to 2026.11.8 (from 2026.11.7); 11 warnings need attention.”** The remaining entries are actual configuration/maintenance/service diagnostics and the shipped owner's completed-inspection summary, not promises to run checks later. The inspection exit is still the documented findings-present `1`, shown as Complete rather than Failed.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 24, 2026
…aw#203959)

Related: openclaw#203946

## What Problem This Solves

An update from a published release says it will run optional Doctor inspections after restart, but a later, shorter Doctor pass replaces their pending check list with an empty list. The updater then skips the inspections.

## User Impact

The first update from v2026.11.7 or v2026.11.10-beta.1 can run the deferred inspections after Gateway readiness and retain their results in update history. Advisory findings do not turn a successful activation into a failed update.

Release-path updates remain outside this implementation. They still need post-commit advisory inspection; the separate design records that gap.

## Why This Change Was Made

Retain eligible inspection contributions in the existing retirement-only pass. The existing selector owner records their IDs without executing the checks in the stopped window. No new flags, receipt fields, or inspection runner are added.

After proving those inspections run, remove the synthetic “inspection deferred until activation” warning producer. Actual health findings, required validation errors, and incomplete-inspection warnings remain.

Simply omitting the empty receipt would not preserve the earlier list: the fresh-Doctor caller deliberately publishes missing selectors as `null`, and shipped updaters use the latest target Doctor's receipt. The narrow repair optimization therefore stays, but cannot cancel the deferred inspection obligation.

The deferral predicate moves unchanged into its existing utility module to keep the contribution module within its line cap. The regression lives in a small sibling suite for the same reason.

The empty-list initialization came from `5745d6daafe` (openclaw#169940), which correctly made the target Doctor own inspection selectors. `4939089d42d` (openclaw#186231) later filtered the retirement-only pass to six repairs. That pass then emitted an empty selector receipt without evaluating the inspection contributions. This preserves both owners instead of removing the narrow repair optimization.

## Evidence

- The regression fails on the pinned main baseline because it receives `[]` instead of the inspection selector; it passes with the fix.
- Nine focused suites pass (244 tests), including Doctor scope/cancellation, fresh-process handoff, post-activation inspections, and update lint warnings.
- Final consumer proof passes: 16 files / 110 tests, including the changed lint contract and selector regression. The regression took 5.52 seconds of test time (14.37 seconds for the file including import/setup); it took 1.23 seconds in the earlier focused run. CI timing is not available yet.
- A Linux systemd user service installed by `gateway install` was updated by a published v2026.11.7 Control UI click through the real HTTPS channel lookup to a source-built .11.8 fixture. Selector-only run `50b6b3b3-9fda-4a22-917d-cd13c8aabf4b` succeeded in 154.32 seconds, migrated schema 36 → 41, and recorded completed post-activation inspections **before** removing the notices.

The inspection receipt was `{"exitCode":1,"termination":"exit","signal":null,"killed":false,"counts":{"error":0,"warning":0,"info":11},"errors":[],"omitted":0}`. This is a completed lint command, not an interrupted check: [lint exit codes](https://docs.openclaw.ai/cli/doctor/lint) define `1` as findings at the selected threshold (`info` here), and `2` as command/runtime failure. The shipped inspection owner also checks that every requested selector ran before recording completion. The UI showed this inspection as **Complete**, seven completed phases, and a successful update.

- Full declaration build and canonical packed-tarball integrity/import checks pass. The .11.8 proof fixture differs from the PR source only in `package.json.version`; its CLI and Control UI were built with that version, not restamped afterward.
- Changed-file format/lint, test type checks, SQLite worker/dialect ratchets, and import-cycle checks pass. `check:changed` exits nonzero because its global Knip scan lists unused exports in untouched files; none are the changed Doctor symbols.
- Final-head UI click `70422447-6b70-4650-a022-940c1a6214d7` succeeds in 143.31 seconds. The final row contains **post-activation doctor inspections: completed**, its lint receipt, and no failed steps. Planned scope-warning count is **0**. The UI shows **“✅ OpenClaw updated to 2026.11.8 (from 2026.11.7); 11 warnings need attention.”** The remaining entries are actual configuration/maintenance/service diagnostics and the shipped owner's completed-inspection summary, not promises to run checks later. The inspection exit is still the documented findings-present `1`, shown as Complete rather than Failed.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
Related: #203946

## What Problem This Solves

An update from a published release says it will run optional Doctor inspections after restart, but a later, shorter Doctor pass replaces their pending check list with an empty list. The updater then skips the inspections.

## User Impact

The first update from v2026.11.7 or v2026.11.10-beta.1 can run the deferred inspections after Gateway readiness and retain their results in update history. Advisory findings do not turn a successful activation into a failed update.

Release-path updates remain outside this implementation. They still need post-commit advisory inspection; the separate design records that gap.

## Why This Change Was Made

Retain eligible inspection contributions in the existing retirement-only pass. The existing selector owner records their IDs without executing the checks in the stopped window. No new flags, receipt fields, or inspection runner are added.

After proving those inspections run, remove the synthetic “inspection deferred until activation” warning producer. Actual health findings, required validation errors, and incomplete-inspection warnings remain.

Simply omitting the empty receipt would not preserve the earlier list: the fresh-Doctor caller deliberately publishes missing selectors as `null`, and shipped updaters use the latest target Doctor's receipt. The narrow repair optimization therefore stays, but cannot cancel the deferred inspection obligation.

The deferral predicate moves unchanged into its existing utility module to keep the contribution module within its line cap. The regression lives in a small sibling suite for the same reason.

The empty-list initialization came from `60219285580` (#169940), which correctly made the target Doctor own inspection selectors. `f61e550d22c` (#186231) later filtered the retirement-only pass to six repairs. That pass then emitted an empty selector receipt without evaluating the inspection contributions. This preserves both owners instead of removing the narrow repair optimization.

## Evidence

- The regression fails on the pinned main baseline because it receives `[]` instead of the inspection selector; it passes with the fix.
- Nine focused suites pass (244 tests), including Doctor scope/cancellation, fresh-process handoff, post-activation inspections, and update lint warnings.
- Final consumer proof passes: 16 files / 110 tests, including the changed lint contract and selector regression. The regression took 5.52 seconds of test time (14.37 seconds for the file including import/setup); it took 1.23 seconds in the earlier focused run. CI timing is not available yet.
- A Linux systemd user service installed by `gateway install` was updated by a published v2026.11.7 Control UI click through the real HTTPS channel lookup to a source-built .11.8 fixture. Selector-only run `50b6b3b3-9fda-4a22-917d-cd13c8aabf4b` succeeded in 154.32 seconds, migrated schema 36 → 41, and recorded completed post-activation inspections **before** removing the notices.

The inspection receipt was `{"exitCode":1,"termination":"exit","signal":null,"killed":false,"counts":{"error":0,"warning":0,"info":11},"errors":[],"omitted":0}`. This is a completed lint command, not an interrupted check: [lint exit codes](https://docs.openclaw.ai/cli/doctor/lint) define `1` as findings at the selected threshold (`info` here), and `2` as command/runtime failure. The shipped inspection owner also checks that every requested selector ran before recording completion. The UI showed this inspection as **Complete**, seven completed phases, and a successful update.

- Full declaration build and canonical packed-tarball integrity/import checks pass. The .11.8 proof fixture differs from the PR source only in `package.json.version`; its CLI and Control UI were built with that version, not restamped afterward.
- Changed-file format/lint, test type checks, SQLite worker/dialect ratchets, and import-cycle checks pass. `check:changed` exits nonzero because its global Knip scan lists unused exports in untouched files; none are the changed Doctor symbols.
- Final-head UI click `70422447-6b70-4650-a022-940c1a6214d7` succeeds in 143.31 seconds. The final row contains **post-activation doctor inspections: completed**, its lint receipt, and no failed steps. Planned scope-warning count is **0**. The UI shows **“✅ OpenClaw updated to 2026.11.8 (from 2026.11.7); 11 warnings need attention.”** The remaining entries are actual configuration/maintenance/service diagnostics and the shipped owner's completed-inspection summary, not promises to run checks later. The inspection exit is still the documented findings-present `1`, shown as Complete rather than Failed.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit 8ac1d4e)

Release adaptation: Retain post-activation selectors from the stable retirement-only pass without synthetic advisory findings. Rebase only the receipt documentation and exclude the new updater contract.

Companion audit: PR #203959 is the source. #203994 adds a distinct serving-release resolver and outcome publication; the shipped updater already consumes the selected stable receipt and does not need that cutover.

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

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL 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