fix(session): persist peer-channel cursor and inbox across resume - #584
Merged
Conversation
Codex reuses a thread cursor and prompt_cache_key; OpenCode pages session parts; Claude Code's SendMessage inbox lives on disk. Graff's room offsets and parked inbox were process-local, so /resume re-drained the last 10 JSONL lines and titled the session after a [peer] wake. Save chan_off, device_off, and peer_inbox on the session file, strip perishable wakes from messages, and treat peer injects as not a human turn. Legacy files and -p one-shots still seek the rooms to the tail (ADR 0014).
justrach
marked this pull request as ready for review
August 20, 2026 08:59
yermakoffivan
pushed a commit
to yermakoffivan/codegraff
that referenced
this pull request
Aug 31, 2026
Double --suite inhouse with distilled verifiers from merged CodeGraff PRs: hardlink pin (justrach#687), hosted x_search splice (justrach#632), first-turn MCP skip (ADR 0035/0029), rlm showcase gate (justrach#633), codedb five-shot menu (justrach#597), peer-channel resume (justrach#584). Same pattern as the first six — buggy starter + SPEC + visible tests + hidden/ check. Not the live repo.
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.
Why
Codex keeps a thread cursor and reuses
prompt_cache_keyon compact/resume. OpenCode pages session parts from a cursor and keeps side-channel state out of the next request (promptCacheKey= session id). Claude Code’sSendMessageinbox is a file per agent — resume pulls, it does not replay the room.Graff already made peer speech pull (ADR 0004): a one-line
[peer]wake, bodies in a process-local ring. That is cheap inside one process./resumestarts a new one. The JSONL room offsets and the parked inbox reset to zero, so the first drain is treated as a late join and re-injects the last 10 room lines. A peer-only wake also counted as a human turn, so overheard chatter could mint or title a session[peer] 1 unread….What
chan_off,device_off, andpeer_inboxon.session.json.[peer]/[presence]injects frommessages. Resume restores the mailbox and injects at most one wake if something is still unread.-pone-shots, still seek both rooms to the tail (the measured ADR 0004 failure).hasMeaningfulState,sessionTitle, andfirstUserTitleignore peer injects.No catalog change, no SDK regen.
Test plan
zig build testafter a fresh compile of the new modules (exit 0)/resumeof a session that heard a peer: no replay of the last 10 room lines; inbox bodies still pullable