Skip to content

fix(update): identify Doctor widening and separate readiness timing - #193393

Merged
steipete merged 5 commits into
mainfrom
dbasync/postpass
Nov 5, 2026
Merged

steipete merged 5 commits into
mainfrom
dbasync/postpass

Conversation

@steipete

@steipete steipete commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A post-plugin Doctor can widen from deferred model retirement to a full pass without identifying the predicate that selected it. Update verification also included time after the Gateway had become ready, obscuring the distinction between outage and cleanup.

User Impact

Diagnostics name the first retirement-only widening site and report verification through the existing onVerified boundary. Separate timing rows cover plugin-cohort commit, post-update maintenance, and recovery-artifact cleanup. Selection, repair, refusal, capture, backup, and recovery behavior are unchanged.

Why This Change Was Made

Replace the existing conjunction with equivalent named blockers, retaining its order and all 23 predicates. Contribution diagnostics name the existing first widening site or failed contribution. The names are fixed owner sites; no values or user data are added. Timing uses existing operations and result rows, without another database read or request.

The candidate must contain the Doctor diagnostics. The installed updater must contain the readiness/post-ready timing changes. An older updater remains supported and follows its existing full/narrow selection.

Acceptance rule — before measurements

Workload: the committed scripts/perf/doctor-retirement-measure.mts native source-update flow with an independent fixed installed driver, isolated synthetic state, real Gateway transport, deferred then completed retirement, and the opt-in standing-advisory fixture. Compare the pinned base and candidate on the same macOS host. Keep cold and warm results separate. Run one baseline/candidate native functional pair for this diagnostics-only change, plus the required published-driver update cell. Both arms use the same fixed installed driver and the same committed workload. The current workload allocates random fixture roots, so per-section execution, generation observations, SQL statements, worker requests and runtime MAIN work are descriptive counts, not a matched-root performance comparison. Require unchanged selection and no new owner SQL/request operations; investigate any attributed increase. A matched-root or timing saving is not claimed. All real findings, refusals, failures, interruption and pending-retirement recovery must retain their existing outcomes. Require a normalized first widening site whenever the second pass widens; a narrow second pass legitimately omits the skipped advisory renderers. The first full pass must establish the standing-advisory fixture. The fixed older driver proves candidate Doctor behavior. Focused owner tests prove the readiness endpoint equals onVerified and maintenance timing is published; actual installed-updater timing observations require a later update driven by this candidate, and remain explicitly unproven by the older-driver pair. Report post-ready operations separately.

No speedup claim is made for Stage 0. Wall-time or CPU A/B claims, if pursued, require the campaign timing lock, load below 24, at least five interleaved samples per arm, separate cold/warm distributions, median/p95/spread, and no adverse user-facing metric. Any adverse 20% cell or runtime MAIN increase stops acceptance. Counts and functional proof remain valid independently of host load.

Evidence

HEAD: f545ae3d2d18e2883c2d17c90fae36b6a5ccf86d. Baseline: 38c4adccd8a217aebc79334eab235a12e35cc68b. Fixed installed driver: ef81b2545c8cf6f20f1b2723628fc5291d45bde0. Acceptance marker: POSTPASS-STAGE0-NATIVE-V1.

Corrected native pair: both arms passed update, deferred-to-completed retirement, final real Gateway transport, and owned-process cleanup (zero cleanup errors). Descriptive per-Doctor counts match exactly:

Doctor Sections, base → head SQL, base → head Worker requests, base → head Process-main / worker SQL, each Generation observations, each
Rehearsal 72 → 72 3,784 → 3,784 204 → 204 3,527 / 257 0
First live 91 → 91 259,203 → 259,203 464 → 464 258,270 / 933 32
Post-plugin 91 → 91 133,626 → 133,626 409 → 409 132,814 / 812 21

Candidate first widening site: config.preflight-config-changed. All four advisory shapes appear in the post-plugin pass; network bind, plaintext-config and shared-DM notices also appear in the first live pass. Source tracing confirms these standing notices do not feed the repair-sequence warning array. The migration-completion caller marks any requested snapshot refresh as config changed, including ledger-only settlement; that is a separate Stage 1 investigation, not changed here.

Gateway runtime MAIN SQL matches: canary 44 → 44; final Gateway 59 → 59. Random roots prevent a causal timing comparison. The analyzer identifies auxiliary processes outside command ancestry, so whole-run totals are not used for attribution; Doctor subtree counts reconcile with frozen-observer headers. Completed retirement is asserted by the native harness rather than serialized as a separate final-row artifact. The observer does not count copied bytes. No sustained steady-state or managed-service restart is claimed.

The older driver exercises candidate Doctor behavior, retirement completion, and final real Gateway transport. It does not exercise the newly installed-updater timing rows. Focused owner tests prove the readiness endpoint equals onVerified and the timing rows cover their existing operations; a later update driven by this updater remains the production timing proof.

