Skip to content

perf(sqlite): skip empty admission publications and expose worker timing - #170235

Merged
steipete merged 1 commit into
mainfrom
dbasync/workerrtt
Oct 12, 2026
Merged

steipete merged 1 commit into
mainfrom
dbasync/workerrtt

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem and result

Ordinary SQLite worker exchanges with no new admission facts still swept and republished the process admission registry. This invalidated the publication cursor shortcut and rebuilt worker bootstrap data without changing database facts. Empty installs are now no-ops; real publications, reference changes, worker exit, and full capture retain their existing owner paths.

The quiet-host one-row benchmark measures a modest improvement: overhead excluding SQL falls from 0.1005 / 0.3412 ms to 0.0946 / 0.2828 ms (p50 / p95) with detailed timing disabled. This is about 6% at p50, not the target 50%. A trivial round trip is approximately 0.1 ms, so the earlier 3.5 ms-per-request workload estimate cannot be treated as fixed transport overhead. Warmed SQL and request counts are unchanged.

Adds opt-in OPENCLAW_DIAGNOSTICS=sqlite.worker-timing timestamps to completed worker diagnostics for queue/dispatch, posting, worker entry/execution/serialization, and broker reply receipt. The startup-sampled flag adds no timing record or additional clocks when disabled. Owner execution includes JavaScript and SQL; caller continuation is measured separately. Framed requests report their initial exchange, omitting unavailable stages. No payloads or SQL text are recorded.

FIFO ordering, admission semantics, error propagation, live invalidation, and native write settlement keep their existing contracts. No schema, migration, config contract, request-count/order, or PostgreSQL bridge change. Owned byte transfers already exist, and the audited path has no double JSON encoding to remove. Related request-count work is #170171; the database-engine admission key and once-per-store contract from #169933 remain intact.

Removed check and accepted edge

Empty admission installation no longer calls publish() to sweep/rebuild metadata. Accepted edge: an empty exchange may leave retired metadata allocated until the next real publication or full capture. Shared retirement/revocation cells invalidate those facts immediately; this does not extend their authority. No compensating checks or new handshake were added.

Measurements

Quiet Linux Testbox, Node 24.19.0 / SQLite 3.53.3. Baseline 93bceb67948e, candidate 9b7c39693b1d; remote candidate tree 6d12426bd5b170f56e1f0c7bd95e153f34f9898f matches the source head. The shared harness was copied without edits. Three alternating M,C pairs for SQL, latency, and microbenchmark; 10 warmed turns per run, 3,000 one-row reads per micro run/mode after 300 warmups. Microbenchmark isolates the empty-install change with identical timing instrumentation on both sides; SQL timing includes iterator execution. Micro pre-run idle was at least 94%, and latency pre-run idle at least 99.75%.

SQL metric, median [min–max] Base Candidate
Turn-caused warmed all-thread statements 201 [201–201] 201 [201–201]
Turn-caused warmed requests 45 [45–45] 45 [45–45]
Warm MAIN statements 0 [0–0] 0 [0–0]
Window statements/turn, across run means 214.2 [213.7–214.3] 214.1 [213.7–214.2]
Whole-workload statements 6662 [6653–6665] 6663 [6650–6681]
Whole-workload requests 1217 [1216–1218] 1217 [1217–1220]
Whole-workload MAIN statements 838 [838–846] 838 [838–838]

The whole-workload +1 statement median is background/window noise: every causal warmed turn is equal, and the touched admission operation adds 0 statements / 0 requests. T1 calls in all touched production owners: 0 → 0; the handler already runs in sqlite-store.worker.ts. Whole-workload MAIN includes startup/one-shot work, not warm turns.

Shared read families are identical in every run. Request-family sets overlap and must not be summed.

