Take subagent reports out of the main transcript, and separate turns with a rule

A row per finished background task is a screenful of dividers about work the
reader was not asking after, and one of them turned out to be a whole shell
command drawn as centred prose, because its words came from somewhere with no
reason to keep them short. `Event::TaskNote` is gone entirely, along with the
row that drew it. A subagent's closing report is recorded as that subagent's
own transcript's closing text and is read in the subcard, which is where it
was already going; what the parent gets a row for is a message a subagent
genuinely sends it, which arrives by the peer path and has had one all along.

What remains is the actual defect and the smallest thing that fixes it. The
fold still refuses to grow a settled reply, so a turn boundary is always a
message boundary, and where two replies then abut it puts a `TurnBreak`
between them: a hairline, no words, no colour. Made by the fold rather than
sent by the server, because it is not something that happened -- it is the
boundary between two things that did. `joinPages` puts one in at a page seam,
which the fold never gets to see.

The task notification is still what closes a task in `Status::Waiting`'s
bookkeeping, and the registry lookup that recognises one this translator never
saw start is what makes that work for a session adopted across a restart.

Verified on the emulator: three replies, three rules, and nothing about the
helpers anywhere in the parent. 170 server tests, 85 JVM tests, ktfmt, clippy,
rustfmt and Android lint clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
irisandClaude Opus 5 committed 2026-09-06 21:39:19 -04:00
1 parent ef1aad8776
commit 1bbb642973
13 files changed
+171 -407

No files matched your search

-40
View File
@@ -208,46 +208,6 @@ pub enum Event {
#[serde(default, skip_serializing_if = "Option::is_none")]
turn_start: Option<u64>,
},
/// A task the session started in the background reporting back: a
/// subagent that has finished, or a backgrounded command.
///
/// Recorded because the turn the session wakes up and runs would
/// otherwise have nothing in front of it: two replies met with no row
/// between them and were folded into one, so a phone drew the answer to
/// a question nobody could see as a continuation of the previous
/// sentence. It is drawn as a **divider** rather than as a message --
/// what it marks is the boundary, and the subagent's own words are in
/// the subagent's own transcript, which is where somebody who wants them
/// looks. Repeating them here would be the same text in two places, and
/// the copy is the one that goes stale.
///
/// Its own kind rather than an update to the Task call's row: that row
/// is wherever the call was made, which is above everything the session
/// has said since, and a reader at the bottom of the transcript would
/// never see it change.
TaskNote {
/// The `tool_use` id it belongs to. A subagent is named by that id,
/// so this is also how a phone opens the one that just finished.
about: String,
/// What the reader knows the task as -- a subagent's title. `None`
/// for a backgrounded command, which its own summary names; the row
/// says so rather than inventing a title for it.
#[serde(default, skip_serializing_if = "Option::is_none")]
title: Option<String>,
/// How it ended, in the CLI's word: `completed`, `failed`,
/// `cancelled`. Carried rather than folded into the summary because
/// the summary is absent exactly when things went wrong, and
/// "finished" is the wrong word for a task that was killed.
status: String,
/// What it said on the way out, where it said anything.
///
/// Only ever *shown* for a task with no [`TaskNote::title`], which is
/// a backgrounded command: it has no transcript of its own, so this
/// is the only record there is of it. A subagent's report is recorded
/// as that subagent's own closing text and is not repeated here.
#[serde(default, skip_serializing_if = "Option::is_none")]
summary: Option<String>,
},
/// The manager's record of a question being answered, so a rendered
/// question card resolves on every device rather than only the one that
/// answered.