agent pane peer snapshots (8t): the pane's tests of the Mac's copy

Merged
TE
9d ago
+773-0

Lawrence's list item, word for word: "start new VMs from acp chat - decouple persistence of acp trajectories from the VM itself, in case the VM is resuming".

Part of the client-snapshot piece of manaflow-ai/cmuxterm-hq#4381 ("Persistence, pause and resume, and history hydration"): the Mac's acpmux keeps a durable, bounded copy of each peer session's events, so the app paints a paused or offline peer chat at once, marked possibly stale, and catches up from the host with afterSeq. The host's journal stays the authority; the copy is not a write lease, an execution checkpoint or a backup. The shared fenced-writer database from #4381 is not part of this work.

This replaces #25323 (store) and #25378 (hook and pane), split so each piece lands on its own under about 800 changed lines, tests included. The series:

  1. the on-disk form of a copy (#25448, landed)
  2. the store's thread: bounds, writes, removals (#25445)
    2t. the store's tests (#25505)
  3. what starts or grows a copy: generations, joins, links (#25446)
  4. purges, removed peers, the queue's bound (#25447)
  5. the hub's taps (wiring) (#25449)
  6. the read hook _acpmux/peer_snapshot, which the VM start/resume work calls too (#25473)
  7. the pane's offline banner and the reply's reading (#25474)
  8. the pane paints the copy, then catches up (#25475)
    8t. the pane's tests (#25506)
    8t2. tests of 8's attach fixes (#25620)

This PR (8t): the pane's tests of the Mac's copy

The tests of 8 (a peer chat paints the Mac's copy at once, then catches up), split off so each PR stays under the size cap. No code change.

Findings from the earlier reviews these tests hold

P1 to P26 of the ledger, for the code in 8. Held here:

  • a machine back while the copy's attach is out is read again once that attach fails (P17);
  • a session moved to another machine takes the old machine's copy off screen (P18);
  • a copy reply that names another session is never drawn (P18);
  • the back-during-attach test counts exactly one more attach, and none after another flush (P23);
  • a session moved to another machine draws that machine's copy, then its chat (P18, P23);
  • a recreated session drawn from its copy keeps nothing queued of the old one (P19, P23);
  • both replacement tests assert no copied row is left beside the machine's page (P26);
  • a session recreated while its copy is read draws the new session's copy, offline (P25).
  • a tail kept of another machine never joins the chat of the one the row names (P33); a machine back while a tail's attach is out, no copy drawn yet, is read once that attach fails (P34).
  • a tail kept of a machine never joins the chat once the session is on this Mac (P38).

Tests

agent-pane-peer-copy.test.ts, 27 cases, passes on the fleet together with agent-pane-peer-copy-reply (5). The cases: open offline on the copy; continue or replace it when the machine is back, each record once; a recreated session; a copy of another generation; a machine back on an older log; a machine down again; a chat read before; a tail of a recreated session; live records while the chat left detaches; a failed read; recreated while the attach was out; rows naming a recreated session, with and without a copy; pageThrough; a live record twice; back during an attach, with or without a copy drawn; a tail of another machine, or of a machine once the session is on this Mac; moved to another machine; a reply of another session; a chat on this Mac.

Review: Codex (gpt-6-astra, xhigh) SHIP at d01f23aa83b; git patch-id --stable of the diff vs base matches at this head (a4ad0c9e3729), rebased onto 8 as landed (ab883bf9565). The pane's 176 tests and the webview typecheck pass on the fleet with 8 and 8t2.

Timers, threads and loops

None: tests only. The test daemon answers each request once, on a microtask.

Base reds, not from this PR (they fail the same way on feat-cmux-next): bun run check exits 1 there too, and so does gallery-coverage (it lists components that are not from this PR).

Agent session: agent session

šŸ¤– Generated with Claude Code