Repository navigation
🤖 tests: add the SessionFiles layer option, the fault layer, and the torn-write and leak tests - #7316
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b0cde1a8c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🟢 e2e stories (Haiku): 14 passed27 agent steps · 7 replayed from cache · 32 model calls · 233.1k tokens (76% cached) All 14 tests in 9 files
e2e 0.20.0 · 3m 4s · web · run artifacts 🟢 e2e Electron stories (Haiku): 3 passed3 agent steps · 3 model calls · 8.0k tokens (32% cached) All 3 tests in 3 files
e2e 0.20.0 · 27.5s · electron · run artifacts 🟢 e2e agent repros (Haiku): no tests selectedSpend: $0.00 of the $1.00 cap (proxy ledger) e2e 0.20.0 · 6.6s · 2 targets (web, phone) · run artifacts |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bdadc9a60d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
5abbf8e to
775296b
Compare
Summary
Tests can now choose the
SessionFileslayer:createTestHistoryService({ files })builds the given layer (Node by default), and a fault layer can cut or fail one write. Two new tests use them: a torn-write test without a child process, and a leak test that finds any history write that skips the service. Test-only.Background
Phase 2 of the agent-loop host-ports refactor puts HistoryService's
node:fscalls behind an Effect service,SessionFiles, with a Node layer for the app and a memfs layer for tests. The change is behaviour-neutral: session files keep their bytes and format, downgrade keeps working, and nothing user-visible changes. This PR is one layer of a GitHub-native stack; each layer keeps the full suite green.Implementation
createTestHistoryService(options?: { files?: Layer }): defaultSessionFilesNode, built once throughbuildSessionFiles(layer)(its own harness module withoutbun:test, because the Jest integration tests loadtestHistoryService.ts), and returned asfiles. Config and the temp root stay on disk. Existing callers get the samenodeSessionFilesobject as before.sessionFiles/faultSessionFiles.testHarness.ts:makeFaults()holds the rules (cutNextWrite(path, { afterBytes }),failNext(api, path, code)), andwithFaults(inner, faults)is a layer that wraps another layer. Each fd and FileHandle maps back to its path, sowriteSync(fd)and handle writes fault too. A cut cannot reachwriteFileAtomic(its temp file goes through the inner layer's own fs), so a pending cut makes it fail with a clear error instead of staying queued. The contract suite gainsdescribeFaultCases, so the fault cases run on both layers.historyService.tornWrite.test.ts: a torn append gets a newline first, never a rewrite. It runs onwithFaults(SessionFilesMemory)and onwithFaults(SessionFilesNode), and checks the exact bytes and that the file keeps its inode.SessionFilesMemorygives the same fixture, and no file or folder exists on disk under the temp root'ssessions/.Validation
historyAppendProvenance.tsfails the torn-write test on both layers. Reverted.node:fs/promisesfails the leak test. Reverted.src/node/services/sessionLocks/backendKill.test.ts("a SIGKILL in a turn recovers as today") can fail on a race that 🤖 tests: let the kill test wait until the new backend releases its turn #7320 fixes. A failed job gets one rerun.Risks
Low: test-only.
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$30.26