Skip to content

perf(doctor): skip empty shared-state readability captures - #193360

Merged
steipete merged 4 commits into
mainfrom
dbasync/doctorgen-b2
Nov 5, 2026
Merged

steipete merged 4 commits into
mainfrom
dbasync/doctorgen-b2

Conversation

@steipete

@steipete steipete commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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 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 passed all three PostgreSQL shards, types, typed lint, source contracts, ratchets, SDK API diff and the published-driver/native-systemd cell. 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 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.

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.

@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.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L 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. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 5, 2026
@clawsweeper

clawsweeper Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR skips generation captures and empty transactions when shared-state readability needs no repair.

Example: Repeat captured Doctor on a healthy SQLite database without WAL or rollback-journal artifacts.

  • Before: Readability performs two generation observations and two empty immediate transactions.
  • After: Readability completes without those observations or transactions; actual repairs retain capture.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and source review found no actionable defect, but performance acceptance and upgrade validation are unfinished.
Proof confidence 🦐 gold shrimp (3/6) The ordinary contributor proof gate does not apply to this maintainer-authored PR; its declared production count and native compatibility runs remain pending, and historical fixture tests do not establish latest-stable upgrade compatibility for the changed repair flow.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Repeat Doctor passes perform unnecessary full database observations and empty write transactions.
Reason: The host establishes maintainer direction, and the implementation removes concrete redundant work within the existing owner.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it is a focused, maintainer-directed performance improvement, and source review found no concrete introduced bug.

Priority: P2
Reviewed head: e5ede7735ee5d56033c3a5a8f36383190fcbcaa3

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply the declared matched repeat-Doctor counts and retained-WAL native update result, plus a latest-stable upgrade showing settings, valid rows, recovery artifacts, attribution, and cleanup remain intact.
Agent review details

How this fits together

Doctor's shared-state maintenance owner inspects SQLite ownership and catalog health, prepares preservation when needed, and returns repair results to the update workflow.

flowchart TD
  A[Doctor update workflow] --> B[Shared-state maintenance]
  B --> C[Prepared readability inspection]
  C --> D[Clean completion]
  C --> E[Captured repair phase]
  E --> F[Live ownership check]
  F --> G[SQLite repair and result]
Loading

Technical review

Best possible solution:

Use the existing prepared repair owner to skip clean readability work while preserving capture and effect-time checks for every repair.

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

Baseline source unconditionally captures readability and executes both repair transactions even when neither repair is needed; the PR reports a matching red/green regression, but this review ran no target code.

Is this the best way to solve the issue?

The change follows the existing ownership boundary, carries the prepared repair fact, removes the superseded forwarding helper, and preserves distinct synchronous and asynchronous repair contracts without adding a cache.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Asynchronous readability and preservation ordering keeps the original intent (d894035: Prepare snapshots and credential observations asynchronously while retaining maintenance custody, preservation-before-deletion, and synchronous SDK contracts.)
  • Initial capture selection changes intended behavior with a stated reason (ef81b25: Avoid capture for artifact-free read-only preparation while retaining capture for native recovery and later mutations.)
  • Catalog transaction and ownership checks keeps the original intent (1e7797a: Repair only the recognized malformed Workshop index while preserving review rows and checking database ownership.)
  • Native benchmark fixture placement keeps the original intent (f61e550: Measure real native updates with isolated synthetic state and task-owned cleanup.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head hunks for all six introduced files, excluding base movement; the final checkout remained clean. (e5ede7735ee5)
  • Capture remains around possible writes: Only artifact-free initial readability joins the existing Doctor/version exemption; retained WAL or journal still enters capture, and every generator resumption uses the captured migration owner. (src/state/openclaw-state-db-repair.ts:220, e5ede7735ee5)
  • Final-effect checks retained: Catalog repair invokes the prepared ownership-rechecked apply operation inside its transaction; orphan recovery checks write authority inside its transaction, and full Doctor still invokes apply unconditionally after BEGIN. (src/state/openclaw-state-db-repair.ts:669, e5ede7735ee5)
  • Current-main necessity: Fetched main retains the baseline repair implementation. The predecessor, perf: skip read-only Doctor preparation capture #193241, explicitly leaves two readability observations for this separately approved follow-up. (src/state/openclaw-state-db-repair.ts:225, 7ec1d3e861ce)
  • Regression coverage: The changed suites exercise clean versus retained-artifact capture, synchronous versus asynchronous repair, historical catalog and orphan-payload preservation, and ownership claimed immediately before BEGIN. (src/state/openclaw-state-ownership.test.ts:676, e5ede7735ee5)
  • Declared validation remains unfinished: The complete live PR body still identifies matched count and retained-WAL native runs as pending; its 27-to-25 process counts are expectations, while the reported passing owner suites belong to a production-equivalent prior head. (e5ede7735ee5)

Likely related people:

  • Peter Steinberger: Raw commit 7517981 adds src/state/openclaw-state-db-maintenance.ts:92 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7517981b5e67; files: src/state/openclaw-state-db-maintenance.ts)
  • RoboClaw: Raw commit d894035 adds src/state/openclaw-state-db-repair.ts:215 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d894035c7829; files: src/state/openclaw-state-db-repair.ts)
  • Jacqueline Henriksen: Raw commit 1e7797a adds src/state/openclaw-state-db-maintenance.ts:96 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 1e7797ad9836; files: src/state/openclaw-state-db-maintenance.ts)

PR surface

Source -8, Tests -5, Other +12. Total -1 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 74 82 -8
Tests 3 243 248 -5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 13 1 +12
Total 6 330 331 -1

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
Benchmark option 1 new flag: --scratch-root Allows matched native benchmark arms to reuse an absolute fixture path; exclusive directory creation and existing cleanup remain in place.

Labels

Label changes:

  • add P2: Removes avoidable database inspection and worker work during repeat Doctor passes, with no demonstrated urgent user regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.

Label justifications:

  • P2: Removes avoidable database inspection and worker work during repeat Doctor passes, with no demonstrated urgent user regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.

Rank-up moves

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

  • Complete the declared matched count comparison through the production Doctor entry point.
  • Provide native upgrade compatibility evidence with existing settings and valid data preserved.

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:10 AM ET / 10:10 UTC.

@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:07:52.209515Z e489ad6 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.

@steipete
steipete merged commit 18a3a6c into main Nov 5, 2026
173 of 174 checks passed
@steipete
steipete deleted the dbasync/doctorgen-b2 branch November 5, 2026 12:34
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

P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant