Repository navigation
Conversation
Isolate transcript-search readiness from foreground history workers while preserving same-connection revision checks and database cleanup custody. Keep host exchanges within the caller deadline and forward cancellation to queued index-status writes; accepted writes still settle before release. Preserve code-mode approval waits under their existing budget owner. A wedged-writer fixture returned committed history in 9.34 ms versus no baseline reply during a 6.5-second observation window. Focused and sibling proof ran on Blacksmith Testbox, with independent review through P2.
|
🦞👀 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. What this changesThe branch separates transcript searches from committed-history readers, bounds worker host callbacks by the caller’s deadline, and forwards search cancellation into writer admission while preserving Code Mode approval budgets. Example: Read chat history while searches wait behind a stalled writer.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a remaining availability defect beyond the merged writer-deadlock fix. No actionable introduced bug was found; the implementation is coherent, with confidence limited by in-process rather than running-Gateway proof. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway reads saved conversations through SQLite reader workers while an ordered writer maintains the search index. Search requests exchange readiness information with that writer before validating their results. flowchart TD
A[Transcript search] --> B[Separate bounded search readers]
B --> C[Index readiness callback]
C --> D[Ordered database writer]
B --> E[Same-connection freshness check]
F[Chat history request] --> G[Committed-history readers]
G --> H[Saved messages returned]
Technical reviewBest possible solution: Keep writable search readiness independent of committed-data readers under the existing custody owner, with caller-bounded cancellation and explicit approval-aware budget ownership. Do we have a high-confidence way to reproduce the issue? Yes. Shared reader capacity plus writer-backed readiness establishes the starvation path, and the supplied regression forces that ordering with real workers; this review did not execute it. Is this the best way to solve the issue? Yes. The existing resource owner can isolate the competing workload while preserving same-connection freshness and accepted-write settlement; the deadline repair also preserves both Code Mode budget owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 220e7949fe87. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +43, Tests +182, Docs +16. Total +241 across 17 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 8, 2026, 4:42 PM ET / 20:42 UTC. |
Since #167446 the worker pool arms its first timeout as the enqueue-anchored deadline minus performance.now(), so a clamped budget schedules a delay just below MAX_TIMER_TIMEOUT_MS. Assert the clamp contract (within the Node cap and not short-circuited) instead of exact equality.
…penclaw#167446) Isolate transcript-search readiness from foreground history workers while preserving same-connection revision checks and database cleanup custody. Keep host exchanges within the caller deadline and forward cancellation to queued index-status writes; accepted writes still settle before release. Preserve code-mode approval waits under their existing budget owner. A wedged-writer fixture returned committed history in 9.34 ms versus no baseline reply during a 6.5-second observation window. Focused and sibling proof ran on Blacksmith Testbox, with independent review through P2.
…67513) Since openclaw#167446 the worker pool arms its first timeout as the enqueue-anchored deadline minus performance.now(), so a clamped budget schedules a delay just below MAX_TIMER_TIMEOUT_MS. Assert the clamp contract (within the Node cap and not short-circuited) instead of exact equality.
Backport the worker-runtime and SQLite/shared-state cancellation portion of #167740 onto the release owners. Keep queued cancellation separate from accepted native settlement, preserve FIFO and independent coalesced callers, and retain cleanup custody. Carry cancellation through plugin-state and agent writes. Adapt the necessary deadline ownership contract from #167446 without importing its history refactor. Code Mode keeps its existing approval-aware host budget. Use structured operation labels for diagnostics; raw callback strings retain the worker-entrypoint fallback and never become log payloads. This is a selected backport, not full #167740 coverage: its newer ACP/worktree, history/usage and cold-restoration portions are deliberately not imported. Proof: 200 distinct tests across 10 files; original host-wait suspension fails all five deadline cases; donor raw-string labeling fails the payload case. Physical frozen install, worker-runtime build, core types, all 27 core test graphs, three zero-entry Knip scans, changed-source guards and scoped lint pass. Post-review diagnostic repair has fresh affected build/type/lint/test proof. Deadline ownership portion adapted from 486cdae. (cherry picked from commit 7dd2721) (cherry picked from commit b7984f6845f075a5f92825926632575bbcc0202c)
What Problem This Solves
Fixes: chat history, reactions, and progress-card reads become unavailable when transcript searches occupy every foreground reader while waiting behind a stalled agent-database writer. Related: #167396 fixed one writer deadlock; this change isolates its read-side blast radius.
User Impact
Committed session data remains readable while writable transcript-index readiness is blocked. Worker host callbacks consume the caller's deadline, including queue time; code-mode approval waits retain their existing approval-aware budget. No schema, configuration, stored data, permissions, or update migration changes.
Why This Change Was Made
Transcript search retains a native reader across a host index-readiness exchange so its freshness check uses the same SQLite connection. That exchange can await the writer, and previously occupied the same worker slots as foreground reads. Search now uses a separately bounded lane under the existing database custody and cleanup owner. Generic worker exchanges retain the caller deadline, and transcript-index requests forward its cancellation signal into writer admission. Queued work cancels; accepted writes retain settlement custody.
Production TypeScript grows by 43 lines. The requested non-test/non-doc diff is +96/-46, including seven package README lines. Growth preserves two concrete contracts: same-connection search freshness and approval-aware code-mode deadlines. Search keeps its existing concurrency cap, at the cost of a separate lazily started worker set. The existing owner supplies idle retirement and shutdown. The transcript runtime's duplicate deadline calculation is removed.
Evidence
Provider:
blacksmith-testbox; lease:tbx_01m4ef1zac8wnyytkezefv25g0; base:6070074dabf6b45f74d4039590cd307640317862.chat.historyhandler reads a committed synthetic message while the canonical writer queue is held and search capacity is occupied. Baseline: no reply during a 6,514.77 ms observation window, ending at the fixture's 10-second cutoff. Candidate: identical committed history in 9.34 ms, before releasing the writer. This is a blocked-writer availability measurement, not an ordinary-throughput benchmark.pnpm test <file> --maxWorkers=1wall time:chat-history-worker.test.ts18.33 s;worker-task-pool.test.ts8.16 s;session-transcript-search.worker.test.ts12.97 s. These suites exercise real worker and SQLite ownership; the new callback cases use a fake clock.node scripts/check-changed.mjspassed its structural checks and all core, core-test, extension, and extension-test typechecks, then stopped at an inherited Knip failure:src/talk/client-voice-session-store.ts: ClientVoiceToolEffect(production and full-tree scans).node --import ./scripts/tsx.mjs scripts/check-deadcode-exports.mtsfails identically on a clean, independently installed checkout of current maindcd3ca7a7fd53cfd5aa09579bb4665a422fbd6ba. That source is untouched by this PR. All ten remaining commands from the native changed-check plan passed when run directly; the failed guard remains reported as failed.The final extraction replay passed 91 affected tests across 11 files, the export collision guard, and 20 closure tests.
pnpm buildexited 0 in 189.2 s. It reported a Control UI startup-JS size advisory (365.2 KiB versus 364.7 KiB); no UI source changes are included.Remote runs all used the provider and lease above:
node scripts/run-vitest.mjsfor history and pool deadlines, then the three focused files with--maxWorkers=1check-export-name-collisions.mts, and both closure filespnpm test <file> --maxWorkers=1runs, thennode scripts/check-changed.mjsnode scripts/check-changed.mjsafter extractioncheck-deadcode-exports.mts, remaining native-plan commands, final affected/closure suites, andpnpm buildNo live Gateway was modified or restarted. Hosted CI run 37840545200 passed on
f67a919c90ec: 671 s wall time, 78 completed jobs, and 4,986 aggregate job-seconds across 20 successful Node test jobs (job-level cost, not per-test timing).