Repository navigation
Conversation
|
🦞👀 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. |
|
Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 11:41 PM ET / October 7, 2026, 03:41 UTC (Revision 5). ClawSweeper reviewWhat this changesRoutes session metadata reads through the existing projection worker so chat input can be persisted and acknowledged while transcript history is busy. Merge readiness✅ Ready for maintainer review This PR remains useful: current main retains the history-queue dependency, and the introduced changes preserve the existing read and write safeguards. No actionable introduced defects or additional review blockers were found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway reads session metadata to authorize chat requests, select their storage, and admit durable input. These reads share database ownership and ordering safeguards with transcript storage, while history pages run on a separate worker. flowchart TD
A[Chat request] --> B[Session metadata worker]
B --> C[Current authority and source checks]
C --> D[Ordered input persistence]
D --> E[Durable acknowledgement]
F[History requests] --> G[Transcript history worker]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +14, Tests +59, Docs +6. Total +79 across 17 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep metadata on the existing projection worker while retaining writer ordering, live authority checks, and the history worker for transcript payloads. Do we have a high-confidence way to reproduce the issue? Yes: current source routes admission metadata through the single history worker, and the supplied blocked-history router regression establishes the failing boundary. This review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: selecting the existing metadata worker removes the demonstrated dependency without adding parallel policy, storage, configuration, or public SDK surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 639070bb0972. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
Route exact session reads, store inventory, transcript target selection, and cold metadata preflight through the existing projection worker. Preserve writer FIFO, source fences, and durable input custody. Remove split discovery routing and the unused inventory lane parameter.
Keep native ownership, diff baseline, and SDK transcript target race fixtures on the worker that now owns their metadata reads. Preserve all existing failure and authority assertions.
aa20209 to
3292922
Compare
…ity-admission-20260919
|
Merged as Pinned-head inherited-failure qualification is complete for The inherited failures cover the reconcile pool/lifecycle fixtures' one-idle-executor assumptions; the cron registry-maintenance retained-store byte assertion; closed agent-execution admission during Gateway chat/session/Talk/history fixture writes; the oversized history replay-boundary expectation; board-store publication/cleanup error wording; worker live-event completion assertions; and plugin retirement's direct/explicit cleanup assertions. Matching cases and errors appear in main CI runs 37567947157, 37559068121, and 37563803327, supplemented by isolated Linux reproductions on unchanged main Every declared failing test/fixture/producer source blob is unchanged between its qualifying main baseline, the actual CI merge's first parent Additional exact-head sibling validation ran on blacksmith-testbox Passing proof includes all 11 changed test files (187 cases), export-name collision checking, eager-import closure (17 cases), wrapper-source closure (3 cases), 12 additional synthetic E2E files (28 cases), and both isolated synthetic process rigs. Guarded live collection recorded 193 passed and 37 skipped cases; those skips are not claimed as live provider/device proof. No CI rerun, branch update, or workflow dispatch was used for this qualification. The exact-head admin exception remains subject to the native review, security, authority, and final-head gates. |
…e checks Main moved ordered metadata reads to the projection lane in #166365. Retire that cache before checking for leaked request registrations, preserving all existing response, authority, and no-resource assertions. A diagnostic at the integrated head reproduced the failure and identified only the idle projection reader's physical path and alias. Both corrected files pass all 112 cases locally. Fresh P2 review, targeted types, lint, and formatting pass. Production source is byte-identical to 853cefe.
* perf(session-readers): reuse captured admission facts * chore(session-readers): shrink assertion safety baseline * refactor(session-readers): keep index collector private * refactor(session-readers): make custody predicates explicit * test(session-readers): retire the current projection cache in lifetime checks Main moved ordered metadata reads to the projection lane in #166365. Retire that cache before checking for leaked request registrations, preserving all existing response, authority, and no-resource assertions. A diagnostic at the integrated head reproduced the failure and identified only the idle projection reader's physical path and alias. Both corrected files pass all 112 cases locally. Fresh P2 review, targeted types, lint, and formatting pass. Production source is byte-identical to 853cefe.
…enclaw#166365) ## What Problem This Solves `chat.send` could wait behind unrelated transcript-history reads while authorizing a request, admitting its run, or preparing durable input. An ordered metadata read could hold the database writer FIFO while waiting on the single history worker. ## User Impact Hot-session input can be persisted and acknowledged while history dispatch is blocked. Exact session rows, target discovery, transcript identity selection, and bounded cold-archive metadata use the existing projection worker. Writer FIFO ordering, current permissions, source replacement checks, and durable input custody remain intact. There are no schema, configuration, retention, or update changes. ## Why This Change Was Made Metadata discovery and payload reads selected different workers. Use the metadata worker consistently, remove the unused inventory lane parameter, and remove the discovery-only lane fallback. Transcript corpus/archive payloads and maintenance retain their existing owners. Production LOC delta: **+14**. The generic reader also serves transcript payloads, so the metadata operations must select the existing projection lane explicitly; transcript target selection also retains its lazy worker/incognito boundary. Most added lines are argument/import formatting. No new pool, cache, wrapper, or configuration option is introduced. ## Evidence Benchmarks and runtime tests ran with provider `blacksmith-testbox`, profile `openclaw-check`, on Linux x86_64 / Node 24.19.0. Paired measurements and the first full staged gate used lease **`tbx_01m499e9p8c3pwdkxrq7kqyt11`** on base `4a96fff224ff`. The full staged gate also passed after rebase to `66cf8a4c0732` on the Linux rig fallback (`node scripts/check-changed.mjs --staged`, exit 0, approximately 50 minutes). Fresh-lease integration proof passed on **`tbx_01m49cshscnkd5rn7tva92rwrp`**: core production types and 63 tests covering exact reads, worktree-owner projection, managed owner policy, and durable ACK; total command 2m23s. On **`tbx_01m49wfjav8vbwxmsdrw22nrad`**, base `fd7d42fa5176`, core production types and 218 tests across 16 focused files passed in 6m51s. The three corrected race fixtures passed all 58 tests in 2m24s. Their staged gate and a full 227-case registry lifecycle replay passed in 6m14s. The final branch is rebased onto `772d281b298f`; SHA-256 verification confirms all 17 reviewed files are byte-for-byte unchanged. The earlier results are prior-base evidence; hosted CI checks the final integration. All four leases are stopped/expired. The RPC router/handler and SQLite rig ran 64 sends at concurrency eight, alongside four continuous synthetic history readers and post-ACK preparation. Provider execution was mocked after ACK. Same baseline revision, synthetic data, and lease: | Request latency | Before | After | Reduction | |---|---:|---:|---:| | p50 | 6,451 ms | 979 ms | 84.8% | | p95 | 17,257 ms | 3,339 ms | 80.7% | | p99 / max | 18,234 ms | 3,470 ms | 81.0% | | mean | 7,548 ms | 1,273 ms | 83.1% | Afterward, all 1,500 history-worker requests were background page reads; foreground metadata used the projection worker. Harness RSS after the run was 2.995 GB before and 3.193 GB after; these are whole test-process measurements, including worker heaps and retained synthetic turns. A second paired run waited for warm startup, then measured 32 requests with one send outstanding and the same four background history readers: | Warm request latency | Before | After | |---|---:|---:| | p50 | 2,250 ms | 188 ms | | p95 | 3,036 ms | 323 ms | | p99 / max | 16,280 ms | 2,246 ms | | mean | 2,710 ms | 264 ms | **Both workloads still exceed the 150 ms p50 / 500 ms p99 targets.** The warm median is below 300 ms. The remaining 2,245 ms warm tail records 2,094 ms in authority, 9 ms in admission, 77 ms in persistence, and 65 ms in run admission. Repeated authority preparation and production latency still need finer attribution; this change removes the proven history-queue dependency without relaxing authority or durability. - The full router → durable transcript → ACK regression passes with history dispatch held. The original revision times out waiting for ACK under the same gate (the existing 120-second Vitest deadline), confirming the regression catches the old dependency. - Broader owner/sibling coverage: 167 tests passed across 12 files. After the transcript-target and cold-metadata cutover, 71 relevant tests passed, including cold restore authority, physical replacement, first registration, run admission, and ACK-before-skill-preparation behavior. - `pnpm test src/gateway/server-methods/chat-send-preparation-ack.test.ts --maxWorkers=1`: 5 passed; 38.85 s runner wall time including worker compilation; 10.93 s test time. The new case took 3.67 s. Real router authorization and SQLite custody are required to prove a durable ACK; helper-only tests would miss the persistence dependencies. Added Linux test execution cost: approximately 3.7 seconds per run, measured on Testbox; hosted per-case timing was not collected. - `node scripts/check-changed.mjs --staged`: passed on the paired measurement base in 27m53s, including all 27 core test type graphs, lint, dead-export, cycle, and storage guards. Every reviewed file matched its recorded SHA-256. - Independent Codex reviews of the production scope and final three test corrections: scoped-clean, no actionable P0/P1 findings. - Three additional test fixtures now inject metadata races/errors through the projection worker: native model ownership, diff-baseline generation, and SDK transcript-target locking. All 58 tests in those files passed on the fresh lease in 2m24s; their assertions are unchanged. The scoped staged gate selected and passed the `agents-other`, `other`, and `plugin-sdk` type graphs, lint, and dead-export checks. <details> <summary>24-hour slow-send attribution</summary> The journal query covered 2026-10-05 19:00:50Z through 2026-10-06 19:00:50Z and yielded 77 request and 99 startup records. These are **conditional slow-stage distributions**: the logger excludes stages below 1,000 ms. Timers include awaited/scheduling time and can overlap; they are not exclusive CPU measurements. Missing fields are absent samples. Nearest-rank p99 equals max for these sample counts. | Stage / phase | Samples | p50 ms | p95 ms | p99 / max ms | |---|---:|---:|---:|---:| | Request total | 77 | 3,418 | 5,611 | 6,951 | | Authority | 77 | 1,429 | 2,267 | 2,748 | | Admission | 77 | 273 | 469 | 685 | | Attachments | 77 | 0 | 11 | 285 | | Persistence | 77 | 566 | 1,234 | 2,815 | | Preparation | 77 | 0 | 1 | 8 | | Reply context | 77 | 0 | 83 | 116 | | Run admission | 77 | 1,135 | 2,314 | 2,402 | | Effects | 77 | 0 | 0 | 0 | | Response | 77 | 1 | 1 | 2 | | Startup total | 99 | 5,674 | 102,321 | 3,288,574 | | Startup ACK (repeated request duration) | 99 | 3,158 | 4,851 | 6,951 | | Startup authoring | 95 | 1 | 6 | 9 | | Startup preparation | 95 | 3,532 | 5,951 | 3,046,035 | | Startup reply initialization | 95 | 1,612 | 80,753 | 356,488 | | Startup reply context | 99 | 0 | 0 | 129 | | Startup worktree | 13 | 3,575 | 5,131 | 5,131 | | Startup dispatch | 99 | 15 | 544 | 8,757 | The 54.8-minute startup record had already ACKed in 250 ms and began after that process started. It does not establish pre-ACK blocking or unfinished work from the earlier restart. Source tracing and the blocked-history regression establish the metadata-worker dependency fixed here; they do not attribute every production tail. </details> Related: openclaw#165608. <details> <summary>Hosted CI investigation and remaining upstream failures</summary> Final-head [CI run 37556779529](https://github.com/openclaw/openclaw/actions/runs/37556779529), head `3292922b0e82`, completed with 79 successful jobs, 24 skipped jobs, two failed test jobs, and the failed aggregate gate. The stale metadata-race fixtures are corrected. No CI rerun was requested. - **MCP fixture routing:** all ten `mcp-http.session-controls.test.ts` cases fail during tool/auth preparation before the session action. On unchanged base `fd7d42fa5176`, `pnpm exec vitest run --config test/vitest/vitest.gateway-core.config.ts src/gateway/mcp-http.session-controls.test.ts --maxWorkers=1 -t 'MCP dispatch preserves archive final-effect authority: allowed'` fails with the identical `Shared-state admission requires the host broker`; adding `--pool=forks` passes. Upstream openclaw#166199 moved the sibling question-authority fixture into the fork-backed database-worker lane but omitted this fixture. This branch does not change its routing. - **History expectation after the new base:** `chat.history advances past a replay boundary that cannot fit all projected siblings` still expects only sequence 2 on page one. Upstream openclaw#166263 now compresses an oversized source group into a fetchable placeholder before capping, allowing the older sequence-1 message to fit on the same page. The fixture and paging owner are byte-identical between base `772d281b298f` and this branch. The exact filtered case also fails on unchanged base `772d281b298f` on `blacksmith-testbox` lease `tbx_01m49zrpad1bfnzpwb9wp7t3tz`: a diagnostic print before the unchanged assertion captured `sequences: [1, 2]` and `hasMore: false`. The test exited 1 as expected; the probe command completed in 1m35s, restored the test, removed its temporary worktree, and the lease is stopped. No history behavior is changed here. The initial CI run also reported one remaining fake timer in `subagent-registry-lifecycle.test.ts`, case `preserves cleanup exhaustion when another run settles (related=true)`. The complete 227-case file passed separately on unchanged base and candidate, and the corrected head's CI no longer reports it. The original failure remains unexplained; passing replays are not claimed as a fix, and no assertion was weakened. </details>
* perf(session-readers): reuse captured admission facts * chore(session-readers): shrink assertion safety baseline * refactor(session-readers): keep index collector private * refactor(session-readers): make custody predicates explicit * test(session-readers): retire the current projection cache in lifetime checks Main moved ordered metadata reads to the projection lane in openclaw#166365. Retire that cache before checking for leaked request registrations, preserving all existing response, authority, and no-resource assertions. A diagnostic at the integrated head reproduced the failure and identified only the idle projection reader's physical path and alias. Both corrected files pass all 112 cases locally. Fresh P2 review, targeted types, lint, and formatting pass. Production source is byte-identical to 853cefe.
What Problem This Solves
chat.sendcould wait behind unrelated transcript-history reads while authorizing a request, admitting its run, or preparing durable input. An ordered metadata read could hold the database writer FIFO while waiting on the single history worker.User Impact
Hot-session input can be persisted and acknowledged while history dispatch is blocked. Exact session rows, target discovery, transcript identity selection, and bounded cold-archive metadata use the existing projection worker. Writer FIFO ordering, current permissions, source replacement checks, and durable input custody remain intact. There are no schema, configuration, retention, or update changes.
Why This Change Was Made
Metadata discovery and payload reads selected different workers. Use the metadata worker consistently, remove the unused inventory lane parameter, and remove the discovery-only lane fallback. Transcript corpus/archive payloads and maintenance retain their existing owners.
Production LOC delta: +14. The generic reader also serves transcript payloads, so the metadata operations must select the existing projection lane explicitly; transcript target selection also retains its lazy worker/incognito boundary. Most added lines are argument/import formatting. No new pool, cache, wrapper, or configuration option is introduced.
Evidence
Benchmarks and runtime tests ran with provider
blacksmith-testbox, profileopenclaw-check, on Linux x86_64 / Node 24.19.0. Paired measurements and the first full staged gate used leasetbx_01m499e9p8c3pwdkxrq7kqyt11on basecc7e664dfe34. The full staged gate also passed after rebase to8f5c33c30d71on the Linux rig fallback (node scripts/check-changed.mjs --staged, exit 0, approximately 50 minutes). Fresh-lease integration proof passed ontbx_01m49cshscnkd5rn7tva92rwrp: core production types and 63 tests covering exact reads, worktree-owner projection, managed owner policy, and durable ACK; total command 2m23s.On
tbx_01m49wfjav8vbwxmsdrw22nrad, base0288eb1f3692, core production types and 218 tests across 16 focused files passed in 6m51s. The three corrected race fixtures passed all 58 tests in 2m24s. Their staged gate and a full 227-case registry lifecycle replay passed in 6m14s. The final branch is rebased onto98567acd6060; SHA-256 verification confirms all 17 reviewed files are byte-for-byte unchanged. The earlier results are prior-base evidence; hosted CI checks the final integration. All four leases are stopped/expired.The RPC router/handler and SQLite rig ran 64 sends at concurrency eight, alongside four continuous synthetic history readers and post-ACK preparation. Provider execution was mocked after ACK. Same baseline revision, synthetic data, and lease:
Afterward, all 1,500 history-worker requests were background page reads; foreground metadata used the projection worker. Harness RSS after the run was 2.995 GB before and 3.193 GB after; these are whole test-process measurements, including worker heaps and retained synthetic turns.
A second paired run waited for warm startup, then measured 32 requests with one send outstanding and the same four background history readers:
Both workloads still exceed the 150 ms p50 / 500 ms p99 targets. The warm median is below 300 ms. The remaining 2,245 ms warm tail records 2,094 ms in authority, 9 ms in admission, 77 ms in persistence, and 65 ms in run admission. Repeated authority preparation and production latency still need finer attribution; this change removes the proven history-queue dependency without relaxing authority or durability.
pnpm test src/gateway/server-methods/chat-send-preparation-ack.test.ts --maxWorkers=1: 5 passed; 38.85 s runner wall time including worker compilation; 10.93 s test time. The new case took 3.67 s. Real router authorization and SQLite custody are required to prove a durable ACK; helper-only tests would miss the persistence dependencies. Added Linux test execution cost: approximately 3.7 seconds per run, measured on Testbox; hosted per-case timing was not collected.node scripts/check-changed.mjs --staged: passed on the paired measurement base in 27m53s, including all 27 core test type graphs, lint, dead-export, cycle, and storage guards. Every reviewed file matched its recorded SHA-256.agents-other,other, andplugin-sdktype graphs, lint, and dead-export checks.24-hour slow-send attribution
The journal query covered 2026-10-05 19:00:50Z through 2026-10-06 19:00:50Z and yielded 77 request and 99 startup records. These are conditional slow-stage distributions: the logger excludes stages below 1,000 ms. Timers include awaited/scheduling time and can overlap; they are not exclusive CPU measurements. Missing fields are absent samples. Nearest-rank p99 equals max for these sample counts.
The 54.8-minute startup record had already ACKed in 250 ms and began after that process started. It does not establish pre-ACK blocking or unfinished work from the earlier restart. Source tracing and the blocked-history regression establish the metadata-worker dependency fixed here; they do not attribute every production tail.
Related: #165608.
Hosted CI investigation and remaining upstream failures
Final-head CI run 37556779529, head
3292922b0e82, completed with 79 successful jobs, 24 skipped jobs, two failed test jobs, and the failed aggregate gate. The stale metadata-race fixtures are corrected. No CI rerun was requested.mcp-http.session-controls.test.tscases fail during tool/auth preparation before the session action. On unchanged base0288eb1f3692,pnpm exec vitest run --config test/vitest/vitest.gateway-core.config.ts src/gateway/mcp-http.session-controls.test.ts --maxWorkers=1 -t 'MCP dispatch preserves archive final-effect authority: allowed'fails with the identicalShared-state admission requires the host broker; adding--pool=forkspasses. Upstream fix: hide web search when no provider is configured #166199 moved the sibling question-authority fixture into the fork-backed database-worker lane but omitted this fixture. This branch does not change its routing.chat.history advances past a replay boundary that cannot fit all projected siblingsstill expects only sequence 2 on page one. Upstream perf(gateway): bound anchored history pages and message groups #166263 now compresses an oversized source group into a fetchable placeholder before capping, allowing the older sequence-1 message to fit on the same page. The fixture and paging owner are byte-identical between base98567acd6060and this branch. The exact filtered case also fails on unchanged base98567acd6060onblacksmith-testboxleasetbx_01m49zrpad1bfnzpwb9wp7t3tz: a diagnostic print before the unchanged assertion capturedsequences: [1, 2]andhasMore: false. The test exited 1 as expected; the probe command completed in 1m35s, restored the test, removed its temporary worktree, and the lease is stopped. No history behavior is changed here.The initial CI run also reported one remaining fake timer in
subagent-registry-lifecycle.test.ts, casepreserves cleanup exhaustion when another run settles (related=true). The complete 227-case file passed separately on unchanged base and candidate, and the corrected head's CI no longer reports it. The original failure remains unexplained; passing replays are not claimed as a fix, and no assertion was weakened.