Repository navigation
fix(sessions): a recap is not a finished turn; set each turn's summary apart - #4
Merged
Merged
Conversation
Writing a recap, on its own when a session is returned to or with /recap, makes Claude Code say busy for a moment, and /recap, like other slash commands, writes a user line that no reply follows. The island counted both as a turn and announced it done. Now a turn known only from the registry, with nothing typed, said or run, finishes nothing; slash command lines begin no turn here or in AI Agents; and going back to a result already shown is not announced again.
MF-DEEV
marked this pull request as ready for review
October 22, 2026 10:34
In the enlarged page the reply a turn ended on sits under a rule of its own, marked Summary with its time, and the replies written on the way to it are dimmed. Every turn gets its own, so one begun by a slash command, a finished task or a timer never takes the summary from the turn before. A refusal or a cut-off reply is not marked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A recap could mark a session as Done, and announce it, even though no turn ran. A recap is written either automatically when you come back to a session or by
/recap.Causes (both reproduced on a throwaway session)
busyfor about 2 seconds and thenidleagain. The engine treated that as a short turn:busybegan a turn andidleended it as completed./recap, like other slash commands such as/cost, writes a<command-name>/recap</command-name>user line, and its output now goes to asystemline. Both readers took that line for a prompt.Fix
The session still shows Working for the roughly 2 seconds the registry says
busy.Testing
./build.sh --test: every check passes except the known flaky clipboard testTests/NotchCompactTests.swift:337./recaptimeline from a throwaway session (real registry timestamps and transcript):SubagentStophook fired by/recapwere observed live with logging hooks local to that session's folder.Each turn's summary, set apart
In the enlarged session page, the agent's final summary looked the same as the narration it wrote along the way, so it was hard to find.
Change
stop_reasonisend_turnorstop_sequenceis marked as the one that ends the turn. API errors,<synthetic>lines, refusals andmax_tokenscut-offs are not marked. Claude Code writes one content block per line, and every line carries the message'sstop_reason, so the closing text is(text, end_turn)and narration is(text, tool_use). This was checked on real transcripts.Testing
./build.sh --test-suite=sessions: 297 checks pass. New cases cover the reader (narration, two texts on one line, API error, refusal, max_tokens), the engine (new and re-read marked replies) and the grouping (timer turns, a turn begun by/review, a turn still running, an empty chat)../build.sh --testpassed before the last change to the grouping rule. That change touched only Sessions code, and the sessions suite was run again after it.