Repository navigation
perf(gateway): serve per-turn placement reads from the placement read projection - #164744
Conversation
Refresh freshness at read admission and after BEGIN while reusing handle-owned facts for runtime schema checks. Validate canonical triggers before exposing agent readers and classify shared-state failures only after failed admission. Focused runtime checks execute zero SQL statements, versus 30 with the baseline owner. Preserve foreign-commit and snapshot semantics. Full workload measurement and remote integration checks remain merge preconditions after remote runner and fleet-capacity admission failed.
Integrate the pinned measurement baseline and retain main-key facts through the existing connection and reader-admission owners. Preserve raw writes, foreign commits, transaction snapshots, authorizers, and continuation authority.
Use the existing worker generation claim for maintenance metadata instead of retaining a host read handle. Keep both live ownership checks around the required transaction-entry freshness probe. Consolidate shared-state cache initialization, refresh, and terminal failures in its admission sibling and update the compiled-wrapper inventory. This keeps the cache within the existing module-size limit without changing stored schema or quarantine semantics. Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof passed. Independent Codex review is clean through P2. Full landing validation remains required before merge.
Refresh canonical readiness when it consumes schema facts. Retention only holds native lifetime, so cold restore and other worker handoffs no longer execute host SQLite before dispatch. Protect foreign schema invalidation at the warm readiness fast path. Tighten retained-reader budgets to the optimized counts, and require early missing-table diagnosis before callbacks while preserving handle-cleanup assertions. Validation: 93 focused tests, production types, state/config test types, and independent review clean through P2.
Integrate the released-SDK diff tooling fix and the inherited child-coordination fixture correction. The merge preserves every authored source, test, and documentation blob; the wrapper inventory combines both branches.
Include main's failed-placement publication fix after the paired-node lifecycle CI failure. Authored schemafacts source, tests, and documentation remain byte-identical to the reviewed head; the wrapper inventory includes current main dependencies.
… projection Prepare restart admission, runtime defaults, and initial turn routing through the existing placement reader and current observations. Recheck caller, session, service, and placement authority after asynchronous preparation; keep claim and recovery writers authoritative. Retain the released synchronous placement reader contract. No schema, retention, durability, or update changes.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 7:56 AM ET / 11:56 UTC (Revision 15). ClawSweeper reviewWhat this changesMoves per-turn placement reads for chat admission, reply recovery, runtime selection, and initial turn routing into the existing database-worker projection while preserving execution guards. Merge readiness✅ Ready for maintainer review The PR remains useful and has no actionable introduced defect found. The updated, source-qualified integration evidence resolves the previous review’s blocker; current main does not contain this read-side cutover. Priority: P2 Review scores
Verification
How this fits togetherPlacement determines whether a session runs locally or on a worker. Chat and agent admission consume placement facts, then the existing claim owners authorize execution and preserve pending input and recovery custody. flowchart TD
A[Chat or agent turn] --> B[Placement read preparation]
C[Existing SQLite worker] --> B
B --> D[Current session and caller checks]
D --> E[Authoritative turn claim]
E --> F[Local or worker execution]
D --> G[Reject stale work]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +107, Tests +499, Docs +10. Total +616 across 18 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep placement reads in the existing worker projection, with live claim authorization and the released synchronous reader contract preserved. Do we have a high-confidence way to reproduce the issue? Not applicable to a reported product bug; source establishes the synchronous-read migration, and the captured runtime comparison measures its selected-path SQL reduction. No target code was executed during this read-only review. Is this the best way to solve the issue? Yes. Reusing the existing projection and retaining authoritative claim writers is a focused approach that avoids another cache or storage owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec583a242659. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
The worker-backed session reader introduced in #164779 made the queue-only fixture enter durable writer admission from its threads lane. Declare its synthetic sessions detached, preserving session identities and all queue, placement, and lifecycle assertions. Found during #164744 validation and independently reproduced on main with three capacity-wait timeouts and host-owner admission errors. Validation: queue liveness 20/20, durable writer claims 6/6, formatting, and P2 review pass. Production guards and test deadlines are unchanged.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
b2b434a (#164744) made runtime preference selection retain a revocable placement observation. Completing setup or publishing the preceding turn could invalidate that read and reject an already accepted input before it launched. Read the preference from the current worker projection while retaining identity checks and the existing execution claim and authority guards. Cover setup completion during the read. Join each held run's terminal outcome in the real-Gateway test and preserve exactly-once assertions within the existing 30-second budget. Validation: controlled negative regression; initial-setup unit 18/18; Linux pressure with original shard neighbours: baseline 4/20 failures, candidate 20/20 passes. Owning Gateway unit config: 407 files and 6160 tests passed, with four existing skipped files and six skipped tests. Whole real-Gateway E2E config: 36 files and 66 tests passed. Canonical Gateway/UI build, three original shard replays (21 files / 47 tests each), check-changed, boundary lint, and independent P2 review passed.
The worker-backed session reader introduced in openclaw#164779 made the queue-only fixture enter durable writer admission from its threads lane. Declare its synthetic sessions detached, preserving session identities and all queue, placement, and lifecycle assertions. Found during openclaw#164744 validation and independently reproduced on main with three capacity-wait timeouts and host-owner admission errors. Validation: queue liveness 20/20, durable writer claims 6/6, formatting, and P2 review pass. Production guards and test deadlines are unchanged.
… projection (openclaw#164744) * perf(state): carry admitted schema facts with database handles Refresh freshness at read admission and after BEGIN while reusing handle-owned facts for runtime schema checks. Validate canonical triggers before exposing agent readers and classify shared-state failures only after failed admission. Focused runtime checks execute zero SQL statements, versus 30 with the baseline owner. Preserve foreign-commit and snapshot semantics. Full workload measurement and remote integration checks remain merge preconditions after remote runner and fleet-capacity admission failed. * fix(state): preserve worker handoffs during schema admission Use the existing worker generation claim for maintenance metadata instead of retaining a host read handle. Keep both live ownership checks around the required transaction-entry freshness probe. Consolidate shared-state cache initialization, refresh, and terminal failures in its admission sibling and update the compiled-wrapper inventory. This keeps the cache within the existing module-size limit without changing stored schema or quarantine semantics. Focused maintenance, ownership, schema, worker, wrapper, and quarantine proof passed. Independent Codex review is clean through P2. Full landing validation remains required before merge. * fix(state): keep retained handles free of schema probes Refresh canonical readiness when it consumes schema facts. Retention only holds native lifetime, so cold restore and other worker handoffs no longer execute host SQLite before dispatch. Protect foreign schema invalidation at the warm readiness fast path. Tighten retained-reader budgets to the optimized counts, and require early missing-table diagnosis before callbacks while preserving handle-cleanup assertions. Validation: 93 focused tests, production types, state/config test types, and independent review clean through P2. * perf(gateway): serve per-turn placement reads from the placement read projection Prepare restart admission, runtime defaults, and initial turn routing through the existing placement reader and current observations. Recheck caller, session, service, and placement authority after asynchronous preparation; keep claim and recovery writers authoritative. Retain the released synchronous placement reader contract. No schema, retention, durability, or update changes. * test(gateway): synchronize initial placement setup fence * test(gateway): await setup admission with cancellation-safe gates
69b812d (openclaw#164744) made runtime preference selection retain a revocable placement observation. Completing setup or publishing the preceding turn could invalidate that read and reject an already accepted input before it launched. Read the preference from the current worker projection while retaining identity checks and the existing execution claim and authority guards. Cover setup completion during the read. Join each held run's terminal outcome in the real-Gateway test and preserve exactly-once assertions within the existing 30-second budget. Validation: controlled negative regression; initial-setup unit 18/18; Linux pressure with original shard neighbours: baseline 4/20 failures, candidate 20/20 passes. Owning Gateway unit config: 407 files and 6160 tests passed, with four existing skipped files and six skipped tests. Whole real-Gateway E2E config: 36 files and 66 tests passed. Canonical Gateway/UI build, three original shard replays (21 files / 47 tests each), check-changed, boundary lint, and independent P2 review passed.
…ply text (wave-4 bundle) (#172669) * refactor(infra): remove redundant replay and freshness machinery Trust successful migration statements inside their synchronous transactions, reuse unchanged approval parses, share canonical package-root discovery, namespace directory caches by plugin identity, and simplify ephemeral presence, OS facts and suspension timer bookkeeping. Keep source validation, conflicts, transaction durability, postcommit checks, security authority and write settlement. Best-effort tradeoffs accepted - Node-host own-write verification (#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain. - Workspace setup/attestation replay (#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks. - APNs expected-ID replay (#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain. - Device-auth presence assertion (#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain. - Device-identity replay (#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion. - MCP OAuth replay (#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain. - Exec-approval read/parse/deep-compare replay (#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged. - Shared-auth target reread (#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks. - Identical authored approval bytes (#168094) reuse the existing parse; changed normalized bytes still parse before publication. - Plugin metadata fingerprinting (353d778): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset. - Duplicate asset ancestor search (7224585): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart. - Presence logical clock (#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain. - Suspension timer generation (#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early. - OS tuple-keyed cache (#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace. - Presence list type guards (409a160): callers supply validated arrays; existing normalization still owns their values. Production +40/-228, net -188. Focused migration, asset/cache, presence/caller, approval-publication and suspension/OS tests pass, as do production and infra-test types, changed-file lint, assertion and suppression checks, and zero-cycle checks. Independent final review has no actionable P0-P2 findings. No schema, durability, retention, indexing, permission, recovery or public SDK change is intended. Broad changed-check is not claimed green: the original base reproduces the 455-versus-454 environment budget failure. The initial Web Push Doctor timeout remains unattributed; all Web Push production hunks were dropped and its exact test passed on restored source. Full build and hosted CI remain unrun. * refactor(agents): simplify reply preparation and refresh bookkeeping Share typed actor-store adapters and prepared async auth reads. Reuse the admitted memory-flush plan, retain last-good catalog views by provider, and remove unused metadata bookkeeping and config projections. Preserve live credential/effect authority, FIFO, transcript durability, and ordinary write settlement. Net production reduction: 303 lines. Best-effort tradeoffs accepted: - Plugin-drain successors (#162301, synthetic): wait the current drain once; a later reload owns its own publication and recovery. - A changed memory-flush plan during preparation (#162177/#121157, synthetic): finish with the admitted plan; the next turn resolves again. - Per-row catalog freshness (#158113, synthetic): failed discovery retains the provider's last-good configured and supplemental overlays until success. Existing auth/profile/source gates and successful-empty replacement remain. - MCP sibling invalidation during discovery (#138694, synthetic): a listing may briefly be stale; the next read observes the invalidation. - Passive context metadata supersession (#119607, synthetic): late discovered metadata may win until refresh. Keep the single current-promise check before replacing configured limits, preserving the human capacity fix (#39857). - Registration-time question answers (#110372/#134003, synthetic): a prompt can briefly race the answer; its terminal signal closes delivery. - Duplicate or never-attached internal question registrations: both real producers attach once synchronously. Unsupported misuse loses its extra diagnostic/disposal wakeup; ordinary lifecycle rejection remains. - Cancellation publication once/must-consume flags (#161124, synthetic): the sole internal producer invokes once. Keep active-scope/effect authority. - In-flight placement-service replacement (#164744, synthetic): use the captured startup service, with its observation and writer authority intact. - Compaction callback rebinding (#146732/#163264, synthetic): current work retains its captured callbacks and live assertion; later work captures anew. - Re-entrant logging between synchronous run-owner checks: #162227 removed the awaited retry, making the second check redundant. Real post-await and mutation-effect checks remain. - Startup diagnostic admission (#146792): the sole producer checks lifecycle immediately before recording. Remove only the recorder's duplicate check; preserve the human abort/recovery fix (#146692), reset, and admin redaction. Release-note context: verbose diagnostics no longer include suppressed reply text or background bash command contents. Execution and user replies remain unchanged. Config show uses the same schema-aware redactor without cloning an already detached result or redacting unused snapshot views. Validation: touched core, messaging and Gateway-method type graphs passed; 49 changed TypeScript files passed targeted lint/format; runtime and Madge cycles are both zero. Auth reader, question authority, memory flush, restart claim, catalog worker, cancellation and compaction boundary proof is recorded in the lane ledger. Final supplemental run: 392 tests passed, four failed across 28 files, with final source verification. All 120 agents-support tests passed, including refresh coalescing, publication, run-wait and compaction. The four failures were an unchanged 120s ACP reset deadline and three MCP fixtures settling before child startup markers (empty logs, existing 1-2s connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset and two MCP cases; the one-second MCP retirement fixture still failed before its first child marker. Clean lane-base comparison could not reach assertions: the temporary checkout lacked workspace-local dependency links for worker compilation. That case is unresolved, not proven inherited; coordinator-bundle CI must adjudicate it. No deadline, retry, skip or assertion was weakened. The final selected real-dispatch suppressed-reply logging regression passed with completed source verification (one selected case, 202.58s wrapper). Independent P0-P2 review completed four passes. Declined duplicate findings about unsupported placement-service hot-swap (real observation/database/writer authority remains) and alleged run-wait awaits (only synchronous logging lies between the checks; real mutation and post-await checks remain). Broad check-changed is NOT green: env-name budget 455/454 also fails on the unchanged lane-base index, with no added env names; production/full-tree Knip hit their existing 600s budget; the silent legacy-store scan was interrupted after 782s. Those two scans are missing proof, not attributed inherited reds. Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy fixture findings were corrected and their targeted replays pass. No changelog, dependency, database schema, durability, retention, permission, or public API change is included. BELOW-500 branch-only coordinator handoff; no lane PR or merge. * chore: shrink stale reply assertion allowance * test: align catalog publication calls with current contract
…ply text (wave-4 bundle) (openclaw#172669) * refactor(infra): remove redundant replay and freshness machinery Trust successful migration statements inside their synchronous transactions, reuse unchanged approval parses, share canonical package-root discovery, namespace directory caches by plugin identity, and simplify ephemeral presence, OS facts and suspension timer bookkeeping. Keep source validation, conflicts, transaction durability, postcommit checks, security authority and write settlement. Best-effort tradeoffs accepted - Node-host own-write verification (openclaw#108457): no human successful-SQL-loss report; SQL errors still roll back, and independent source retirement checks remain. - Workspace setup/attestation replay (openclaw#109147): no human driver-rewrite report; trust successful writes while retaining fingerprints and later source checks. - APNs expected-ID replay (openclaw#108543): no human silent-insert-loss report; canonical parsing, tombstones and receipts remain. - Device-auth presence assertion (openclaw#112663): no human successful-upsert-loss report; credential validation and transaction failure handling remain. - Device-identity replay (openclaw#110392): no human silent-row-rewrite report; preserve independent post-await verification before source deletion. - MCP OAuth replay (openclaw#161219): no human silent-write-loss report; canonical/source parsing and worker admission remain. - Exec-approval read/parse/deep-compare replay (openclaw#114063): no human successful-driver-rewrite report; malformed policy stays fail-closed and actual authority is unchanged. - Shared-auth target reread (openclaw#123349): no human silent-row-rewrite report; return the known SQL postimage and keep independent copy/flip/cleanup checks. - Identical authored approval bytes (openclaw#168094) reuse the existing parse; changed normalized bytes still parse before publication. - Plugin metadata fingerprinting (f31bc71): no human in-place metadata-mutation report; distinct objects remain isolated, and same-object edits use TTL/reset. - Duplicate asset ancestor search (40fb74f): no human cached-miss incident; canonical realpath/wrapper discovery remains, while newly appearing packages need owner invalidation/restart. - Presence logical clock (openclaw#134737): provenance is synthetic rollback/suspend tests; clock correction may temporarily retain or hide display rows until full update/reconnect, wall time catches up, or restart. TTL, capacity and connection privacy remain. - Suspension timer generation (openclaw#130003): the removed test directly called a canceled callback; native timer cancellation and current-entry authority remain. An out-of-contract timer implementation could resume a renewed lease early. - OS tuple-keyed cache (openclaw#135911): keep measured probe sharing and sticky labels; hot-patching OS identity needs restart rather than another namespace. - Presence list type guards (3965f6b): callers supply validated arrays; existing normalization still owns their values. Production +40/-228, net -188. Focused migration, asset/cache, presence/caller, approval-publication and suspension/OS tests pass, as do production and infra-test types, changed-file lint, assertion and suppression checks, and zero-cycle checks. Independent final review has no actionable P0-P2 findings. No schema, durability, retention, indexing, permission, recovery or public SDK change is intended. Broad changed-check is not claimed green: the original base reproduces the 455-versus-454 environment budget failure. The initial Web Push Doctor timeout remains unattributed; all Web Push production hunks were dropped and its exact test passed on restored source. Full build and hosted CI remain unrun. * refactor(agents): simplify reply preparation and refresh bookkeeping Share typed actor-store adapters and prepared async auth reads. Reuse the admitted memory-flush plan, retain last-good catalog views by provider, and remove unused metadata bookkeeping and config projections. Preserve live credential/effect authority, FIFO, transcript durability, and ordinary write settlement. Net production reduction: 303 lines. Best-effort tradeoffs accepted: - Plugin-drain successors (openclaw#162301, synthetic): wait the current drain once; a later reload owns its own publication and recovery. - A changed memory-flush plan during preparation (openclaw#162177/openclaw#121157, synthetic): finish with the admitted plan; the next turn resolves again. - Per-row catalog freshness (openclaw#158113, synthetic): failed discovery retains the provider's last-good configured and supplemental overlays until success. Existing auth/profile/source gates and successful-empty replacement remain. - MCP sibling invalidation during discovery (openclaw#138694, synthetic): a listing may briefly be stale; the next read observes the invalidation. - Passive context metadata supersession (openclaw#119607, synthetic): late discovered metadata may win until refresh. Keep the single current-promise check before replacing configured limits, preserving the human capacity fix (openclaw#39857). - Registration-time question answers (openclaw#110372/openclaw#134003, synthetic): a prompt can briefly race the answer; its terminal signal closes delivery. - Duplicate or never-attached internal question registrations: both real producers attach once synchronously. Unsupported misuse loses its extra diagnostic/disposal wakeup; ordinary lifecycle rejection remains. - Cancellation publication once/must-consume flags (openclaw#161124, synthetic): the sole internal producer invokes once. Keep active-scope/effect authority. - In-flight placement-service replacement (openclaw#164744, synthetic): use the captured startup service, with its observation and writer authority intact. - Compaction callback rebinding (openclaw#146732/openclaw#163264, synthetic): current work retains its captured callbacks and live assertion; later work captures anew. - Re-entrant logging between synchronous run-owner checks: openclaw#162227 removed the awaited retry, making the second check redundant. Real post-await and mutation-effect checks remain. - Startup diagnostic admission (openclaw#146792): the sole producer checks lifecycle immediately before recording. Remove only the recorder's duplicate check; preserve the human abort/recovery fix (openclaw#146692), reset, and admin redaction. Release-note context: verbose diagnostics no longer include suppressed reply text or background bash command contents. Execution and user replies remain unchanged. Config show uses the same schema-aware redactor without cloning an already detached result or redacting unused snapshot views. Validation: touched core, messaging and Gateway-method type graphs passed; 49 changed TypeScript files passed targeted lint/format; runtime and Madge cycles are both zero. Auth reader, question authority, memory flush, restart claim, catalog worker, cancellation and compaction boundary proof is recorded in the lane ledger. Final supplemental run: 392 tests passed, four failed across 28 files, with final source verification. All 120 agents-support tests passed, including refresh coalescing, publication, run-wait and compaction. The four failures were an unchanged 120s ACP reset deadline and three MCP fixtures settling before child startup markers (empty logs, existing 1-2s connection/4s catalog deadlines). Narrow failed-case replay passed ACP reset and two MCP cases; the one-second MCP retirement fixture still failed before its first child marker. Clean lane-base comparison could not reach assertions: the temporary checkout lacked workspace-local dependency links for worker compilation. That case is unresolved, not proven inherited; coordinator-bundle CI must adjudicate it. No deadline, retry, skip or assertion was weakened. The final selected real-dispatch suppressed-reply logging regression passed with completed source verification (one selected case, 202.58s wrapper). Independent P0-P2 review completed four passes. Declined duplicate findings about unsupported placement-service hot-swap (real observation/database/writer authority remains) and alleged run-wait awaits (only synchronous logging lies between the checks; real mutation and post-await checks remain). Broad check-changed is NOT green: env-name budget 455/454 also fails on the unchanged lane-base index, with no added env names; production/full-tree Knip hit their existing 600s budget; the silent legacy-store scan was interrupted after 782s. Those two scans are missing proof, not attributed inherited reds. Hosted coordinator-bundle CI remains the broad gate. Owned mock/type/legacy fixture findings were corrected and their targeted replays pass. No changelog, dependency, database schema, durability, retention, permission, or public API change is included. BELOW-500 branch-only coordinator handoff; no lane PR or merge. * chore: shrink stale reply assertion allowance * test: align catalog publication calls with current contract
What Problem This Solves
Per-turn chat admission, reply admission, runtime defaults, and initial turn routing still performed placement and ownership reads on the Gateway thread. This moves those selected readers to the existing placement worker projection while retaining the claim writers and live authority checks that authorize execution.
User Impact
This is an internal performance change with no intended user-visible behavior change. The original paired synthetic Gateway workload reduced the selected warm-path caller-thread SQL from 126 to 0 statements across ten turns. Placement authority, ACP input custody, restart recovery, cancellation, and worker setup remain fenced. No schema, persisted format, retention, durability, configuration, dependency, update behavior, or environment name changes are introduced.
Why This Change Was Made
prepareRuntimeRefreshreuses the existing projection, including conflict decoration. Callers retain physical-store observations, recheck session, lifecycle, provider, and placement authority after awaited preparation, then release observations infinally. Runtime selection is a prepared default; the existing claim owner still authorizes execution. All four selected runtime readers move together, without a second cache or storage owner.The branch integrates the merged schema-facts dependency #164490 (
c828f7ed1d560295f78166a98fb54687dc162b28) through merge commit9fc086e7d1383fba8ae095b5e36969c2f837e030, whose main parent is06d4475d6079aaa875a9b477ac0935d1459b1023. No rebase was used. Three conflicts preserve main's canonical ACP custody/restart behavior alongside placement observations and the prepared-runtime rejection fixture.The added asynchronous boundary exposed two setup fixtures that assumed the turn had entered a wait immediately after invocation or one
setImmediate(). Commits85d8d023fef302e05dbdd91a079015d6c7c1b4a7and3162133e670c168b6a89bb62116a9cfcf58f2c3dsynchronize them on the real wait-entry signal. Review also caught timeout cleanup that would not unwind a suspended gate; both fixtures now use the sharedwithinTesthelper and propagate Vitest's cancellation signal to the turn. Existing assertions and deadlines are preserved. Those two repair commits change only tests; later main integrations are qualified separately below.The final delta is 18 files: production +158 / −51 / net +107 across nine files, tests +555 / −56 / net +499 across eight files, and ten documentation lines. The production growth carries observation lifetimes and post-await checks; no new module or compiled-wrapper inventory entry is needed. Related work includes #162433, #164252, #164514, #164656, #122388, #156941, #162476, and the authorized
executeTurnoverlap #158903. This PR preserves their ownership boundaries and does not modify their branches.Main later caused a real import conflict; merge commit
ab3d642b04dfb2068bc2de7f447b5974e3054151integrated96c7ddc7e798a673bafd0dc4accaf318803d36fe, retaining both import/test intents and #164779's separate worker session-row read and post-await caller check. Its CI run 37194995047 exposed thirteen failures inchat.directive-tags.test.ts: the unchanged main fixture mocked the old reader, while main's finalizers had moved to the worker reader. The remaining non-successful jobs were fail-fast cancellations. Source tracing shows the synthetic session owner was bypassed; the fixture has no worker-placement service and does not reach this PR's new placement branch.Main's canonical test-only fix
6aefbb11f30aabb872e7fc379e4b97af7217903cnow routes both reader adapters through the existing fixture owner and preservesassertActive, assertions, and deadlines. Merge0aba32b4f12826c1c05f54c1bc9ba4b71026a143incorporates that fix without conflicts or rebasing. Five old-PR and five exact-main full-file comparison runs now reproduce the identical thirteen directive failures and 119 passes each. Repaired candidate0aba32b4passes all 132 cases in 63.943 command seconds. No duplicate production repair was added.Evidence
Final reviewed head:
fd262173a432b056aee129561ad2dd1bfc12370a. Evidence below retains each run’s actual source identity and bounds reused results to the inspected unchanged inputs.fd262173, including openclaw/ci-gate. All 79 jobs settled; there were no failed or pending checks. Core/extension lint, changed lint, production types, and test-type checks passed, closing the earlier 900-second local lint-timeout gap. No PR CI rerun or admin exception was used. Prior successful run 37190960480 remains evidence only for its3162133ehead.835a48f4is scoped-clean. The accepted cancellation-cleanup finding was corrected and re-reviewed. ClawSweeper completed exact headfd262173at 11:34:21 UTC with no actionable code or security findings. Its request to record final integration qualification is satisfied by the source-qualified results below.3162133epassed 18 affected cases (17 initial-setup cases and the detached writer-fence case; sixteen unaffected cases filtered), command wall 289.69 seconds.v2026.9.8completed exit 0 for exact headfd262173, digest0a116c0d; the report and evidence JSON match. Its cumulative release-to-main delta contains eight removed and one added entrypoint and 2338 affected exports, not lane-only API changes. Tagged source/export/runtime tracing confirms the changed selector/provider and restart-admission functions are internal; releasedgetMany(readonly string[]): ReadonlyMapremains synchronous. Compared with the preceding0aba32b4report, no direct declaration changed; 127 closure hashes reflect inherited main wildcard sections. The report’s broad wildcard declaration sections do not establish callable SDK exposure. No compatibility shim or deprecation record is needed for this lane.Placement, recovery, and import boundaries
Standard Testbox run 37189260747 passed all 123 focused tests on production head
9fc086e7, tree8b7e5bef0d6d323f8109322b8fef2a8ed5bda64f. This is retained earlier-head evidence. Main subsequently changed the launcher and chat-pending integration and shared database lifecycle; affected launcher, detached-context, and import boundaries now have fresh final-head execution; unchanged immediate owners retain their earlier scoped proof. Commands usedpnpm test <file> --maxWorkers=1.The longer custody/launcher files exercise real SQLite claims, staged-input persistence, authority revocation, and settlement. Mocked fact readers would not establish those boundaries.
The same run passed 30 import/build tests: runtime-process-build-graph (10), get-reply.imports (1), state-worker.imports (2), and eager-import-closure (17). The grouped command then exited 1 because its JSON reporter refused the inline Gateway project before launcher-import tests ran. Only that unrun file was repeated with ordinary reporting: all four cases passed in run 37191874050, 6.277 command seconds. This completes 157 placement/recovery/import passes. Native source receipts and per-invocation outcomes qualify these results; the Testbox shell workflow's cancellation during cleanup is not reported as green CI.
Failure attribution and fixture proof
The first integrated CI run 37187636863 failed the detached writer-fence fixture's expected wait-entry count. Run 37189369437 then exposed nine initial-setup failures from the same event-loop ordering assumption. Failed job logs were inspected once. The remaining non-successful jobs were fail-fast cancellations, not passing coverage.
The pinned comparison in run 37191874050 established the cause without changing assertions or deadlines:
06d4475d3162133e9fc086e7: 5/5 runs fail the same spy0-versus1 assertion; sixteen other cases pass each run85d8d023: 5/5 files fail; case failures 9, 9, 8, 9, 9, all within the original CI signaturesThe matrix receipt binds fixed tree
67b977c9d858926e62d85766b7d5d62d4e354bab, matching dependency/environment digests, and settled execution. Its command exit 1 retains the intentional unfixed negative controls; both repaired full files pass. The lease and owned capsule were cleaned up.The required fixture campaign is complete on
3162133e, tree67b977c9d858926e62d85766b7d5d62d4e354bab: 20/20 standalone full-file runs per repaired file (680 case passes) and 3/3 runs per original failure-owning Vitest shard (258 additional case passes). Run 37193617233 adds nineteen standalone repetitions per file to the one in the comparison run. Detached shard commands took 80.144/68.020/66.066 seconds; initial-setup shards took 48.180/50.558/47.113 seconds. The native receipt records exit 0, settled execution, and completed lease cleanup. Original file order, project, and two-worker shard configuration were preserved.Reuse is bounded: both setup files, the shared promise helper, initial-setup wait function, placement/routing owners, and runner/config inputs were audited unchanged through final head
fd262173. The new local session-row read is not reached by these worker setup cases. Shared database lifecycle changes mean this is not whole-graph identity or twenty runs on the final head. Final-head launcher, detached-context, import/build checks, SDK validation, and CI all pass. The initial-setup success cases use unchanged remote-exec paths with explicit isolated canonical state and no publication callbacks; other cases reject before new GitHub preparation. The0aba32b4initial-setup receipt is therefore applicable prior-head evidence. The detached-context path reaches the new GitHub reader and received its own freshfd262173full-file pass.Recorded local failures and limitations
The original maintenance integration pair timed out at its first 60-second deadline and then could not obtain restart-safe admission. An isolated original probe also timed out. Five unchanged local runs on plain main
f02d516158174b466d5d4dec17e3d0c7d7b1046creproduced that pair once and passed four times. Five runs on the original approved head and five on its exact base each passed all ten cases on matching Testbox environments (approved head, base). The fixture persists its recorder beforerunReplyAgent, supplies no placement, and installs no worker-placement service, so it skips the new pending-placement reader branch. The original failure is inherited locally; its exact cold stalled await remains unresolved, and passing repetitions are not claimed as a fix. A separate local collection stall completed no case and is not counted as a test failure.A local detached-context full-file run on
85d8d023timed out in the first unchanged side-append=false case (120-second deadline; 153.301 seconds observed), causing sixteen later unjoined-fixture refusals before the repaired case was reached. Its owned process settled after identity-verified interruption; exit 130 is retained. The changed setup case passed separately, and the repaired full files, exact-base comparisons, and prior-head hosted CI pass. The precise cold local stalled phase is still unknown; neither that later proof nor the setup-fixture fixes are claimed to repair it. No timeout, assertion, baseline, or expected-failure exception was weakened. These local failures remain explicitly recorded in the native review, without a CI waiver.Historical runtime measurement
The original before/after workload used isolated synthetic state with Node 24.21.0. Measured source is approved head
2defc41f906e3aa0c596d3cf5bfd6fee68871dee, against dependency-integrated baseline994946dc5b2cdfbcd830ccafea4ecbb8060eac44; this is historical evidence, not a remeasurement of the integrated head. All thirteen top-level turns, a native child, cron, compaction, and graceful shutdown completed in both runs.Selected warm-path SQL: 12.6 → 0 statements/turn, 126 → 0 across ten turns and 184 → 0 over the whole workload. Overall warm main-thread SQL was 3428 → 3325; unrelated scheduled work means only the selected-path reduction is attributable. Counts include successful native executions, excluding failed attempts and prepares. Cold construction, sandbox resolution, and retirement reads are not claimed removed. The after-run had zero failed main-thread executions and one excluded worker
BEGIN IMMEDIATElock attempt during shutdown. Loaded-host timings (warm phase 36.870 → 70.609 seconds; full runner 238.8 → 377.8 seconds) do not establish a latency benefit. Turn-nine RSS 2203.2 → 2101.2 MiB is not peak RSS or proof of a memory improvement.Remaining synchronous debt
The released synchronous placement reader is retained for SDK compatibility. Existing lifecycle guards retain their read at
src/gateway/worker-environments/session-placement-lifecycle.ts:170; claim/recovery helpers retain live checks atsrc/gateway/worker-environments/worker-turn-admission.ts:73,:120,:133,:386,:408, and:423. Those paths are outside the zero-SQL claim. No new SQL was added inside host grants, and the tests do not demand zero SQL from the permitted pre-existing other-owner authority reads.Inherited queue fixture repair and final integration
CI run 37196680407 at
0aba32b4completed with one root failed job, 111420116467, and its downstream CI gate. Threelane-controller.queue-liveness.test.tsscheduler-capacity cases timed out at 120 seconds with unhandledSqliteWorkerError: Agent admission requires its host owner; seventeen cases passed. Other jobs passed or skipped. The failed log was fetched once.Source tracing places this failure before placement admission:
lane-controller.tsawaitsclaimAgentSessionWriter, and main #164779 changed that owner toreadSessionEntryInWorker. The synthetic queue fixture supplies a session key but no durable store and remains in the threads lane. It directly constructs the lane controller, bypassing this PR's changed run-entry selector, and its fake placement provider does not call this PR's worker launcher. The failing test, writer owner, and routing are identical on exact main6aefbb11and0aba32b4. The first full-file main probe independently reproduced exactly those three failures and seventeen passes (568.224 command seconds), as did the first PR probe (576.390 seconds). Both unchanged-head matrices are complete: five PR runs and five exact-main runs reproduce the same three failing case names, three host-owner errors, and seventeen passes each. PR command walls were 576.390/419.202/389.967/397.631/397.732 seconds; main walls were 568.224/411.262/393.850/391.415/450.108 seconds. All comparison processes settled. No passing replay is claimed as a repair.The one-line fixture correction declares the synthetic controllers detached while retaining their session keys and every capacity, placement, and lifecycle assertion. On
d47ee981plus that one-line patch, all twenty queue cases pass (109.371 command seconds), and all six real durable-writer cases pass in their separate owner suite (50.782 seconds). Publication incorporated only three unrelated upstream test changes before commit; affected proof inputs stayed unchanged. Formatting, diff checks, and independent P2 review pass. Commit835a48f4d7c078269be63a5815dd6547353b9a81was pushed directly to main under the red-main policy. Production guards, test deadlines, and persisted-data contracts are unchanged.Merge commit
fd262173a432b056aee129561ad2dd1bfc12370aintegrates that main repair without conflicts or rebasing. The PR delta remains eighteen files, +723/−107; a fresh P2 review is scoped-clean. Existing placement/recovery proof stays explicitly bound to its measured source; new GitHub workspace-binding inputs from main have passing final-head launcher, detached-context, and all five import/build checks, alongside green final CI and a completed local released-SDK report.The queued Testbox integration attempt admitted no runner or tests before its fifteen-minute deadline. Its lease settled and was cleaned up; the same pinned
0aba32b4integration payload completed via the authorized AWS fallback. The receiver verified treea204900f9730b3e6d762cc86efebfb0b80ccdaf8. All 273 candidate cases passed: directive 132, launcher 36, pending inputs 37, detached-context 17, initial setup 17, and import/build 34. Candidate command time was 517.588 seconds; the ten old-PR/exact-main directive controls took 499.336 seconds. All six candidate invocations exited 0. The native receipt retains exit 1 for the intentional unfixed negative controls, withcandidateExitCode=0; it is not presented as a green workflow. Captured output, individual logs, source bindings, and reuse qualification were inspected.