Two isolated Codex production reviews and the required correction reviews are clean. The final fixture-only delta also passed isolated review. Focused contribution/config/finalization tests cover retirement completion, changed-plugin/full selection, finding-driven widening, authority/refusal/failure handling, cancellation, and recovery. Format, plain lint, line cap, runtime-cycle scan, production Knip, T1 and dialect ratchets pass. Local type-aware preparation refuses the mandated out-of-checkout virtual store (Declaration input escapes checkout); exact-head CI types and typed lint cover that gap without bypassing containment.

Exact-head CI run 42023158481 passed, including all three PostgreSQL conformance shards, production and test types, typed lint, source/architecture guards, ratchets and affected test groups. No failed-job rerun was needed on this final head.

Published-driver cell: run 42010633192, job 127198494208 passed published 2026.11.1 container and 2026.10.9 native-systemd updates, including updater-owned restart, candidate identity, readiness, durable state/approval preservation, and cleanup. Its candidate production and E2E sources are identical to this head. The supplemental aggregate had unrelated failures and is not claimed green.

Fixture controls: an earlier attempt correctly failed final readiness because the synthetic channel lacked its account lifecycle. An intermediate corrected pair passed readiness but widened at config.model-retirement because the fixture security hook had peers while generic Doctor saw an empty channel allowlist. The final workload gives both owners the same synthetic peers. No product predicate was weakened to accommodate either fixture error.

Production delta: +43 lines; test delta: 0; committed workload: +92; docs: +7. No SQL text, schema, transaction ordering, state-owner admission, cache, generation, or public SDK changes. Exact-head PG review approved.

Open-PR overlap: 28 indexed peers checked with base-only versus base+candidate merge trees at this head, zero new conflict paths. #192698's inherited block expansion has the coordinator's standing exception. Peers: #193360, #193109, #192698, #192350, #192349, #192228, #191754, #188577, #181395, #181393, #167219, #166166, #163964, #162160, #162144, #162132, #162126, #161344, #158723, #157542, #152205, #151441, #150246, #149882, #148581, #148066, #142668, #106998.

Observer-free custody attribution acceptance

Marker: POSTPASS-CUSTODY-PROFILE-V1. Before running, use the committed retirement workload on head f545ae3d2d18e2883c2d17c90fae36b6a5ccf86d, the same fixed installed driver and synthetic standing-advisory fixture, in --cold-only --retained-wal --mode profile --standing-advisories. Run one cold native profile for attribution only, with no SQL observer. Keep rehearsal, first-live and post-plugin Doctor separate. Require native update success, deferred-to-completed retirement, final real Gateway readiness, complete owned-process cleanup and usable per-thread profile coverage. This is not a baseline/candidate timing comparison or a speedup claim.

Report the union of samples below ownsDelegation and the wider assertBase subtree, without summing inclusive children; report total thread/process CPU and missing coverage separately. V8 sample durations are elapsed stack attribution, not exact CPU. Never multiply observer-inflated timing by statement share. Compare attributed time conservatively with 25.305 seconds (5% of the cited 506.1-second stopped window); report uncertainty and whether evidence is sufficient to reopen the separate custody lane. No custody/authority changes are authorized in this PR. The profile is exempt from the campaign A/B timing lock; it retains the large-fixture lock, internal-disk floor, and proof-slot gate.

@clawsweeper

clawsweeper Bot commented Nov 5, 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 Nov 5, 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-11-05T12:00:21.676458Z f545ae3 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 size: M labels Nov 5, 2026
@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 Nov 5, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR names why Doctor selects its full flow and separates Gateway readiness timing from subsequent update work.

Example: The second Doctor encounters an unfinished state migration.

  • Before: Doctor selects the full flow without identifying the eligibility predicate responsible.
  • After: Doctor reports “Retirement-only Doctor widened: config.state-migration-unsettled”.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused implementation with no concrete findings; current evidence is strongest at the owner harness rather than the shipped updater.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored diagnostics change is outside the contributor proof gate; focused owner tests support it, but its explicitly declared native acceptance runs remain pending and the inspected reconnect screenshots do not exercise it.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Update diagnostics obscure why Doctor repeats the full flow and conflate readiness observation with later work.
Reason: The maintainer-authored direction improves operational visibility without relaxing safeguards or adding a product configuration option.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it provides useful update diagnostics, has maintainer-approved direction, and introduces no concrete correctness or security defect found in this review.

Priority: P3
Reviewed head: 1db7dd8d52fedc589df13a72ae29b67f1e873a4c

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The declared native baseline/candidate pair, published-driver upgrade cell, and candidate-driven timing observation remain unshown; diagnostic regressions are not shown red on the base.
Agent review details

How this fits together

The updater invokes candidate Doctor, verifies Gateway readiness, and completes maintenance and cleanup; these existing owners now supply more precise diagnostic names and timing metadata.

flowchart TD
  A[Installed updater] --> B[Candidate Doctor preparation]
  B --> C[Retained or full Doctor flow]
  C --> D[Gateway readiness verification]
  D --> E[Maintenance and plugin commit]
  E --> F[Recovery artifact cleanup]
  F --> G[Update result]
