Repository navigation
Description
Symptom
Reported by the project owner on a real TUI session (build 0.0.1-dev.14783+3dfa572.dirty, Windows): after a shell command runs, the following actions (Thought, Write, etc.) are added to the work block that already existed BEFORE the command, instead of opening a new work block after it. Expected: a command closes the current block; actions after the command open a new block.
Mechanism (confirmed in source at tip 3d4c83f0)
packages/tui/src/util/activity.ts - computeActivitySubGroups (comment at ~L222-227) splits one activity group into per-kind blocks "in first-appearance order, merging same-kind calls even when other kinds interleave (read, bash, read -> one Explored block + one Ran block)".
So a sequence like Write, Write, bash, Write produces ONE Edited block that contains writes from both sides of the command, rendered before the Ran block: the post-command write visibly lands in the earlier block. The behavior is locked in by test merges interleaved kinds in first-appearance order in packages/tui/test/activity-header.test.ts (~L103).
Build qualification (not a stale-build artifact)
- The merge-across-interleave rule was introduced by feat(tui): group working blocks by activity kind with typed headers #547 (
060ec355d8, merged 2026-10-23) and is unchanged since. - It is present in the reporter's build (
3dfa572, 2026-10-30) AND in the current tip (3d4c83f0). Same code path in both - "update to tip" would NOT change the behavior.
Expected behavior
Chronological segmentation: a change of activity kind closes the current sub-block, and same-kind work after an interleaving kind opens a NEW sub-block (read, bash, read -> Explored, Ran, Explored (new)). Reasoning attribution stays as-is (reasoning joins the block of the tool call that follows it; trailing reasoning joins the previous block). Sub-block ids must remain stable while a run grows during streaming (e.g. occurrence-indexed ids).
Repro sequence
- In a TUI session, have the agent perform: a file write, then a shell command, then another file write (no user message or visible assistant text in between).
- Observe: the second write joins the
Editedblock above theRanblock. - Expected: three blocks in chronological order - Edited, Ran, Edited (new).
Acceptance
computeActivitySubGroupssegments chronologically; the existing merge test is replaced by an equal-strength test asserting the new order (no assertion weakening).- A rendered TUI test (activity-group harness) proves the on-screen block order Edited -> Ran -> Edited for the repro sequence.
- Behavior validated in a real TUI run before being called fixed.
Activity
fix(tui): open a new work block after each activity-kind change (Refs #…