Repository navigation
test: isolate shared /tmp session-store paths in runner and health suites - #133568
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 6:29 PM ET / 22:29 UTC. ClawSweeper reviewWhat this changesThe PR replaces shared Merge readinessNo blocking introduced defect was found. This focused maintainer-authored test-isolation patch should remain open for normal human landing review after exact-head CI completes. Priority: P3 Review scores
Verification
How this fits togetherTest fixtures supply session-store paths to session resolution, which derives the adjacent agent SQLite target before runner execution or Gateway health projection proceeds. The patch keeps those derived targets within test-owned temporary directories. flowchart LR
A[Test fixtures] --> B[Session-store path]
B --> C[Session target resolution]
C --> D[Adjacent agent SQLite target]
D --> E[Runner and health assertions]
Decision needed
Why: The patch is clean and test-only, but the maintainer label and MEMBER authorship require explicit human handling rather than automated cleanup. Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +26. Total +38 across 5 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the isolated-path approach once a maintainer accepts the test evidence and the required checks are green on this exact head. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: supplied Is this the best way to solve the issue? Yes. Reusing the established tracked temporary-directory helper repairs the path producer before real session-target resolution, rather than masking the resulting database access downstream. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7504a3b3c453. LabelsLabel 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)
|
d52aa39 to
6f8c4fd
Compare
…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.
6f8c4fd to
0d316a9
Compare
|
Merged via squash.
|
…cked-delivery * origin/main: fix(ui): wait for restored draft before clearing (openclaw#133575) fix(deps): update fast-uri security patches (openclaw#133572) test: reduce workflow sanity fixture cleanup time (openclaw#133588) fix(media): normalize detected Matroska MIME (openclaw#133383) refactor(docker): retire ClawDock shell helpers (openclaw#133594) perf(browser): reuse snapshot refs and screenshot metadata (openclaw#133598) perf: load web chat history in larger, faster batches (openclaw#133565) fix(plugins): keep bundled plugins bundled when selected by plugins.load.paths (openclaw#133584) test: isolate shared /tmp session-store paths in runner and health suites (openclaw#133568) fix(cron): avoid no-op schedule repair writes (openclaw#133552)
…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
Resolves a problem where OpenClaw's own test suite writes a shared, machine-wide
SQLite database at
/tmp/openclaw-agent.sqlite, outside any per-test temporarydirectory.
The agent-runner execution fixtures hand
storePath: "/tmp/sessions.json"to thereal
executeAgentTurn. Production resolution derives the agent database from thestore's directory (
resolveSqliteTargetFromSessionStorePath-> dirname/tmp), sothose turns create and migrate
/tmp/openclaw-agent.sqlitethroughopenOpenClawAgentDatabase.That file is harmless while it matches the current schema version. It stops being
harmless the next time
OPENCLAW_AGENT_SCHEMA_VERSION(
src/state/openclaw-agent-db-contract.ts) is bumped: a stale copy left on adeveloper or runner machine then fails every unrelated suite that reaches the real
session accessor, with a migration error from
src/state/openclaw-agent-db-schema-helpers.ts. That is exactly the failure#132960 had to repair across 14 suites, and a remaining producer brings it back.
Why This Change Was Made
Route the leaking store paths through the existing
test/helpers/temp-dirtracker,matching the pattern established in #132960, rather than deleting the shared path
(a cleanup hook would race other suites on the same machine).
The auto-reply harness already owns tracked
agentDir,sessionFile, andworkspaceDirfor these fixtures, so it gains onemakeTestSessionStorePath()helper beside them and the five leaking literals call it.
The same investigation found
src/gateway/health/collector.deadline.test.tsandcollector.legacy-owner.test.tsmockingresolveSessionStorePathCoreto the sameshared
/tmp/sessions.json. Those suites never create the database — they mock theaccessor — but real target resolution still opens
/tmp/openclaw-agent.sqliteread-only to read its owner, so the
store.paththey assert on depends on whethera machine-wide database happens to exist and who owns it. Same invariant, fixed in
the same change.
User Impact
No user-visible or runtime behavior change: test-only, production LOC unchanged.
Developers and CI runners no longer accumulate a shared
/tmp/openclaw-agent.sqlitefrom these suites, so the next agent-schema bump cannot resurrect the cross-suite
failure mode that #132960 cleaned up.
Evidence
Producer located by instrumenting
openNodeSqliteDatabasewith a stack-trace probe(file-append, because vitest swallows
process.stderr.writefrom productionmodules) and running lane groups with the shared file removed:
Regression proof, shared file deleted before each run:
src/auto-replylane created/tmp/openclaw-agent.sqliteat schema 19.src/auto-replylane (6160 tests) leaves it absent.src/auto-reply/reply/agent-runner-execution-{cli-sessions,context-failures}.test.ts: 22/22 pass, file stays absent.src/gateway/health: passes, file stays absent.node scripts/check-changed.mjs: clean.--mode branch --base origin/main):scoped-clean, no accepted findings.Note for reviewers: this host runs several OpenClaw checkouts concurrently, and any
of them recreates the same machine-wide path. File-existence timing is therefore not
attribution here; the stack-trace probe above is.
Follow-up recorded, not in this PR:
test/scripts/docs-sync-publish.test.tspins therelease-notes page list, so each release breaks it on
mainfrom a lane thatrelease PRs do not select (#133557 -> #133581). It should read the versions from the
navigation instead.