Repository navigation
test(workers): reuse service readers and stabilize transcript fencing - #168806
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 changes before merge. What this changesThis PR reuses SQLite reader threads across worker-service tests and synchronizes transcript-fencing coverage with the queued writer. Example: The transcript test replaces a worker claim while sequence 1 waits behind a held writer.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the fixture optimization is useful, but the previously reported session-worker cleanup defect remains unfixed. Priority: P3 Before merge
Findings
Agent review detailsHow this fits togetherThe shared test fixture creates temporary worker-service databases, exercises service and transcript operations, and closes case resources before deleting their directories. flowchart TD
A[Test case] --> B[Service fixture]
B --> C[Worker service]
C --> D[Shared state database]
C --> E[Session database executor]
B --> F[Case cleanup]
F --> G[Directory removal]
B --> H[Suite reader shutdown]
Technical reviewBest possible solution: Drain root-scoped session resources before removing each case directory while preserving exact-path reopening and suite-level reader shutdown. Do we have a high-confidence way to reproduce the issue? Source inspection establishes the teardown defect through the live ACK session write, executor identity selection, and retained native lifetime; no target code was run during this read-only review. Is this the best way to solve the issue? Shared-fixture reader reuse and observing the actual queued writer are appropriate, provided teardown closes every session resource beneath the case root. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4a7d53616a5d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceTests +21. Total +21 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 HistoryReview history (3 earlier review cycles)
Reviewed October 10, 2026, 11:51 PM ET / October 11, 2026, 03:51 UTC (Revision 4). |
|
Merged via squash.
|
|
Follow-up: verify root-scoped session-worker retirement before the service fixture removes its directory. The reader-reuse cleanup drains the shared-state database path; the review identifies a live-ACK fixture that can retain a session executor bound to a different shared-state identity. The 59-consumer pass does not prove handle retirement. Track the proposed root-scoped session cleanup with the existing work in #158658, or a focused follow-up; no production behavior changed here. |
…openclaw#168806) * test(workers): reuse reader threads across service cases * test(workers): wait for queued transcript writes before fencing
What Problem This Solves
Worker environment service tests repeatedly tear down and reload shared SQLite reader threads. The transcript-fence regression also waited for ledger reservation rather than the queued writer, making its result timing-dependent.
User Impact
No user-visible behavior changes. The same service, storage, recovery, and authority tests run with less fixture overhead and deterministic queued-write coverage.
Why This Change Was Made
Use the existing path-scoped database close after each test, then close the reader pool after the suite. Each case still drains its accepted work, invalidates admission, closes native handles, and removes its own state directory. Only reader thread code survives between cases. Explicit full-close/reopen tests remain intact.
Remove the fixture switch and its redundant opt-ins. All 59 consumers were checked for additional database roots, module resets, and process-lifecycle expectations.
The transcript test now observes the real transcript worker store’s queued
run()call before replacing its claim, and joins the pending commit during cleanup. Every existing assertion and the held writer remain intact.Production LOC: +0 / −0. Seven test/support files, +53 / −32. No timeout, assertion, retry, or production seam changes.
Evidence
On one Linux AWS Crabbox lease (
cbx_8d4dd0798673, Node 24), after warming compiled declarations, the same command ran the same 102 assertions before and after:pnpm test src/gateway/worker-environments/provider-provisioning.test.ts src/gateway/worker-environments/provider-reconciliation.test.ts src/gateway/worker-environments/service-lifetime.test.ts --maxWorkers=1 --reporter=jsonRemote comparison. All 59 consumer files / 710 tests pass. The transcript file passes before and after the ordering fix (44.620 s → 45.647 s; no speed claim for that fix); all 20 standalone runs and all three original four-file shard runs pass without retries. Standalone total: 916.598 s (45.558–46.220 s each); shard walls: 45.146 / 45.502 / 45.190 s.
Formatting, typechecks, lint and all changed guards pass except the dead-export scan. Running that exact scan on the original base independently reproduces the identical 29 findings (28 UI exports and
GatewayApprovalEventPublisherV2). No baseline or guard was weakened. Original-base qualification.The first PR CI run exposed the transcript fixture’s earlier gate; the repair above addresses that ordering. Both independent Codex P0/P1 reviews are scoped-clean. The repair CI run passes, including
openclaw/ci-gate: 440 s elapsed CI wall time, with 1,270 summed job-seconds across seven Node test jobs. These CI figures cover the selected PR jobs; they are not the three-file benchmark above.