Family, statements / requests per warm turn Base Candidate
Exact-entry facts 4 / 4 4 / 4
Actor hydration 2 / 2 2 / 2
Entry-cache snapshot loads 0 / 0 0 / 0
Row facts 6 / 3 6 / 3
Watermarks 1 / 1 1 / 1
Microbenchmark, p50 / p95 ms (9,000 samples per side/mode) Base Candidate
End-to-end, timing flag disabled 0.1053 / 0.3582 0.0988 / 0.2954
Overhead excluding SQL, timing flag disabled 0.1005 / 0.3412 0.0946 / 0.2828
Overhead excluding SQL, timing flag enabled 0.1079 / 0.2799 0.0956 / 0.2694
Detailed one-row timing stages (p50 / p95 ms)
Stage Base Candidate
Caller construction 0.0021 / 0.0066 0.0019 / 0.0060
Broker queue 0.0032 / 0.0076 0.0031 / 0.0076
Dispatch preparation 0.0347 / 0.0885 0.0325 / 0.0868
postMessage (nested in outbound) 0.0052 / 0.0111 0.0046 / 0.0110
Outbound transport / worker wake-up 0.0149 / 0.0425 0.0121 / 0.0405
Worker preparation 0.0041 / 0.0117 0.0035 / 0.0107
Owner execution (includes SQL) 0.0263 / 0.0762 0.0241 / 0.0742
SQL 0.0047 / 0.0136 0.0042 / 0.0131
Result serialization 0.0068 / 0.0157 0.0061 / 0.0150
Reply preparation before marker 0.0005 / 0.0020 0.0003 / 0.0015
Inbound and remaining reply preparation 0.0089 / 0.0221 0.0074 / 0.0181
Caller resume 0.0062 / 0.0197 0.0054 / 0.0175

These percentiles overlap and are not additive. Outbound includes postMessage; execution includes SQL; inbound includes the final admission/owned-byte preparation after the reply marker. Detailed timings diagnose the path rather than provide an uninstrumented transport-only measurement.

The first three latency pairs were noisy, so the one allowed extra M,C pair was run (latency only; no additional SQL or micro pairs). Detailed product timing was disabled for turn measurements; the same performance observer ran on both revisions. No run was discarded.

Warmed-turn latency, p50 / p95 ms Base Candidate
Original three pairs pooled (30 turns/side) 344.0 / 629.3 283.7 / 477.2
One extra pair (10 turns/side) 294.2 / 485.9 295.9 / 414.6
All four pairs pooled (40 turns/side) 307.9 / 619.7 288.0 / 467.1
Worker RTT sum, all four pairs 165.4 / 396.6 150.4 / 251.7
DB busy union, all four pairs 145.4 / 319.0 135.0 / 245.4
SQL duration, all four pairs 8.44 / 18.47 7.66 / 11.64

Per-pair turn p50 values (base → candidate): 309.1 → 266.9, 305.2 → 316.2, 595.8 → 259.9, and 294.2 → 295.9 ms. The slow third baseline affects the pooled difference substantially; the extra pair is effectively level. These observations do not establish a reliable warmed-turn saving or the −80 ms target. The repeatable scope of the implementation is eliminating empty-publication bookkeeping; measured trivial-request overhead improves modestly. The turn observer counts window requests (46–53), including background work; the separate causal SQL harness consistently measures 45 turn-caused requests. The extra pair pre-run idle was 99.875% / 99.625%.

Validation and landing exception

  • Changed-file oxfmt, oxlint, diff checks and commit hooks passed. Codex autoreview round 1 found no actionable P0–P2 findings; no production changes followed review.
  • Exact-head CI 38307403867: production/test types, type-aware lint, source contracts/export collisions, guards, Madge, T1/dialect ratchets, docs and security passed. PR CI supplied the broad static proof under the authorized relaxed-testing workflow; no separate remote check:changed invocation is claimed.
  • Both changed tests passed in CI: src/infra/sqlite-schema-facts.native.test.ts 51/51 (summed test-case time 0.879 s), src/infra/sqlite-worker-broker.test.ts 16/16 (8.524 s; changed FIFO/timing case 0.852 s). These are CI case timings, not standalone pnpm test <file> --maxWorkers=1 wall times; standalone wall times were not collected.
  • The native regression proves empty installs preserve the bootstrap/cursor, real in-process publications expose updated facts, and revocation/stale replay stay invalid. Existing broker FIFO coverage now also verifies completed timing stages. No SQL read/write class was removed.
  • Remote pnpm deadcode:exports ran all three Knip scans: production has exactly the same three findings as main job 114997826780: hasActiveDeliveryOwner in src/infra/outbound/delivery-queue-storage.ts, and listOpenClawStateFeatureSchemas / OpenClawStateFeatureSchema in src/state/openclaw-state-feature-schema.ts. Full-tree and scripts scans pass. None of these files is changed here.
  • The failed CI shards contain 10 config-session cases plus queued-collector AbortError matching scheduled main 38298274614. The other five cron visibility cases reproduce identically on candidate and main 93087c17bfe94952104013432f07a71f14ea7503: pnpm test src/gateway/server-methods/cron.runs.test.ts --maxWorkers=1 gives 5 failed / 9 passed on both, all CRON_JOB_NOT_FOUND; command walls 91.31 s / 68.69 s. Failing fixtures/owners are unchanged. The failure is a missing prepared user-profile fixture after the main fallback removal. CI remains red; landing uses the explicitly authorized inherited-failure exception, with these failures assigned to the main-repair owner.
  • SDK API diff and published-driver × candidate update cell are N/A: no SDK, update, Doctor, migrations/schema, plugin loading, or service lifecycle changes.

