Repository navigation
test: isolate shared /tmp state in reply, channel, and boot suites - #132960
Conversation
Fixtures handed real session-store, agent, transcript, and workspace paths under shared /tmp, so a stale machine-wide openclaw-agent.sqlite made unrelated suites fail through the real SQLite accessor. Route them through the existing test/helpers/temp-dir tracker instead, and wait on the actual CLI progress callbacks rather than a one-second polling deadline. Production LOC unchanged.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
b071738 to
940f716
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 9:13 PM ET / August 30, 2026, 01:13 UTC. ClawSweeper reviewWhat this changesThe PR replaces shared Merge readinessKeep open for maintainer review. The branch remains necessary on current main and uses the existing temp-directory lifecycle boundary, but its submitted aggregate validation still reports cold-start timeouts in a changed CLI-progress suite. Priority: P3 Review scores
Verification
How this fits togetherReply and channel tests construct workspace and session paths that reach real session and SQLite accessors before mocked dispatch boundaries. The shared temporary-directory helper creates unique directories and registers their cleanup with the test lifecycle. flowchart LR
A[Test fixture] --> B[Tracked temporary directory]
B --> C[Agent workspace and session paths]
C --> D[Reply and channel execution]
D --> E[Session and SQLite accessors]
E --> F[Test assertions and cleanup]
Decision needed
Why: The implementation is focused and uses an established helper, but the PR's own aggregate evidence still contains two relevant initial-run timeouts and the item carries the protected maintainer label. Before merge
Agent review detailsSecurityNone. PR surfaceSource +10, Tests +42. Total +52 across 14 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the existing tracked temporary-directory helper and land only after an exact-head cold-process run shows the affected CLI suites are stable or the remaining timeout cause is repaired. Do we have a high-confidence way to reproduce the issue? Not applicable as a product-bug reproduction: this is a test-infrastructure PR. The supplied evidence gives a concrete stale-state test scenario, but read-only review did not execute it. Is this the best way to solve the issue? Yes, conditionally: reusing the canonical tracked temporary-directory helper repairs the shared-state boundary without adding runtime surface. The remaining question is whether the reported cold-start timeouts are environmental or a test defect. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a6bae8f5c63d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Updated review result: the cold-start failures had a fixture-level cause beyond host contention. A fresh process at the original PR head reproduced both first-case 120-second timeouts in the CLI progress/commentary suites (16 passed, 2 failed). The progress case uses mocked CLI events; only the commentary case forwards to a real local scripted JSONL subprocess. The execution fixture lacked modality metadata for selected models. The completed fixture then passed all 40 affected files, 723 tests, including every shared-factory consumer and the module-reset integration paths. Changed-file checks passed; fresh Codex autoreview and independent source review found no remaining actionable issue within their reviewed scope. Production delta remains zero. This PR merged while that verification was running, so the six-line improvement is tracked separately in #132988. Its exact-head hosted CI gates the follow-up landing. The earlier clean A/B runs remain observations, but they were insufficient to explain the cold failures. Named follow-up: audit explicit cached SQLite-handle closure before temporary-directory cleanup in the existing miscellaneous runReplyAgent suite on Windows. No failure was reproduced in this review; the concern is separate from the fixture metadata correction. |
|
Merged via squash.
|
…penclaw#132960) Fixtures handed real session-store, agent, transcript, and workspace paths under shared /tmp, so a stale machine-wide openclaw-agent.sqlite made unrelated suites fail through the real SQLite accessor. Route them through the existing test/helpers/temp-dir tracker instead, and wait on the actual CLI progress callbacks rather than a one-second polling deadline. Production LOC unchanged.
…ites The agent-runner execution fixtures handed storePath "/tmp/sessions.json" to the real executeAgentTurn. Production resolution derives the agent database from the store's directory, so those turns created and migrated the machine-wide /tmp/openclaw-agent.sqlite. A stale copy of that file makes unrelated suites fail through the real session accessor the next time OPENCLAW_AGENT_SCHEMA_VERSION is bumped, which is the failure #132960 had to repair across 14 suites. Route the store paths through the existing test/helpers/temp-dir tracker: the auto-reply harness gains makeTestSessionStorePath() beside the tracked agentDir and workspace it already owns, and the two gateway health collector suites, whose resolveSessionStorePathCore mock made real target resolution inspect the same shared database read-only, get their own tracked directories. Production LOC unchanged.
…ites (#133568) The agent-runner execution fixtures handed storePath "/tmp/sessions.json" to the real executeAgentTurn. Production resolution derives the agent database from the store's directory, so those turns created and migrated the machine-wide /tmp/openclaw-agent.sqlite. A stale copy of that file makes unrelated suites fail through the real session accessor the next time OPENCLAW_AGENT_SCHEMA_VERSION is bumped, which is the failure #132960 had to repair across 14 suites. Route the store paths through the existing test/helpers/temp-dir tracker: the auto-reply harness gains makeTestSessionStorePath() beside the tracked agentDir and workspace it already owns, and the two gateway health collector suites, whose resolveSessionStorePathCore mock made real target resolution inspect the same shared database read-only, get their own tracked directories. Production LOC unchanged.
…ites (openclaw#133568) The agent-runner execution fixtures handed storePath "/tmp/sessions.json" to the real executeAgentTurn. Production resolution derives the agent database from the store's directory, so those turns created and migrated the machine-wide /tmp/openclaw-agent.sqlite. A stale copy of that file makes unrelated suites fail through the real session accessor the next time OPENCLAW_AGENT_SCHEMA_VERSION is bumped, which is the failure openclaw#132960 had to repair across 14 suites. Route the store paths through the existing test/helpers/temp-dir tracker: the auto-reply harness gains makeTestSessionStorePath() beside the tracked agentDir and workspace it already owns, and the two gateway health collector suites, whose resolveSessionStorePathCore mock made real target resolution inspect the same shared database read-only, get their own tracked directories. Production LOC unchanged.
What Problem This Solves
Several test fixtures handed real session-store, agent, transcript, and workspace
paths under the shared, machine-wide
/tmp—/tmp/agent,/tmp/session.jsonl,/tmp/sessions.json, and/tmpitself as a workspace directory. Mocking recordingor model execution did not intercept every filesystem consumer: channel execution
calls
deliverPendingDeliveryNotice, which reads the session through the realSQLite accessor and validates its schema.
The result is that unrelated state left on a developer or CI machine silently
changes test outcomes. A stale
/tmp/openclaw-agent.sqliteat an older schemaversion made suites fail with a migration error that has nothing to do with the
code under test, and passing runs only proved that nobody had left such a file
behind yet.
Why This Change Was Made
Route those fixtures through the existing
test/helpers/temp-dir.tstracker,which creates unique directories under the canonical system temp root (including
macOS
/varsymlink handling). Shared fixture factories register cleanup on thecurrent test via
onTestFinishedon each invocation, rather than import-timehooks that could attach only to the first suite under
isolate: false.No new helper, production seam, schema, configuration, or dependency was added,
and no repository-wide
/tmpreplacement was performed — inert literals thatterminate in mocked readers were deliberately left alone.
Fresh isolated fixtures then exposed two CLI progress tests whose one-second
vi.waitForpolling deadline was racing real startup. They now wait on the actualcallback through the existing deferred helper, keep their exact ordering
assertions, and release/drain the run on failure. No timeout was raised, assertion
weakened, mock broadened, retry added, or test skipped.
User Impact
None at runtime. Production LOC is unchanged (+0/-0); every changed line is test
or test-support code. The change removes a class of false failures that cost
maintainers time to diagnose.
Evidence
Failing-first, in the original execution order: with a synthetic
/tmp/openclaw-agent.sqliteatuser_version=17present,run-channel-turn.finalizefailed 5/19 on unmodified source with the schema-17 migration error raised at
src/state/openclaw-agent-db-schema-helpers.ts:265, through the read-only sessionaccessor and pending-delivery notice. With the same stale database present, the
repaired suite passed 19/19. The operator's real database was preserved by
rename and restored with SHA-256 and inode verification.
Blast radius: all 29 call sites of the three changed fixture factories were
enumerated, including two integration suites in
src/agentsthat the originallane runs did not cover. Re-validated on the rebased head:
The two failures were the first-case tests in
agent-runner-execution-cli-commentary.test.tsandagent-runner-execution-cli-progress.test.ts. Subsequent review reproduced themin a fresh two-suite process and traced them to missing model-input metadata in
the execution fixture, which triggered real provider catalog discovery. The
progress case uses mocked CLI events; the commentary case invokes a real local
scripted JSONL subprocess. Warm reruns and the earlier clean A/B did not establish
host load as the root cause.
The fixture correction is tracked separately in #132988 because this PR merged
while the extended verification was running. With that correction, a new empty
Vitest module cache passed 18/18 CLI tests; all 40 affected files passed 723 tests.
See the corrected review evidence.
Per-suite validation with the stale database deliberately present passed 310 tests
across all 14 changed suites plus
test/helpers/temp-dir.test.ts. Fresh$autoreviewon the final edit reported no accepted or actionable findings.