Skip to content

fix(session): persist peer-channel cursor and inbox across resume - #584

Merged
justrach merged 1 commit into
release/v0.0.268from
cursor/session-crosstalk-554f
Aug 20, 2026
Merged

fix(session): persist peer-channel cursor and inbox across resume#584
justrach merged 1 commit into
release/v0.0.268from
cursor/session-crosstalk-554f

Conversation

@justrach

@justrach justrach commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Why

Codex keeps a thread cursor and reuses prompt_cache_key on compact/resume. OpenCode pages session parts from a cursor and keeps side-channel state out of the next request (promptCacheKey = session id). Claude Code’s SendMessage inbox 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. /resume starts 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

  • Persist chan_off, device_off, and peer_inbox on .session.json.
  • Save strips perishable [peer] / [presence] injects from messages. Resume restores the mailbox and injects at most one wake if something is still unread.
  • Legacy files with no cursor, and -p one-shots, still seek both rooms to the tail (the measured ADR 0004 failure).
  • hasMeaningfulState, sessionTitle, and firstUserTitle ignore peer injects.
  • ADR 0014 records the decision.

No catalog change, no SDK regen.

Test plan

  • Filtered zig build test after a fresh compile of the new modules (exit 0)
  • Unit coverage: inbox JSON round-trip, wake stripping, human-turn filter, room-cursor adopt, peer-only wake is not meaningful state
  • /resume of a session that heard a peer: no replay of the last 10 room lines; inbox bodies still pullable
Open in Web Open in Cursor 

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
justrach marked this pull request as ready for review August 20, 2026 08:59
@justrach
justrach merged commit 24390f4 into release/v0.0.268 Aug 20, 2026
6 checks passed
@justrach
justrach deleted the cursor/session-crosstalk-554f branch August 20, 2026 09:01
@cursor
cursor Bot restored the cursor/session-crosstalk-554f branch August 20, 2026 09:15
@cursor
cursor Bot deleted the cursor/session-crosstalk-554f branch August 31, 2026 01:31
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.
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.

2 participants