Draw a peer message above the turn it started, not below it
The live Claude Code path only learns a turn was another agent's when the turn ends -- the whole of the message arrives as an `origin` object on the `result` -- so the note was appended after everything it caused, and the transcript showed the answer above the question. It cannot be recorded in place: by the time anyone knows, the reply is already written, and the transcript is append-only. So the event carries where it belongs instead. `PeerMessage` gains `turnStart`, the seq of the status that opened its turn, stamped by the pump -- the only thing that knows a seq and the only thing that sees every driver's turns. The phone gives the note that seq, so it sorts into place rather than being drawn out of order at the end. A status draws no row, so there is nothing for it to collide with and the list stays sorted, which the scroll anchor and paging both depend on. Absent where there is nothing to correct: a message replayed out of a session file by `import` is already in the right place, and one that opened no turn has no turn to sit above. Both stay where they arrive. The echo driver gets `/peer-turn` for the live shape, beside `/peer` for the in-place one. Verified on the emulator both ways, live and on replay, plus an ordinary `/tools` turn to confirm the run grouping the insertion cuts through is unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7525fc925a
commit
465645cefb
9 files changed
+246
-13
No files matched your search
@@ -286,8 +286,12 @@ first if a remote spawn ever mangles an argument.
|
||||
cross-session message to a real stream-json session: no `user` record, and
|
||||
nothing in the partial-message stream -- the whole of it is an `origin`
|
||||
object on the `result`, the same shape the session file records, which is
|
||||
why `import::peer_message` reads both. So the note is drawn *after* the
|
||||
reply it caused; that is the wire, not a bug. See PLAN.md.
|
||||
why `import::peer_message` reads both. So it is *recorded* after the reply
|
||||
it caused, and cannot be recorded anywhere else in an append-only log --
|
||||
which is why the event carries `turnStart`, the seq of the status that
|
||||
opened its turn, and the phone draws the note at that seq instead of where
|
||||
it arrived. Exercise it with the echo driver's `/peer-turn`; plain `/peer`
|
||||
is the in-place shape an import replays. See PLAN.md.
|
||||
- **A queued message can be tapped to take it back**, which is
|
||||
`POST /sessions/{id}/unqueue` and a `messageDropped` event -- see PLAN.md's
|
||||
"Taking a queued message back". On a **Claude** session it always refuses,
|
||||
|
||||
Reference in new issue
Block a user