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:
1 parent
ef1aad8776
commit
1bbb642973
13 files changed
+171
-407
No files matched your search
@@ -108,28 +108,6 @@ sealed class SessionEvent {
|
||||
val turnStart: Long? = null,
|
||||
) : SessionEvent()
|
||||
|
||||
/**
|
||||
* A task the session started in the background reporting back: a subagent that has finished, or
|
||||
* a backgrounded command.
|
||||
*
|
||||
* It is a message the session *received*, and the turn it wakes up and runs follows it. Without
|
||||
* a row for it, that turn's reply met the previous one with nothing in between and the two were
|
||||
* folded into a single message -- one answer running straight into the next mid-sentence.
|
||||
*/
|
||||
data class TaskNote(
|
||||
/** The tool call it belongs to; a subagent is named by that id. */
|
||||
val about: String,
|
||||
/**
|
||||
* What the reader knows the task as -- a subagent's title. Null for a backgrounded command,
|
||||
* which its own summary names; the row says so rather than inventing a title.
|
||||
*/
|
||||
val title: String?,
|
||||
/** How it ended, in the CLI's word: "completed", "failed", "cancelled". */
|
||||
val status: String,
|
||||
/** What it said on the way out, where it said anything. */
|
||||
val summary: String?,
|
||||
) : SessionEvent()
|
||||
|
||||
/**
|
||||
* A command the session was asked to run on itself and cannot run yet. Resolved by
|
||||
* [CommandSent] with the same id; a command that ran straight away has only that one.
|
||||
@@ -274,13 +252,6 @@ fun parseSeqEvent(json: String): SeqEvent {
|
||||
body.getString("text"),
|
||||
if (body.has("turnStart")) body.getLong("turnStart") else null,
|
||||
)
|
||||
"taskNote" ->
|
||||
SessionEvent.TaskNote(
|
||||
about = body.getString("about"),
|
||||
title = body.optString("title").ifEmpty { null },
|
||||
status = body.getString("status"),
|
||||
summary = body.optString("summary").ifEmpty { null },
|
||||
)
|
||||
"commandQueued" ->
|
||||
SessionEvent.CommandQueued(body.getString("id"), body.getString("text"))
|
||||
"commandSent" -> SessionEvent.CommandSent(body.getString("id"), body.getString("text"))
|
||||
|
||||
Reference in new issue
Block a user