Size: 9 files, +145 / −16 lines. Most added lines expose the diagnostic timing stages and their documentation; the runtime optimization is one early return in the admission owner.

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Oct 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR skips empty SQLite admission publications and adds opt-in worker request timestamps.

Example: A SQLite worker returns zero changed admission records.

  • Before: Installing [] sweeps the registry, advances its revision, and rebuilds inherited admission data.
  • After: Installing [] preserves the publication and cursor shortcut.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused and source-consistent, with useful boundary coverage; observed runtime results are not yet supplied.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; supplied coverage exercises admission and broker boundaries, but runtime timing traces and comparative measurements remain pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Routine SQLite requests repeat admission bookkeeping, while existing durations cannot isolate transport and backend costs.
Reason: The maintainer-authored direction uses a small owner-level optimization and opt-in diagnostics, with the deferred-cleanup tradeoff explicitly recorded.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR provides a focused admission optimization and useful timing diagnostics; no discrete introduced correctness or security defect was found.

Priority: P2
Reviewed head: 9b7c39693b1da9ff52aa27e90ae2ee05db9af9ce

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No supplied Gateway trace or comparable runtime measurement exercises the final optimization and timing output; baseline failure and head success were not demonstrated.
Agent review details

How this fits together

The SQLite broker sends typed storage requests and admission snapshots to workers, then receives results and publishes completion diagnostics.

flowchart LR
  A[Storage caller] --> B[SQLite broker]
  B --> C[Admission registry]
  B --> D[SQLite worker]
  D --> E[Storage backend]
  E --> D
  D --> B
  B --> F[Request diagnostics]
Loading

Technical review

Best possible solution:

Retain the existing admission owner and shared validity checks while eliminating empty publication work and exposing bounded diagnostic timestamps.

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

Current main unconditionally publishes on install([]), which advances the registry revision and rebuilds worker environment data; this was verified from source without executing target code.

Is this the best way to solve the issue?

The early return fixes redundant work at its existing owner, and timing extends the established diagnostics path without changing scheduling or settlement.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Admission installation and cleanup changes intended behavior with a stated reason (19eddcf: Retire closed-database metadata so new workers do not inherit accumulated schema and write metadata.)
  • Worker request diagnostics keeps the original intent (11d3d04: Separate queue wait from dispatch-to-completion wall time using bounded request families; the new timestamps preserve those duration meanings.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 19eddcf adds src/infra/sqlite-database-admission-record.ts:318 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 19eddcf75194; files: src/infra/sqlite-database-admission-record.ts)

PR surface

Source +65, Tests +48, Docs +16. Total +129 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 70 5 +65
Tests 2 48 0 +48
Docs 1 27 11 +16
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 145 16 +129

Review metrics

Metric Value Why it matters
Diagnostic surface 1 startup-sampled flag; 10 optional timestamp fields Uses the existing diagnostics environment variable and event transport without introducing persisted configuration or a public storage API.

Labels

Label changes:

  • add P2: A focused SQLite bookkeeping performance improvement with diagnostic value and no demonstrated urgent user-facing regression.
  • 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:

  • P2: A focused SQLite bookkeeping performance improvement with diagnostic value and no demonstrated urgent user-facing regression.
  • 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.

  • Add the planned comparable workload measurements and a redacted completed-request timing trace.

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 12, 2026, 5:00 PM ET / 21:00 UTC.

@steipete
steipete merged commit 006e965 into main Oct 12, 2026
137 of 144 checks passed
@steipete
steipete deleted the dbasync/workerrtt branch October 12, 2026 22:39
steipete added a commit that referenced this pull request Oct 12, 2026
## What Problem This Solves