Loading

Technical review

Best possible solution:

Keep the diagnostics in the existing selection, verification, maintenance, and cleanup owners while preserving their operational predicates.

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

Current-main source demonstrates unnamed full-flow selection and verification timing recorded after onVerified; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch is a focused solution: it derives the first blocker from existing predicates and measures existing operations, with only an opt-in diagnostic-workload flag added.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Doctor retirement-only eligibility and fallback keeps the original intent (f61e550: Avoid repeating unrelated contributions when deferred retirement is the only remaining obligation, while preserving full-flow fallback and terminal refusals.)
  • Pre-retirement config retention keeps the original intent (ec5d369: Retain original heartbeat migration facts before retirement removes their configuration; later fixes also preserve disabled state.)
  • Gateway verification accounting keeps the original intent (53fc4b9: Preserve qualifying still-starting Gateways and distinguish unverified readiness from genuine verification failures.)
  • Automatic recovery cleanup keeps the original intent (fb9e117: Retire eligible recovery artifacts after durable success and executor settlement through the existing state owner.)
  • Plugin cohort settlement keeps the original intent (6fd646e: Keep plugin generations compatible with core activation and rollback under the existing executor.)
  • Post-update maintenance keeps the original intent (97c7b35: Finish owned installation transitions and preserve service recovery; subsequent maintenance failures retain their existing outcome handling.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit fb9e117 adds src/cli/update-cli/automatic-cleanup.ts:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fb9e117745a7; files: src/cli/update-cli/automatic-cleanup.ts)

PR surface

Source +43, Tests 0, Docs +7, Other +76. Total +126 across 15 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 87 44 +43
Tests 6 38 38 0
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 1 76 0 +76
Total 15 208 82 +126

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test growth Production net +43 lines; tests net 0 lines The growth supplies blocker identities and timing measurements directly at existing owners without adding a production module or competing state owner.

Labels

Label changes:

  • add P3: This improves diagnostic accuracy and troubleshooting without changing update eligibility, recovery, or service availability.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This improves diagnostic accuracy and troubleshooting without changing update eligibility, recovery, or service availability.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the already-declared native acceptance runs and capture the changed diagnostics and timing output with sensitive values redacted.

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 November 5, 2026, 5:56 AM ET / 10:56 UTC.

@steipete
steipete merged commit fc7f037 into main Nov 5, 2026
150 of 153 checks passed
@steipete
steipete deleted the dbasync/postpass branch November 5, 2026 12:25
steipete added a commit that referenced this pull request Nov 5, 2026
## What Problem This Solves

A repeat captured Doctor still performs two full generation observations around shared-state readability even when no catalog or orphan repair is needed. Its readability helper also opens two empty immediate transactions on that clean path.

The existing schema-repair owner now returns its prepared `needed` fact with `apply`. The prepared schema-repair owner owns its catalog repair transaction and exposes the same prepared apply operation to the generator. The generator consumes the needed fact once. Clean, artifact-free readability can finish without an attributed write phase; retained WAL/journal still use the original initial envelope, and catalog/orphan repair still resumes through capture before writing. The superseded forwarding helper is deleted.

Full Doctor still invokes `apply` unconditionally inside its write transaction, retaining the ownership check after `BEGIN`. Actual repair still checks live authority at effect; original generation baseline, untouched-path final comparison, source custody, cancellation, awaited credentials and closure, and separate state/agent commits remain. No `capture.accept`, `openedSqlitePaths` shortcut, new cache, schema, generation, dependency or finalizer change.

## Acceptance rule (before count runs)

Flow: repeat captured Doctor through committed `scripts/perf/doctor-captured-pass.mts`, starting from the same migrated four-agent/4096-session synthetic fixture at the same absolute path. Baseline must contain landed B1; candidate differs only by the readability owner simplification. Keep the retained-WAL native update flow as a separate compatibility cohort.

Counts first, one matched base/candidate pair: clean no-companion readability removes one before/after generation observation pair (2 generation workers and 2 size workers), its 22 inspection SQL statements, and two empty immediate transactions; measure the remaining SQL/read/request deltas rather than assigning all totals to the deletion. Existing WAL or journal retains the initial envelope. Dirty catalog/orphan repair still enters the original capture before its first write; no skipped path calls capture.accept or marks itself opened. Full Doctor still executes the prepared ownership check unconditionally after BEGIN.

Win: at least the two redundant readability observations removed in the actual repeat flow, total SQL/requests and runtime Gateway MAIN hold or improve, source/refusal/restoration/cleanup behavior unchanged, production net <=0 and test net <=0. Counts for main threads across child processes are labeled separately from runtime Gateway MAIN. No timing result from an instrumented profile is treated as a speedup.

Timing: the campaign timing deadline expired at 2026-11-05T07:08:34Z. This PR uses deterministic worker/SQL/copied-byte counts only; it claims no CPU or wall-time speedup. The retained-WAL native update is a distinct compatibility cohort and is not timed for performance acceptance.

Proof: red/green clean readability transaction/worker counts adapted into existing tests; retain same/different-content outside-write refusal, empty reader transition, malformed catalog plus preserved orphan recovery, synchronous and asynchronous behavior, and full Doctor post-BEGIN authority. Two isolated reviews, PG checklist and approval for exact head, matched native retained-WAL update, exact-head CI including three PG shards and published-driver cell, peer overlap audit.

Expected remaining generation observations after the bounded cut: inventory 3; quick-index 2; readability 0; shared-state/credential opens 6; additive-agent schemas 8; legacy/schema/credential repair 6; total 25. Confirm with the production run; do not infer savings from source alone.

The parameterized migration tests retain direct full-Doctor and readability-first routes for both synchronous SDK and asynchronous Doctor entrypoints. Malformed catalog, preserved orphan payload/BigInt/export, integrity, current version, refusal, and repeat-repair idempotency assertions remain. Production net -8 LOC; tests net -5 LOC.

## Evidence

Current integration head: `e489ad6e51aa7775961d485eda51d7e501e4035a`. Merged current main `f34fb556b7ba6abdeedf102730b9214d61db299d` once to include the auth fake-clock fixture fix from #193451. All six B2 file blobs and B2’s diff against main are identical to the reviewed `e5ede773` patch. Count, native-update and published-driver evidence below therefore carry forward; the new normal pull-request [CI run42024239906](https://github.com/openclaw/openclaw/actions/runs/42024239906) passed, including all three PostgreSQL shards, static checks and the affected Node test groups. Required `openclaw/ci-gate`, dependency-review and security-sensitive-review are successful on this exact head. The prior auth-timer failure did not recur; no rerun was needed. No bypass will be used. Exact-head PostgreSQL review was carried by the coordinator after verifying the unchanged six B2 blobs.

One matched repeat-Doctor pair on Node26.12.1/macOS restored the same pristine four-agent/4096-session synthetic fixture at its original absolute path (1,190files/428,490,104bytes; SHA256 `38f500c594546a577e093b58b3956dc42e3e85ef6d593b6acf15a84c98eadd34`). Both arms passed product/restoration checks and cleaned the fixture.

| Scope | SQL base → candidate | Process-main SQL | Worker SQL | Requests | Copied bytes |
|---|---:|---:|---:|---:|---:|
| Doctor | 118,284 → 117,672 | 117,696 → 117,084 | 588 → 588 | 271 → 271 | 1,066,041,712 → 1,062,633,960 |
| Parent/other | 4,321 → 4,321 | 4,302 → 4,302 | 19 → 19 | 18 → 18 | 427,888,640 → 427,888,640 |
| Whole | 122,605 → 121,993 | 121,998 → 121,386 | 607 → 607 | 289 → 289 | 1,493,930,352 → 1,490,522,600 |

Doctor generation/size27/27→25/25; whole32/32→30/30; process starts184→180. Open/close/execute/task request deltas all0. Process-main is CLI/child thread0, not runtime Gateway MAIN. SQL−612 is the observed pair result; the fixed deletion is22 inspection statements plus two empty transactions, with remaining authority/lease work dependent on elapsed progress. After normalizing elapsed busy_timeout values,34 SQL shapes decrease and none increases. Doctor main copy−3,428,352bytes, WAL prefix+20,600bytes, journal unchanged; total−3,407,752bytes. No timing saving is inferred.

Remaining25 observations: inventory/settlement3, quick-index2, shared-state/credential opens6, additive-agent schemas8, legacy/schema/credential repair6. Readability pair2→0; other categories unchanged. No process/SQL ancestry gaps or PID reuse. The offline comparator initially omitted the four source .ts generation workers per arm; an independent spawn/lifetime audit confirmed them, and accepting only the exact .js/.ts entrypoints fixed comparison without changing raw records or rerunning either product arm. Historical B1 SQL totals are not directly comparable because this baseline includes inherited plugin-preparation work.

The separate retained-WAL native update pair passed exact activation/build identity, deferred-to-completed retirement, real Gateway transport, process stop and zero cleanup errors. Both arms started with identical main/WAL byte counts and identical three Doctor WAL/SHM boundaries.

| Native scope | SQL base → candidate | Requests base → candidate | Generation / size processes base → candidate |
|---|---:|---:|---:|
| Whole flow | 296,063 → 294,567 | 155,714 → 155,716 | 68 / 65 → 64 / 61 |
| Preflight Doctor | 3,608 → 3,580 | 119 → 119 | 0 / 0 → 0 / 0 |
| Installed Doctor | 146,880 → 146,269 | 351 → 351 | 32 / 32 → 30 / 30 |
| Final Doctor | 121,076 → 120,464 | 166 → 166 | 21 / 21 → 19 / 19 |

Direct runtime Gateway MAIN holds: canary 44→44; final Gateway 53→53 (startup/readiness48 + shutdown5). Whole process-main SQL290,019→288,520 is a different metric; workerSQL6,044→6,047. Whole-flow SQL is cadence-dependent, not a fixed per-invocation saving. Native copied bytes are unmeasured, not zero; no CPU/wall speedup or warm-steady claim.

All adverse native movements remain counted: one Doctor lease heartbeat; a shutdown plugin-catalog cache task/read; one canary sandboxRegistry.list schema-version read; and a final startup-integrity completion followed by its database open. Outside-Doctor cache scan0→1 and cache_size2→3 are disclosed. All12 relevant owners are blob-identical base/head. These are timing-dependent background progress differences, cause not proven. The coordinator explicitly accepted +2requests/+3workerSQL and the new cells after source attribution; none is subtracted as noise.

Two raw macOS leaf PIDs were each reused in disjoint process lifetimes. A strict offline split preserves all2,850 process events and62 affected SQL records, every raw hash and total. An isolated independent audit reconciles294,567SQL/155,716requests. Unobserved shell parents leave an ancestry coverage gap; all observed children remain counted (598SQL/0requests each arm, before Doctor).

Validation:132 owner tests passed on the production-equivalent head, including retained artifacts, outside-write refusal, empty readers, credential preparation/close and retirement. The B1 red control performs2 observations versus expected0; B2 passes. Final4 ownership cases, typed lint, format and line-cap pass. Two full isolated Codex reviews plus required production-delta/test corrections are clean. Exact-head PostgreSQL approval is recorded. Local broad check:changed was canceled143 and is not a pass; CI supplies broad gates.

Original proof-head CI run [42003968887](https://github.com/openclaw/openclaw/actions/runs/42003968887) passed all three PostgreSQL shards, types, typed lint, source contracts, ratchets, SDK API diff and the [published-driver/native-systemd cell](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127173500397). The run is not reported green: its original auth timer, deferred-project marker and UI timeout failures remain recorded. The single approved projects retry [127208432932](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127208432932) passed (11:08:56–11:34:54Z). The original marker ENOENT remains disclosed; no source fix or weakened assertion was introduced. The corrected PR body also passed its context/evidence check [127216156959](https://github.com/openclaw/openclaw/actions/runs/42018847897/job/127216156959).

The auth retry reproduced a leftover fake timer at `auth-controller.test.ts:226` and a separate cleanup-authority timeout. After the single Testbox allocation queued and was stopped without executing tests, the coordinator authorized one exact 19-file Node24.22.1/macOS replay per arm, with CI's three workers and isolation configuration unchanged. Both base and candidate reproduce the same timer assertion (base377pass/1fail; candidate382pass/1fail); all other18files pass, and worker cleanup completes. All source archive bytes verified before/after. This establishes matching-signature baseline evidence on macOS, not a Linux result, a fix, or a green suite. The follow-up #193451 attributed this timer to tsx disk-cache initialization captured by the fake clock and prepares it before the clock starts, retaining all assertions. That test-only fix is now included by the main merge; the new normal CI must confirm it on this integration head. The source-identical90s cleanup timeout remains disclosed. No assertion or timeout was weakened.

The UI timeout has no assertion failure and is coordinator-dispositioned as unrelated. Knip's sole `handleUpgradeRequest` export finding is independently reproduced in scheduled main run41994726590/job127135524057, then fixed on main by73145; the prospective merge retains the exact fixed blob. No new static findings are accepted.

Production net−8 LOC; tests net−5 LOC. Benchmark +12 lines adds a freshly created explicit scratch root so arms run at the same absolute path; default path and cleanup are unchanged. No B2 file changes followed final review; the current head additionally contains the unchanged main merge described above.

Overlap refreshed on the integrated head through the shared PR index: #193393 at `f545ae3d` merges cleanly both before and after B2; #192228/#188492/#166475/#149882/#146868 add no conflicts (7/34/18/92/7 inherited paths respectively). #192698 retains 2,751 conflicting paths in both arms and no new conflict relation. The repair-owner block is resegmented inside its already-conflicted file, covered by the coordinator’s explicit standing disposition for that draft. The previous 2,912-path count belonged to the earlier base. No per-PR census was used.

Acceptance marker: `DOCTORGEN-B2-COUNTS-e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`. Measured candidate: `e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`; exact base: `ef81b2545c8cf6f20f1b2723628fc5291d45bde0`. The same existing migrated fixture is restored at one path for each count arm; the native retained-WAL cohort is separately restored at its own fixed path.

Final test-only correction restores the baseline DatabaseSync.exec descriptor capture after typed lint rejected the direct unbound method reference. Four ownership-injection cases pass; an isolated delta review is clean. Production is byte-identical to the PostgreSQL-approved 24a93d8 head. The earlier CI runner also hit a documented 8 GiB fixture disk requirement with only 7.2–7.3 GiB free; this is retained as environment evidence, not claimed as a passing test. The final exact-head CI outcomes and their dispositions are recorded above.


Count setup correction (before the replacement pair): the first baseline ran 39 generation/size processes because moving the byte-identical migrated fixture invalidated its existing absolute-path daemon-runtime-pin receipt, adding six migration envelopes. That attempt is excluded from repeat-Doctor acceptance. Candidate attempts stopped before repair because the temporary artifact observer matched only a single-line repair initializer. B2 emits that initializer over multiple lines; the observer crashed the child during import, and its parent correctly refused the exited process identity. A small direct module import reproduced the observer error. The corrected bounded multiline observer imports both exact repair-owner modules successfully; no product authority behavior changed. The replacement pair restores the unchanged pristine fixture at its original path for both arms. The original 27→25 projection and all acceptance thresholds remain unchanged. The canceled second attempt stopped during preflight and executed no Doctor.

Final landing check: current main includes #193393. Its additive standing-advisories benchmark changes merge cleanly with B2; all five reviewed production/test files remain byte-identical. This is main-owned benchmark integration only; B2 head and its own diff have not changed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…penclaw#193393)

Name the existing first retirement-only Doctor widening predicate and separate Gateway readiness from post-ready maintenance timings. Preserve every selection, refusal, capture, backup and recovery predicate.

The synthetic fixed-driver native pair passes deferred retirement completion, final transport and cleanup with identical Doctor SQL/request counts and Gateway MAIN work. Exact-head CI and all three PostgreSQL shards pass; published-driver update cell passes on identical production code. No speedup is claimed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…193360)

## What Problem This Solves

A repeat captured Doctor still performs two full generation observations around shared-state readability even when no catalog or orphan repair is needed. Its readability helper also opens two empty immediate transactions on that clean path.

The existing schema-repair owner now returns its prepared `needed` fact with `apply`. The prepared schema-repair owner owns its catalog repair transaction and exposes the same prepared apply operation to the generator. The generator consumes the needed fact once. Clean, artifact-free readability can finish without an attributed write phase; retained WAL/journal still use the original initial envelope, and catalog/orphan repair still resumes through capture before writing. The superseded forwarding helper is deleted.

Full Doctor still invokes `apply` unconditionally inside its write transaction, retaining the ownership check after `BEGIN`. Actual repair still checks live authority at effect; original generation baseline, untouched-path final comparison, source custody, cancellation, awaited credentials and closure, and separate state/agent commits remain. No `capture.accept`, `openedSqlitePaths` shortcut, new cache, schema, generation, dependency or finalizer change.

## Acceptance rule (before count runs)

Flow: repeat captured Doctor through committed `scripts/perf/doctor-captured-pass.mts`, starting from the same migrated four-agent/4096-session synthetic fixture at the same absolute path. Baseline must contain landed B1; candidate differs only by the readability owner simplification. Keep the retained-WAL native update flow as a separate compatibility cohort.

Counts first, one matched base/candidate pair: clean no-companion readability removes one before/after generation observation pair (2 generation workers and 2 size workers), its 22 inspection SQL statements, and two empty immediate transactions; measure the remaining SQL/read/request deltas rather than assigning all totals to the deletion. Existing WAL or journal retains the initial envelope. Dirty catalog/orphan repair still enters the original capture before its first write; no skipped path calls capture.accept or marks itself opened. Full Doctor still executes the prepared ownership check unconditionally after BEGIN.

Win: at least the two redundant readability observations removed in the actual repeat flow, total SQL/requests and runtime Gateway MAIN hold or improve, source/refusal/restoration/cleanup behavior unchanged, production net <=0 and test net <=0. Counts for main threads across child processes are labeled separately from runtime Gateway MAIN. No timing result from an instrumented profile is treated as a speedup.

Timing: the campaign timing deadline expired at 2026-11-05T07:08:34Z. This PR uses deterministic worker/SQL/copied-byte counts only; it claims no CPU or wall-time speedup. The retained-WAL native update is a distinct compatibility cohort and is not timed for performance acceptance.

Proof: red/green clean readability transaction/worker counts adapted into existing tests; retain same/different-content outside-write refusal, empty reader transition, malformed catalog plus preserved orphan recovery, synchronous and asynchronous behavior, and full Doctor post-BEGIN authority. Two isolated reviews, PG checklist and approval for exact head, matched native retained-WAL update, exact-head CI including three PG shards and published-driver cell, peer overlap audit.

Expected remaining generation observations after the bounded cut: inventory 3; quick-index 2; readability 0; shared-state/credential opens 6; additive-agent schemas 8; legacy/schema/credential repair 6; total 25. Confirm with the production run; do not infer savings from source alone.

The parameterized migration tests retain direct full-Doctor and readability-first routes for both synchronous SDK and asynchronous Doctor entrypoints. Malformed catalog, preserved orphan payload/BigInt/export, integrity, current version, refusal, and repeat-repair idempotency assertions remain. Production net -8 LOC; tests net -5 LOC.

## Evidence

Current integration head: `e489ad6e51aa7775961d485eda51d7e501e4035a`. Merged current main `5166bef057aecf7c139598ad0d1ce3ac53cbd626` once to include the auth fake-clock fixture fix from openclaw#193451. All six B2 file blobs and B2’s diff against main are identical to the reviewed `e5ede773` patch. Count, native-update and published-driver evidence below therefore carry forward; the new normal pull-request [CI run42024239906](https://github.com/openclaw/openclaw/actions/runs/42024239906) passed, including all three PostgreSQL shards, static checks and the affected Node test groups. Required `openclaw/ci-gate`, dependency-review and security-sensitive-review are successful on this exact head. The prior auth-timer failure did not recur; no rerun was needed. No bypass will be used. Exact-head PostgreSQL review was carried by the coordinator after verifying the unchanged six B2 blobs.

One matched repeat-Doctor pair on Node26.12.1/macOS restored the same pristine four-agent/4096-session synthetic fixture at its original absolute path (1,190files/428,490,104bytes; SHA256 `38f500c594546a577e093b58b3956dc42e3e85ef6d593b6acf15a84c98eadd34`). Both arms passed product/restoration checks and cleaned the fixture.

| Scope | SQL base → candidate | Process-main SQL | Worker SQL | Requests | Copied bytes |
|---|---:|---:|---:|---:|---:|
| Doctor | 118,284 → 117,672 | 117,696 → 117,084 | 588 → 588 | 271 → 271 | 1,066,041,712 → 1,062,633,960 |
| Parent/other | 4,321 → 4,321 | 4,302 → 4,302 | 19 → 19 | 18 → 18 | 427,888,640 → 427,888,640 |
| Whole | 122,605 → 121,993 | 121,998 → 121,386 | 607 → 607 | 289 → 289 | 1,493,930,352 → 1,490,522,600 |

Doctor generation/size27/27→25/25; whole32/32→30/30; process starts184→180. Open/close/execute/task request deltas all0. Process-main is CLI/child thread0, not runtime Gateway MAIN. SQL−612 is the observed pair result; the fixed deletion is22 inspection statements plus two empty transactions, with remaining authority/lease work dependent on elapsed progress. After normalizing elapsed busy_timeout values,34 SQL shapes decrease and none increases. Doctor main copy−3,428,352bytes, WAL prefix+20,600bytes, journal unchanged; total−3,407,752bytes. No timing saving is inferred.

Remaining25 observations: inventory/settlement3, quick-index2, shared-state/credential opens6, additive-agent schemas8, legacy/schema/credential repair6. Readability pair2→0; other categories unchanged. No process/SQL ancestry gaps or PID reuse. The offline comparator initially omitted the four source .ts generation workers per arm; an independent spawn/lifetime audit confirmed them, and accepting only the exact .js/.ts entrypoints fixed comparison without changing raw records or rerunning either product arm. Historical B1 SQL totals are not directly comparable because this baseline includes inherited plugin-preparation work.

The separate retained-WAL native update pair passed exact activation/build identity, deferred-to-completed retirement, real Gateway transport, process stop and zero cleanup errors. Both arms started with identical main/WAL byte counts and identical three Doctor WAL/SHM boundaries.

| Native scope | SQL base → candidate | Requests base → candidate | Generation / size processes base → candidate |
|---|---:|---:|---:|
| Whole flow | 296,063 → 294,567 | 155,714 → 155,716 | 68 / 65 → 64 / 61 |
| Preflight Doctor | 3,608 → 3,580 | 119 → 119 | 0 / 0 → 0 / 0 |
| Installed Doctor | 146,880 → 146,269 | 351 → 351 | 32 / 32 → 30 / 30 |
| Final Doctor | 121,076 → 120,464 | 166 → 166 | 21 / 21 → 19 / 19 |

Direct runtime Gateway MAIN holds: canary 44→44; final Gateway 53→53 (startup/readiness48 + shutdown5). Whole process-main SQL290,019→288,520 is a different metric; workerSQL6,044→6,047. Whole-flow SQL is cadence-dependent, not a fixed per-invocation saving. Native copied bytes are unmeasured, not zero; no CPU/wall speedup or warm-steady claim.

All adverse native movements remain counted: one Doctor lease heartbeat; a shutdown plugin-catalog cache task/read; one canary sandboxRegistry.list schema-version read; and a final startup-integrity completion followed by its database open. Outside-Doctor cache scan0→1 and cache_size2→3 are disclosed. All12 relevant owners are blob-identical base/head. These are timing-dependent background progress differences, cause not proven. The coordinator explicitly accepted +2requests/+3workerSQL and the new cells after source attribution; none is subtracted as noise.

Two raw macOS leaf PIDs were each reused in disjoint process lifetimes. A strict offline split preserves all2,850 process events and62 affected SQL records, every raw hash and total. An isolated independent audit reconciles294,567SQL/155,716requests. Unobserved shell parents leave an ancestry coverage gap; all observed children remain counted (598SQL/0requests each arm, before Doctor).

Validation:132 owner tests passed on the production-equivalent head, including retained artifacts, outside-write refusal, empty readers, credential preparation/close and retirement. The B1 red control performs2 observations versus expected0; B2 passes. Final4 ownership cases, typed lint, format and line-cap pass. Two full isolated Codex reviews plus required production-delta/test corrections are clean. Exact-head PostgreSQL approval is recorded. Local broad check:changed was canceled143 and is not a pass; CI supplies broad gates.

Original proof-head CI run [42003968887](https://github.com/openclaw/openclaw/actions/runs/42003968887) passed all three PostgreSQL shards, types, typed lint, source contracts, ratchets, SDK API diff and the [published-driver/native-systemd cell](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127173500397). The run is not reported green: its original auth timer, deferred-project marker and UI timeout failures remain recorded. The single approved projects retry [127208432932](https://github.com/openclaw/openclaw/actions/runs/42003968887/job/127208432932) passed (11:08:56–11:34:54Z). The original marker ENOENT remains disclosed; no source fix or weakened assertion was introduced. The corrected PR body also passed its context/evidence check [127216156959](https://github.com/openclaw/openclaw/actions/runs/42018847897/job/127216156959).

The auth retry reproduced a leftover fake timer at `auth-controller.test.ts:226` and a separate cleanup-authority timeout. After the single Testbox allocation queued and was stopped without executing tests, the coordinator authorized one exact 19-file Node24.22.1/macOS replay per arm, with CI's three workers and isolation configuration unchanged. Both base and candidate reproduce the same timer assertion (base377pass/1fail; candidate382pass/1fail); all other18files pass, and worker cleanup completes. All source archive bytes verified before/after. This establishes matching-signature baseline evidence on macOS, not a Linux result, a fix, or a green suite. The follow-up openclaw#193451 attributed this timer to tsx disk-cache initialization captured by the fake clock and prepares it before the clock starts, retaining all assertions. That test-only fix is now included by the main merge; the new normal CI must confirm it on this integration head. The source-identical90s cleanup timeout remains disclosed. No assertion or timeout was weakened.

The UI timeout has no assertion failure and is coordinator-dispositioned as unrelated. Knip's sole `handleUpgradeRequest` export finding is independently reproduced in scheduled main run41994726590/job127135524057, then fixed on main by73145; the prospective merge retains the exact fixed blob. No new static findings are accepted.

Production net−8 LOC; tests net−5 LOC. Benchmark +12 lines adds a freshly created explicit scratch root so arms run at the same absolute path; default path and cleanup are unchanged. No B2 file changes followed final review; the current head additionally contains the unchanged main merge described above.

Overlap refreshed on the integrated head through the shared PR index: openclaw#193393 at `f545ae3d` merges cleanly both before and after B2; openclaw#192228/openclaw#188492/openclaw#166475/openclaw#149882/openclaw#146868 add no conflicts (7/34/18/92/7 inherited paths respectively). openclaw#192698 retains 2,751 conflicting paths in both arms and no new conflict relation. The repair-owner block is resegmented inside its already-conflicted file, covered by the coordinator’s explicit standing disposition for that draft. The previous 2,912-path count belonged to the earlier base. No per-PR census was used.

Acceptance marker: `DOCTORGEN-B2-COUNTS-e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`. Measured candidate: `e5ede7735ee5d56033c3a5a8f36383190fcbcaa3`; exact base: `3a560c82e47ad5d8283886b4a17601a0dc8ddf67`. The same existing migrated fixture is restored at one path for each count arm; the native retained-WAL cohort is separately restored at its own fixed path.

Final test-only correction restores the baseline DatabaseSync.exec descriptor capture after typed lint rejected the direct unbound method reference. Four ownership-injection cases pass; an isolated delta review is clean. Production is byte-identical to the PostgreSQL-approved 24a93d8 head. The earlier CI runner also hit a documented 8 GiB fixture disk requirement with only 7.2–7.3 GiB free; this is retained as environment evidence, not claimed as a passing test. The final exact-head CI outcomes and their dispositions are recorded above.


Count setup correction (before the replacement pair): the first baseline ran 39 generation/size processes because moving the byte-identical migrated fixture invalidated its existing absolute-path daemon-runtime-pin receipt, adding six migration envelopes. That attempt is excluded from repeat-Doctor acceptance. Candidate attempts stopped before repair because the temporary artifact observer matched only a single-line repair initializer. B2 emits that initializer over multiple lines; the observer crashed the child during import, and its parent correctly refused the exited process identity. A small direct module import reproduced the observer error. The corrected bounded multiline observer imports both exact repair-owner modules successfully; no product authority behavior changed. The replacement pair restores the unchanged pristine fixture at its original path for both arms. The original 27→25 projection and all acceptance thresholds remain unchanged. The canceled second attempt stopped during preflight and executed no Doctor.

Final landing check: current main includes openclaw#193393. Its additive standing-advisories benchmark changes merge cleanly with B2; all five reviewed production/test files remain byte-identical. This is main-owned benchmark integration only; B2 head and its own diff have not changed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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.

1 participant