Repository navigation
test(worker): chat.abort queued-preview cases fail after the first case on main - #166529
Conversation
Each chat.abort case captured the runtime config snapshot only after ComposedGatewayHarness.create had run Gateway session storage work, which pins the ambient test-home config through getRuntimeConfig. The case then "restored" that pinned config, so every later case started with it. Since #165993, agent database executors watch the runtime config's store locator. In case 2+, the Gateway executor for the harness agent database captured the inherited test-home locator, and the case's setRuntimeConfigSnapshot(harness.cfg) retired it. The in-process simulated worker had already replaced process.env.OPENCLAW_STATE_DIR, so the Gateway live-event trajectory recorder reopened that database under the worker's shared-state database and the executor stayed warm. Gateway transcript commits were then refused ("belongs to another shared-state database"), the worker reconnected and retried about a thousand times, and never reached the provider before the cancellation-boundary timeout. Capture the snapshot before the harness exists and restore it after harness.close(), so each case starts from the same state as the first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🦞👀 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 7, 2026, 5:08 AM ET / 09:08 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR captures runtime configuration before each worker cancellation fixture starts and restores it after cleanup, including when cleanup fails. Merge readiness✅ Ready for maintainer review The prior cleanup finding is resolved, and the required standalone and original-shard validation is recorded. Current main still needs this focused test-isolation repair; no remaining actionable patch defect was found. Priority: P2 Review scores
Verification
How this fits togetherWorker cancellation tests connect an in-process worker to a composed Gateway over a real local WebSocket transport. Their runtime configuration determines which session databases the Gateway uses while processing cancellation and settlement. flowchart TD
A[Test case begins] --> B[Capture ambient configuration]
B --> C[Create Gateway fixture]
C --> D[Exercise worker cancellation]
D --> E[Close fixture]
E --> F[Restore configuration on success or failure]
F --> G[Next independent test case]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +8. Total +8 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep each cancellation case isolated through the existing configuration owner while preserving the cancellation and settlement assertions. Do we have a high-confidence way to reproduce the issue? Yes: running the complete cancellation file in its existing case order exercises the source-backed leak; the body records seven failures on main and passing standalone later cases. This review inspected the mechanism without executing tests. Is this the best way to solve the issue? Yes: moving capture before fixture creation and restoring after cleanup addresses the test-owned leak without changing production behavior or weakening expectations. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5dcf668765de. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Addressed: the runtime config is now restored in a |
|
Merged via squash.
|
…se on main (openclaw#166529) * test(worker): stop chat.abort cases inheriting a pinned runtime config Each chat.abort case captured the runtime config snapshot only after ComposedGatewayHarness.create had run Gateway session storage work, which pins the ambient test-home config through getRuntimeConfig. The case then "restored" that pinned config, so every later case started with it. Since openclaw#165993, agent database executors watch the runtime config's store locator. In case 2+, the Gateway executor for the harness agent database captured the inherited test-home locator, and the case's setRuntimeConfigSnapshot(harness.cfg) retired it. The in-process simulated worker had already replaced process.env.OPENCLAW_STATE_DIR, so the Gateway live-event trajectory recorder reopened that database under the worker's shared-state database and the executor stayed warm. Gateway transcript commits were then refused ("belongs to another shared-state database"), the worker reconnected and retried about a thousand times, and never reached the provider before the cancellation-boundary timeout. Capture the snapshot before the harness exists and restore it after harness.close(), so each case starts from the same state as the first. * test(worker): restore the runtime config even when harness cleanup fails
What Problem This Solves
Fixes:
src/worker/worker.chat-abort.test.tsfails 7 of 8 cases onmain(every queued-preview case times out at "worker did not reach the cancellation boundary"), which turns any PR whose changed-scope shard includes it red.User Impact
User impact: no user-visible change. Unblocks CI for PRs that touch session or memory code.
Why This Change Was Made
Each case captured the runtime config snapshot only after
ComposedGatewayHarness.createhad already run Gateway session storage work, which pins the ambient test-home config. The case then "restored" that pinned config, so every later case started with it. Since #165993, agent database executors watch the runtime config's store locator: from case 2 on, publishingharness.cfgretired the Gateway's warm executor, the in-process simulated worker reopened the database under its own shared-state directory, and Gateway transcript commits were refused for the rest of the case. The fix captures the snapshot per test before harness creation and restores it in afinallyafterharness.close(), so a rejected cleanup cannot leak the case's config either. Production code and test expectations are unchanged. A direct push tomainunder the red-main policy was refused by the repository ruleset ("Changes must be made through a pull request"), so this lands as a PR.Evidence
1240759624a(perf(state): switching between agents reopens agent database executors on every request #165993); passes 8/8 atdd619529b24.main(a282f8002a3): 7 failed, 1 passed. Running a single later case alone passes, confirming cross-case leakage.fa420c6eb27: 20/20 consecutive standalone runs ofsrc/worker/worker.chat-abort.test.tsat 8/8;--maxWorkers=127.9 s wall (22.1 s Vitest).checks-node-changed-8of fix(memory): Knowledge calls fail mid-turn after unrelated session activity #166419:tools.onboarding,tools.optional,openclaw-agent-execution-incognito.sessions,agent-consult-runtime.lineage,worker.chat-abort): 3/3 clean runs, all files passing.openclaw-agent-execution.idle15/15,openclaw-agent-db.worker-admission22/22,worker.fault-injectionandworker-fault-injection.cleanup/live-chat17/17 each,native-workerintegration 9 passed / 1 skipped.node scripts/check-changed.mjs --base origin/main: pass.Follow-ups noted, not in scope: the Gateway trajectory recorder in this harness still resolves storage from the shared
process.envthe in-process worker overwrites (pre-existing; refused writes are logged and swallowed), and a warm idle executor bound to one shared-state database refuses callers from another until its idle timeout.🤖 Generated with Claude Code