A first database open can fail during temporary schema contention because the worker's schema-prepare exchange records the pending condition as a terminal refusal before the existing cold-open retry owner can handle it.

## User Impact

Cold database opens can wait within their existing deadline for schema preparation to finish. Non-initial opens, companion databases, held schema leases, revoked authority, and ordinary transaction refusals remain terminal. No DDL, schema version, stored-row format, configuration, permission, or retention change is introduced.

## Why This Change Was Made

Preserve the pending result across both sides of the existing port exchange before a schema lease or mutation body begins. The existing cold-open owner supplies the retry and deadline; this adds no owner, handshake, timeout, or write replay. The real-port regression covers retry, exhaustion, revocation, path boundaries, and held leases. No authority check is removed.

Candidate `2af1dd0ac7cab0cfaecfb49c6eeb176c40b006e0` changes two files (+161/−70). Its delta matches the isolated Codex-reviewed patch and preserves main's private receipt simplification. Main `6315f8adc18ab275a4c933c497113a65bc3f783b` still has the exact preimages of both changed files, so there is no source overlap at that pin. The separate broker repair is excluded.

## Evidence

Scoped qualification is complete. The exact-candidate update cell passed; skipped or historical jobs remain labeled according to their actual scope.

| Boundary | Result and scope |
| --- | --- |
| Current static qualification | [Run 38315479055](https://github.com/openclaw/openclaw/actions/runs/38315479055), exact candidate: production/test types, all selected lint, source contracts, boundaries, baseline ratchets, and architecture passed. Madge reported zero cycles and Kysely guardrails passed. The run completed with 51 successful, eight failed, and 25 skipped jobs. Build-artifacts and published-driver update explicitly skipped. |
| Current Knip | Job 115031514632 failed its full-tree unused-file scan on the two Control UI benchmark files described below. Production/export scans completed; production unused-file scan passed with zero entries. The inherited failure is repaired by landed #170347 (`0d1e09b7913219091baae888feb7fcdec2b06d2c`): selected-head run 38318772519 executed `deadcode:full` with all five file/export groups at zero, Madge at zero cycles, and applicable static gates passing. This does not change the failed candidate job into a pass. |
| Cold-admission regression | All 13 cases, including eight schema cases, passed in [job 114956450854](https://github.com/openclaw/openclaw/actions/runs/38292637049/job/114956450854) on a prior composition with identical changed-source blobs. That job was red on four usage-cache fixture assertions. Bounded source/input review qualifies this retained pass for the admission change; no exact-candidate execution is claimed. |
| Operation-admission sibling | 26/26 passed in [job 115001073266](https://github.com/openclaw/openclaw/actions/runs/38306200884/job/115001073266), on a prior composition with identical owner and test blobs; bounded source/input review qualifies this focused reuse, not exact-candidate execution. |
| Node-host config sibling | `pnpm test src/node-host/config.test.ts --maxWorkers=1`: 13/13 on composition `7ac691f4a04689c9711192262ad0bc3c73b6ad92`, 175.41 s runner / 606.8 s wrapper. This included the separate broker repair and does not isolate either repair's effect. |
| Required update cell | [Job 115046869851](https://github.com/openclaw/openclaw/actions/runs/38316114387/job/115046869851) passed on verified candidate `2af1dd0ac7cab0cfaecfb49c6eeb176c40b006e0`: published 2026.10.2 → candidate 2026.10.2, readiness 200, running version verified, and durable/incognito before-and-after stages all exited zero. One attempt, 658 seconds; lane and service cleanup completed. |

The focused reuse compares complete owners/tests and 63 source/config/package inputs. Infra runner/setup inputs and test-loader versions match. Identified drift consists of credential cleanup, opt-in lock-diagnostic removal, lifecycle drain classification, unused Postgres/actor-maintenance paths, a TypeBox bump outside the imported standalone normalization helpers, and a PostCSS patch outside these stylesheet-free tests. The operation sibling calls unchanged settlement directly, not the changed actor dispatch path. These changes do not alter the focused admission/receipt behavior being asserted.

The preceding cached-main audit at `b68c44ca8f3ca9d0d4bccb7b620f867547e4cd55` found 60 of the 63 retained inputs unchanged since the previous audit. The three changed inputs come from #170235: optional worker timing in broker request/reply functions, its type-only contract fields, and an early return for empty registry installs. The retained tests call admission and settlement directly, outside the changed broker functions. Schema cases do not install registry payloads; creation cases do not depend on an empty install publishing a revision or cleaning unrelated retired records, and new descriptor creation still publishes its facts. The two-file patch retains the same reviewed patch ID. Additional lockfile drift adds only Control UI dependencies, and workflow drift selects WebKit for another UI suite. This supports the same bounded reuse; it does not qualify general registry housekeeping, worker timing, or the merged runtime.

The preceding source audit pinned `0d1e09b7913219091baae888feb7fcdec2b06d2c`, after #169622 and the Knip repair. All 63 retained inputs are unchanged since the preceding audit. The #169622 session/authority contract changes do not enter the two focused tests: cold cases construct the admission owner and real port directly, while the operation sibling uses native in-memory transactions and direct settlement. A supporting static-relative import census found no #169622 changes among 133 cold-test modules, 213 operation-test modules, or 25 shared-setup modules. Its only intersections in the 47-module infra-config census are two lists selecting other tests; neither focused file’s selection or isolation changes. The unchanged owners and actual call paths preserve the bounded 13/13 and 26/26 reuse; #169622 does not itself require integration or fresh execution for those assertions. This is not a complete dynamic import graph and does not qualify its session/authority integration, the broader Gateway, or an installed update. The separate exact-candidate update pass above supplies installed-update evidence at its selected SHA.

The final source pin is `6315f8adc18ab275a4c933c497113a65bc3f783b`. Both candidate-file preimages and all 63 retained inputs are unchanged from the preceding audit, including the intermediate `a00f582` check. The direct admission/port and transaction/settlement boundaries preserve the same bounded focused-test reuse. The candidate imports/exports are unchanged, so this repair needs no fresh graph qualification. The passing update cell qualifies the unchanged candidate package; it is not represented as execution of this later main or a merged tree.

The prior published-driver cell [job 115009067830](https://github.com/openclaw/openclaw/actions/runs/38306200884/job/115009067830) passed published 2026.10.2 → candidate 2026.10.2 with readiness 200 and running-version verification. It is historical coverage only: dependencies and update/Doctor/state-migration owners have changed since that composition. The subsequent composition omitted this patch and supplies no cold-schema update proof.

The red tests are classified separately against completed scheduled-main run [38311154418](https://github.com/openclaw/openclaw/actions/runs/38311154418), head `11a12460482f7790aca049243de04cb9193e87c2`:

- Four `session-cost-usage-cache.creation-race.test.ts` cases match historical main's offline-maintenance error instead of the expected creation/schema-refresh refusal. Current main contains fixture fix `a919b2151d5f6487689d5dd032032a9280231e71`, which explicitly prepares shared storage while keeping the competing agent database cold; its exact postimage is verified. No new runtime pass is claimed by this source audit.
- Seventeen `board-progress.write-admission.test.ts` cases match historical main's unprepared user-profile catalog, followed by retirement and recursive instrumentation errors. Node/Bun stack formatting differs; the named cases and primary error match. Current main’s #169622 fixture prepares the role schema/catalog and restores instrumentation even when a request rejects; no new executed pass is claimed here.
- The default-store rotation case in `session-accessor.test.ts` matches main's expected `session-rebound` / received `undefined` failure. Main already contains fixture fix `be7696c5e9bca74537156e5dc326fb71ca81aa02`; the candidate contains its exact preimage.
- Seven `users-preferences.test.ts` cases fail before dispatch because runtime config is unprepared. Their fixtures are already corrected on main by `7e596d5128cc1f678a8463cc9e39d6b27fd179e3`. This is source-verified fixture debt; no executed scheduled-main signature was located or claimed.
- Knip reports `scripts/bench-control-ui-cold-load.ts` and `ui/src/test-helpers/control-ui-cold-load-probes.ts`. The flagged files, all-exports config and scan driver remain unchanged; current main’s root Knip config now includes the missing executable entry. Commit `5559404e2da9eb32abe8bbfd74f159d605630f57` introduced the documented path-invoked benchmark without a Knip root; it imports the flagged helper. The separate Knip repair also registers the path-invoked Linux onboarding Vite fixture. Its exact-head manual run 38318772519 passed the full dead-code scan, Madge and applicable statics, and the repair is merged. The inherited static failure is resolved by that landed fix. This is a real static failure, not infrastructure.

The exact-candidate real-Gateway job also timed out in `background-work.real-gateway.e2e.test.ts`, while 16 other cases passed. The candidate contains the exact two-file preimage of main fix `9b54cd97281693edf641d320a7a6a9a44d6e2820`: its observer omits `chat.startup`, which appears successful in the timeout diagnostics. This is a known, already-fixed observer defect; the compact log does not prove it was the sole cause of the timeout. The 14 failures in `media-generate-background-retention.test.ts` are source-attributed to the older runtime-config fixture, already repaired on main by `4944a6df77080f328fed59ee22384e3ee45d522f`. The candidate writes config without preparing its runtime snapshot: admission returns null before requester lookup in eight cases, and six late-revocation cases wait for a requester-read spy that is never reached. The existing fix prepares the snapshot after all four fixture writes, without weakening assertions; #169622 now sets that fixture snapshot directly. Both production media owners remain unchanged. The session-accessor and users-preferences fixtures also gained explicit early snapshot preparation in #169622; their earlier failures remain historical evidence, not current-main failures or passes. This is historical fixture debt, not infrastructure. The hidden config exception is not printed in this job, and no pass on the repaired version is claimed.

One isolated Codex review completed with no actionable P0–P2 findings; the reviewed delta is unchanged. Source formatting and diff checks passed. Direct basic oxlint reports `max-lines` at 711 > 700; the repository's native CI lint policy makes that rule advisory, and current core lint passed. The raw basic lint command is not reported as passing.

This is a correctness repair, not a SQL-reduction change. It adds no SQL call or public SDK surface. No numeric statement/request or main-thread T1 reduction, standalone cold-file wall time, aggregate green CI result, or exact-head `check:changed` pass is claimed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…ing (openclaw#170235)

Avoid rebuilding and republishing the SQLite admission registry when a worker exchange has no new facts. Keep shared revocation, actual publication, FIFO execution, error propagation, and native write settlement unchanged.

Expose optional sqlite.worker-timing stages for worker round-trip diagnosis without payload content. Quiet-host microbenchmark overhead p50/p95 improves from 0.1005/0.3412 ms to 0.0946/0.2828 ms; warmed workload remains 201 statements and 45 requests with zero MAIN statements. The turn-latency target is not established by the variable paired measurements.

Empty exchanges may retain retired metadata until a real publication or full capture; revoked facts remain invalid immediately. Changed-owner tests, types, lint/contracts, Madge and database ratchets pass. Land under the authorized inherited-failure exception for matching main config/collector/cron failures and three unrelated Knip exports. Full attribution and measurement tables are in the PR.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
## What Problem This Solves

A first database open can fail during temporary schema contention because the worker's schema-prepare exchange records the pending condition as a terminal refusal before the existing cold-open retry owner can handle it.

## User Impact

Cold database opens can wait within their existing deadline for schema preparation to finish. Non-initial opens, companion databases, held schema leases, revoked authority, and ordinary transaction refusals remain terminal. No DDL, schema version, stored-row format, configuration, permission, or retention change is introduced.

## Why This Change Was Made

Preserve the pending result across both sides of the existing port exchange before a schema lease or mutation body begins. The existing cold-open owner supplies the retry and deadline; this adds no owner, handshake, timeout, or write replay. The real-port regression covers retry, exhaustion, revocation, path boundaries, and held leases. No authority check is removed.

Candidate `2af1dd0ac7cab0cfaecfb49c6eeb176c40b006e0` changes two files (+161/−70). Its delta matches the isolated Codex-reviewed patch and preserves main's private receipt simplification. Main `feb893ca13908081c27230530cc88c59ac7c0158` still has the exact preimages of both changed files, so there is no source overlap at that pin. The separate broker repair is excluded.

## Evidence

Scoped qualification is complete. The exact-candidate update cell passed; skipped or historical jobs remain labeled according to their actual scope.

| Boundary | Result and scope |
| --- | --- |
| Current static qualification | [Run 38315479055](https://github.com/openclaw/openclaw/actions/runs/38315479055), exact candidate: production/test types, all selected lint, source contracts, boundaries, baseline ratchets, and architecture passed. Madge reported zero cycles and Kysely guardrails passed. The run completed with 51 successful, eight failed, and 25 skipped jobs. Build-artifacts and published-driver update explicitly skipped. |
| Current Knip | Job 115031514632 failed its full-tree unused-file scan on the two Control UI benchmark files described below. Production/export scans completed; production unused-file scan passed with zero entries. The inherited failure is repaired by landed openclaw#170347 (`73611b92e96a103e7ecd4260dd2583150f90a1cd`): selected-head run 38318772519 executed `deadcode:full` with all five file/export groups at zero, Madge at zero cycles, and applicable static gates passing. This does not change the failed candidate job into a pass. |
| Cold-admission regression | All 13 cases, including eight schema cases, passed in [job 114956450854](https://github.com/openclaw/openclaw/actions/runs/38292637049/job/114956450854) on a prior composition with identical changed-source blobs. That job was red on four usage-cache fixture assertions. Bounded source/input review qualifies this retained pass for the admission change; no exact-candidate execution is claimed. |
| Operation-admission sibling | 26/26 passed in [job 115001073266](https://github.com/openclaw/openclaw/actions/runs/38306200884/job/115001073266), on a prior composition with identical owner and test blobs; bounded source/input review qualifies this focused reuse, not exact-candidate execution. |
| Node-host config sibling | `pnpm test src/node-host/config.test.ts --maxWorkers=1`: 13/13 on composition `7ac691f4a04689c9711192262ad0bc3c73b6ad92`, 175.41 s runner / 606.8 s wrapper. This included the separate broker repair and does not isolate either repair's effect. |
| Required update cell | [Job 115046869851](https://github.com/openclaw/openclaw/actions/runs/38316114387/job/115046869851) passed on verified candidate `2af1dd0ac7cab0cfaecfb49c6eeb176c40b006e0`: published 2026.10.2 → candidate 2026.10.2, readiness 200, running version verified, and durable/incognito before-and-after stages all exited zero. One attempt, 658 seconds; lane and service cleanup completed. |

The focused reuse compares complete owners/tests and 63 source/config/package inputs. Infra runner/setup inputs and test-loader versions match. Identified drift consists of credential cleanup, opt-in lock-diagnostic removal, lifecycle drain classification, unused Postgres/actor-maintenance paths, a TypeBox bump outside the imported standalone normalization helpers, and a PostCSS patch outside these stylesheet-free tests. The operation sibling calls unchanged settlement directly, not the changed actor dispatch path. These changes do not alter the focused admission/receipt behavior being asserted.

The preceding cached-main audit at `2be43c633c855851ffd8f6f8e3cba47038d2b9fb` found 60 of the 63 retained inputs unchanged since the previous audit. The three changed inputs come from openclaw#170235: optional worker timing in broker request/reply functions, its type-only contract fields, and an early return for empty registry installs. The retained tests call admission and settlement directly, outside the changed broker functions. Schema cases do not install registry payloads; creation cases do not depend on an empty install publishing a revision or cleaning unrelated retired records, and new descriptor creation still publishes its facts. The two-file patch retains the same reviewed patch ID. Additional lockfile drift adds only Control UI dependencies, and workflow drift selects WebKit for another UI suite. This supports the same bounded reuse; it does not qualify general registry housekeeping, worker timing, or the merged runtime.

The preceding source audit pinned `73611b92e96a103e7ecd4260dd2583150f90a1cd`, after openclaw#169622 and the Knip repair. All 63 retained inputs are unchanged since the preceding audit. The openclaw#169622 session/authority contract changes do not enter the two focused tests: cold cases construct the admission owner and real port directly, while the operation sibling uses native in-memory transactions and direct settlement. A supporting static-relative import census found no openclaw#169622 changes among 133 cold-test modules, 213 operation-test modules, or 25 shared-setup modules. Its only intersections in the 47-module infra-config census are two lists selecting other tests; neither focused file’s selection or isolation changes. The unchanged owners and actual call paths preserve the bounded 13/13 and 26/26 reuse; openclaw#169622 does not itself require integration or fresh execution for those assertions. This is not a complete dynamic import graph and does not qualify its session/authority integration, the broader Gateway, or an installed update. The separate exact-candidate update pass above supplies installed-update evidence at its selected SHA.

The final source pin is `feb893ca13908081c27230530cc88c59ac7c0158`. Both candidate-file preimages and all 63 retained inputs are unchanged from the preceding audit, including the intermediate `01bf2a7` check. The direct admission/port and transaction/settlement boundaries preserve the same bounded focused-test reuse. The candidate imports/exports are unchanged, so this repair needs no fresh graph qualification. The passing update cell qualifies the unchanged candidate package; it is not represented as execution of this later main or a merged tree.

The prior published-driver cell [job 115009067830](https://github.com/openclaw/openclaw/actions/runs/38306200884/job/115009067830) passed published 2026.10.2 → candidate 2026.10.2 with readiness 200 and running-version verification. It is historical coverage only: dependencies and update/Doctor/state-migration owners have changed since that composition. The subsequent composition omitted this patch and supplies no cold-schema update proof.

The red tests are classified separately against completed scheduled-main run [38311154418](https://github.com/openclaw/openclaw/actions/runs/38311154418), head `60e5d43fa25737d62aa6ac7bdb7a11f9d936bdcb`:

- Four `session-cost-usage-cache.creation-race.test.ts` cases match historical main's offline-maintenance error instead of the expected creation/schema-refresh refusal. Current main contains fixture fix `b506924d58fc9447ab35a821c2029f0c8e110cbf`, which explicitly prepares shared storage while keeping the competing agent database cold; its exact postimage is verified. No new runtime pass is claimed by this source audit.
- Seventeen `board-progress.write-admission.test.ts` cases match historical main's unprepared user-profile catalog, followed by retirement and recursive instrumentation errors. Node/Bun stack formatting differs; the named cases and primary error match. Current main’s openclaw#169622 fixture prepares the role schema/catalog and restores instrumentation even when a request rejects; no new executed pass is claimed here.
- The default-store rotation case in `session-accessor.test.ts` matches main's expected `session-rebound` / received `undefined` failure. Main already contains fixture fix `5e848de8695e9e8a93ac431447c11de2ffb02a6b`; the candidate contains its exact preimage.
- Seven `users-preferences.test.ts` cases fail before dispatch because runtime config is unprepared. Their fixtures are already corrected on main by `95f8e973c07b5984c2760dcc3429cfae9a26ae86`. This is source-verified fixture debt; no executed scheduled-main signature was located or claimed.
- Knip reports `scripts/bench-control-ui-cold-load.ts` and `ui/src/test-helpers/control-ui-cold-load-probes.ts`. The flagged files, all-exports config and scan driver remain unchanged; current main’s root Knip config now includes the missing executable entry. Commit `e35494d3fdfc92cedccd7273910de78b28571aa2` introduced the documented path-invoked benchmark without a Knip root; it imports the flagged helper. The separate Knip repair also registers the path-invoked Linux onboarding Vite fixture. Its exact-head manual run 38318772519 passed the full dead-code scan, Madge and applicable statics, and the repair is merged. The inherited static failure is resolved by that landed fix. This is a real static failure, not infrastructure.

The exact-candidate real-Gateway job also timed out in `background-work.real-gateway.e2e.test.ts`, while 16 other cases passed. The candidate contains the exact two-file preimage of main fix `3dcebb24ab46297acdf43ca08acf2c715f8b277d`: its observer omits `chat.startup`, which appears successful in the timeout diagnostics. This is a known, already-fixed observer defect; the compact log does not prove it was the sole cause of the timeout. The 14 failures in `media-generate-background-retention.test.ts` are source-attributed to the older runtime-config fixture, already repaired on main by `8f447c5e83cb39fd74840eace70034c8ad1c3dd6`. The candidate writes config without preparing its runtime snapshot: admission returns null before requester lookup in eight cases, and six late-revocation cases wait for a requester-read spy that is never reached. The existing fix prepares the snapshot after all four fixture writes, without weakening assertions; openclaw#169622 now sets that fixture snapshot directly. Both production media owners remain unchanged. The session-accessor and users-preferences fixtures also gained explicit early snapshot preparation in openclaw#169622; their earlier failures remain historical evidence, not current-main failures or passes. This is historical fixture debt, not infrastructure. The hidden config exception is not printed in this job, and no pass on the repaired version is claimed.

One isolated Codex review completed with no actionable P0–P2 findings; the reviewed delta is unchanged. Source formatting and diff checks passed. Direct basic oxlint reports `max-lines` at 711 > 700; the repository's native CI lint policy makes that rule advisory, and current core lint passed. The raw basic lint command is not reported as passing.

This is a correctness repair, not a SQL-reduction change. It adds no SQL call or public SDK surface. No numeric statement/request or main-thread T1 reduction, standalone cold-file wall time, aggregate green CI result, or exact-head `check:changed` pass is claimed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant