Repository navigation
Resume paired desktops and the phone from the event journal - #253
Merged
Merged
Conversation
Routines Phase 0: the journal's resume endpoint, retention and the paired sleep test. - The journal gets a stable id, resume() (missed events, or reload when the cursor is from another file, pruned, ahead, or over 10,000 behind), flush subscriptions, hourly retention (7 days or 250,000 rows) and an error path for timed flushes. - With the journal on, the desktop host feeds thread events to paired desktops from the journal with SSE ids. /events?journal=&after= replays what a reconnecting client missed in the same synchronous step that registers the stream. The client drops frames at or below its cursor, closes the stream on sleep and reopens it on wake. A resumed Store window refreshes its lists but keeps its transcripts. - The companion snapshot carries the journal cursor for the selected thread and, given it back, returns only the items that changed. The iPhone app merges them by id and drops the cursor whenever its transcript is replaced. - A stream is now dropped only past 8 MB of backlog, not at the first backpressure, so a replay or a large item no longer forces a reload. Coven-Harness: Claude Code / claude-opus-5-5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Code coverage overviewLanguages: TypeScript TypeScript / code-coverage-agent
View coverage of the 6 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
This was referenced Oct 18, 2026
BunsDev
added a commit
that referenced
this pull request
Oct 19, 2026
… and the routines spec (#310) v0.2.0 was published on 2026-10-18 (23:14Z) from the signed tag on 01b1b8a. This follows Val's status layout (#290): - Shipped gains a v0.2.0 row linking its release and its review. - The 13 "On main, unreleased" items move unchanged to a new "Status summary" at the end of the v0.2.0 review, along with the old In flight entry. Each one was introduced by a commit in the tag (#248, #253, #254, #257 to #261, #263, #264, #266, #267, #269). The CF slices and #283's Markdown parser came after the tag, so they stay. - In flight keeps a short follow-ups entry for the gates no receipt records yet: the independent download checks, the banner upgrade on the release Mac, and the Companion 0.2.0 (7) TestFlight upload. - The routines spec and the README now say Phase 1, and most of Phase 0, ship from v0.2.0. Unchanged: the website's static fallback (apps/site/release.json) and the release evidence, which stay with the release owner. Claimed on #290. Coven-Harness: Claude Code / claude-opus-5-5
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Routines Phase 0, step 1 of the routines spec: the event journal's resume endpoint, retention, and the paired sleep test. Everything stays behind
MODEX_EVENT_JOURNAL=1. With the flag off, nothing changes.What changes
Journal (
event-journal.ts)metatable. A cursor from another file never resumes.resume(id, cursor, { threadId })returns the events after the cursor, read in the same step as the newest cursor. It answers "reload" when the cursor came from another file, was pruned, is ahead of the journal, or is more than 10,000 events behind.subscribe()hands each written batch, with its cursors, to listeners.prune()deletes rows older than 7 days and the oldest rows past 250,000. Modex runs it at startup and every hour. The pruned point is persisted, andlatest()never moves back.onError(Modex turns the journal off) instead of throwing from a timer.Paired desktops (
desktop-host.ts,desktop-client.ts, Store app)id: <seq>. They now arrive up to 250 ms later; the local window is unchanged.GET /events?journal=<id>&after=<cursor>replays what the client missed. The host reads the journal and registers the stream in one synchronous step, so no batch falls between them.powerMonitorsuspend and reopens it on resume.host:reconnected { resumed: true }. The window refreshes its thread list and the selected thread's Changes, but keeps its transcripts instead of reloading them.write()backpressure. That old rule could force a full reload on one large item.iPhone companion (
companion.ts, iOS app)/v1/snapshot?threadId=includesjournal: { id, cursor }, read in the same synchronous step as the transcript.journalandafter, it returns only the items that changed, withdelta: true.Tests
test/journal-resume.test.tsis the paired sleep test. It uses the scripted runner, a real journal, a realDesktopHostwith aDesktopClientover TLS, and the phone's exact HTTPS requests. Turn 1 runs, both clients sleep, turn 2 runs, and both wake. The desktop must resume (not reload) and receive each item exactly once. The phone must receive only the sleep's items, and both transcripts must equal the Mac's. A second test covers a pruned cursor and a stopped journal.test/event-journal.test.ts: resume rules, retention by age and rows across a restart, the 10,000-event limit, subscriptions, and the timed-flush error path.CompanionModelTests.testJournalDeltasMergeIntoTheTranscriptTheyWereReadAgainstcovers the phone's merge and its cursor reset on a thread switch.Verification
pnpm build && pnpm test: all packages pass (desktop 1,426 passed, 0 failed), at load average ~300.playwright test e2e/store-desktop.spec.ts e2e/event-journal.spec.ts: 9 passed.Coven-Harness: Claude Code / claude-opus-5-5