Transcript: background task ends weighed from the event; silent ones go onto their call

Merged
TE
3d ago
+1087-65

Background task ends are weighed from the task's own event, not from the reply's text. One worth no response no longer gets a transcript row.

Leo, on the "Background task finished" rows with lone "路" replies under them: "i mean can these possibly be more graceful? im not really sure", then "there's like... background tasks worth responding to and not worth responding to", and on the punctuation rule from #32884: "well there are cases (rare) that you would want to see it".

What changes

acpmux (hub/background_cause.rs, new): one table, WEIGHTS, keyed by task kind and notification status. Kinds are subagent, subagent_step (a call a subagent made), monitor, shell and unknown. The kind comes from Claude Code's task_started line; the status comes from task_notification, plus interim when the notification says the agent "is waiting on its own background work" or that its result "may be interim". The background turn's started record now carries cause: {kind, status, weight, origin?, summary?}. When several notifications arrive before one turn, the heaviest one names the cause. Each kind has its own test, and a further test checks that every kind 脳 status pair resolves (only failed is a failure).

kindcompletedinterimstopped / killedfailed
subagentresultsilentsilentfailure
subagent_stepsilentsilentsilentfailure
monitorsilentsilentsilentfailure
shellresultsilentsilentfailure
unknownresultsilentresultfailure

Pane:

  • silent: the turn draws no row. The call that started the task updates in place, as before, with no new mark, and the agent's reply goes inside the call: it opens under the output, and Find still reaches it.
  • result: the call, or the subagent's done line, gets a small accent dot that stays until the person's next prompt. A reply with something to say still draws as a message.
  • failure: always keeps its line, named by the notification's own summary.

Logs written before acpmux recorded cause draw exactly as they did after #32884.

This reverts #32884's punctuation widening of isBareAgentText, back to #32726's lone ".". That covers the narrowing follow-up too: "路" now draws when it is a real reply, and is hidden only as part of a silent background turn.

Variants

Gallery agent-pane.background-reactions, compare view, background-reaction-look experiment:

  • On the call (default): no row, a new mark for results, the reply inside the call.
  • On the call, no mark: the same without the dot.
  • Named line: steps and interim stops draw nothing; a result is one muted line in the task's own words.
  • Folded run: the current #32884 look.

Picked On the call: it removes the row entirely for what isn't worth a response, and still says "something new finished here" where the work started. That matches how Codex marks a finished agent on its own row and how Claude's task list updates in place, with nothing appended to the chat.

Cost

No new O(rows) work per token. The reply text is gathered once per background turn, when it ends, from that turn's own reply ids. Seeing results on a prompt walks only the fresh reactions. No timers, observers or animation loops are added.

Spec: leo-workspace design/chat-transcript.md (merged). Tests: acpmux hub::background_cause and hub::background_turn; webviews test/agent-pane-background-turns.test.ts (interim, result, failure, silent with no call, subagent report, record parsing), backgroundRuns.test.tsx, visibleMessage.test.ts.

Agent session: agent session

馃 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith 路 Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Background task ends are now weighed from the task's own event instead of the reply's text, so silent ones (a subagent's step, an interim stop, a monitor tick, a stop) draw no transcript row and go onto the call that started them.

  • acpmux records a cause on each background turn's started record, keyed by task kind and status, with the heaviest notification naming the turn.
  • A result marks its call with a small accent dot until the person's next prompt; a failure always keeps a line, named by the notification's summary; a reply with something to say still draws as a message.
  • Reverts #32884's punctuation widening of isBareAgentText back to a lone ..
  • Adds a background-reaction-look experiment with the folded-run arm as the previous look; logs written before acpmux recorded cause draw exactly as before.