Skip to content

🤖 refactor: route the compaction journal and pending state through SessionFiles - #7314

Merged
ThomasK33 merged 2 commits into
phase2/history-readers-on-filesfrom
phase2/journal-pending-on-files
Oct 23, 2026
Merged

ThomasK33 merged 2 commits into
phase2/history-readers-on-filesfrom
phase2/journal-pending-on-files

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

The continuous-compaction journal, CompactionPendingState and publishCompactionFile make their file calls through the history's SessionFiles. No behaviour changes.

Background

Phase 2 of the agent-loop host-ports refactor puts HistoryService's node:fs calls 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

  • publishCompactionFile(filePath, contents, isCurrent, files = nodeSessionFiles, …): the staged write, renameSync, fsyncParentDirectory and the cleanup rm use files. files comes 4th so existing 3-argument calls keep working.
  • ContinuousCompactionJournalStore and CompactionPendingState take the history's files; the production callers (compactionHandler.ts, workspaceService.ts) pass historyService.files. Cancellation storage passes nodeSessionFiles until the next layer moves it.
  • These modules used the CommonJS fs.promises object, which Bun keeps apart from the node:fs/promises namespace. So the test spies on the staged cleanup and the generation read move to the namespace: 12 in the compaction tests, plus 5 in streamManager.continuousCompaction.test.ts and agentSession.turnCompletion.test.ts. Each moved spy gains a call assertion, so a spy that stops firing fails its test.
  • Three host-import allow pairs go.

Validation

Risks

Low: the publication protocol and its order are unchanged; only the fs object differs.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $30.26

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T09:01:46.931896Z 7da08ec New commits
🔒 Security Review ✅ Completed 2026-10-23T09:02:07.587963Z 7da08ec New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThomasK33
ThomasK33 added this pull request to stack #7318 October 23, 2026 07:15
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

27 agent steps · 7 replayed from cache · 31 model calls · 218.3k tokens (74% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 2 steps · 4 calls 23.7s
🟢 a chat survives a restart of the server 2 steps · 4 calls 23.7s
🟢 compaction.e2e.ts · 1 passed 3 steps · 7 calls 43.5s
🟢 /compact replaces the old chat with a summary 3 steps · 7 calls 43.5s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 9.6s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 9.6s
🟢 settingsRoundTrip.e2e.ts · 1 passed 3 steps · 5 calls 30.0s
🟢 a chat survives trips through Settings 3 steps · 5 calls 30.0s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 7.6s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 7.6s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 2.8s
🟢 the agent opens the playground workspace 2 steps · 1 call 2.8s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 6.9s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 6.9s
🟢 todoNudge.e2e.ts · 1 passed 2 steps · 4 calls 22.1s
🟢 the agent finishes open TODO items after the turn-end nudge 2 steps · 4 calls 22.1s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 27.5s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 4.3s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 6.0s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 4.4s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.1s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 6.6s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.0s

e2e 0.20.0 · 2m 57s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.1k tokens (32% cached)
Spend: $0.01 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 5.6s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 5.6s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 5.7s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 5.7s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 6.7s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 6.7s

e2e 0.20.0 · 20.0s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.3s · 2 targets (web, phone) · run artifacts

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue because a pull request earlier in the stack was removed Oct 23, 2026
…ionFiles

Phase 2 PR 9. publishCompactionFile takes a SessionFiles (default
nodeSessionFiles), ContinuousCompactionJournalStore gets HistoryService's
files, and CompactionPendingState takes the history's files from its two
production callers. Cancellation storage passes nodeSessionFiles until it
moves. The journal now reaches node:fs/promises instead of the CommonJS
fs.promises object, so the twelve test spies that watched the staged
cleanup and the generation read move to the namespace, each with a call
assertion. Three host-import allow pairs are gone.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_
@ThomasK33
ThomasK33 force-pushed the phase2/journal-pending-on-files branch from 6f6c610 to 7da08ec Compare October 23, 2026 08:59
@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit c9ed418 Oct 23, 2026
37 of 38 checks passed
@ThomasK33
ThomasK33 deleted the phase2/journal-pending-on-files branch October 23, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant