Skip to content

fix(sessions): a recap is not a finished turn; set each turn's summary apart - #4

Merged
MF-DEEV merged 2 commits into
mainfrom
feat/claude-sessions
Oct 22, 2026
Merged

MF-DEEV merged 2 commits into
mainfrom
feat/claude-sessions

Conversation

@MF-DEEV

@MF-DEEV MF-DEEV commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

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)

  • Registry blip. While Claude Code writes a recap, the registry reports busy for about 2 seconds and then idle again. The engine treated that as a short turn: busy began a turn and idle ended it as completed.
  • Slash command line. /recap, like other slash commands such as /cost, writes a <command-name>/recap</command-name> user line, and its output now goes to a system line. Both readers took that line for a prompt.
    • Sessions opened a turn on it.
    • AI Agents counted it as work for up to an hour.

Fix

  • Registry-only turns. A turn known only from the registry, with nothing typed, said or run since, finishes nothing. When the registry goes idle, the session returns to its earlier state.
  • Slash command lines. These lines no longer begin a turn, in Sessions or in AI Agents. Commands that do ask the model, such as skills, still begin a turn with the reply or the registry.
  • Done notices. A notice is sent only for a turn that ended after the work was seen to begin. Going back to a result already shown is not announced again.

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 test Tests/NotchCompactTests.swift:337.
  • New cases cover:
    • the registry-only blip;
    • a recap over a result not yet looked at;
    • slash command lines, in both readers.
  • Replayed through the engine with the exact /recap timeline from a throwaway session (real registry timestamps and transcript):
    • before the fix it raised "Done after 2.7s";
    • after the fix it raises no event.
  • The registry blip and the SubagentStop hook fired by /recap were 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

  • Reader. The last text of an assistant line whose stop_reason is end_turn or stop_sequence is marked as the one that ends the turn. API errors, <synthetic> lines, refusals and max_tokens cut-offs are not marked. Claude Code writes one content block per line, and every line carries the message's stop_reason, so the closing text is (text, end_turn) and narration is (text, tool_use). This was checked on real transcripts.
  • Conversation. That reply sits under a rule in Claude's tint labelled SUMMARY with its time, and its text is brighter. Replies written on the way to it in the same turn are dimmed. Replies of a turn still running are left as they are.
  • Each turn gets its own. A turn begun by a slash command, a finished background task or a timer has no prompt in the conversation. An earlier version grouped by prompt, and there a later short reply took the label from the real summary and dimmed it: 11 of 170 prompts in real transcripts. Marking per turn avoids that, at the cost of a rule on short turn endings such as "back in 10 minutes".

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).
  • A full ./build.sh --test passed before the last change to the grouping rule. That change touched only Sessions code, and the sessions suite was run again after it.
  • Installed and launched as the Developer build. Not yet checked on screen.

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
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.
@MF-DEEV MF-DEEV changed the title fix(sessions): a recap is not a finished turn fix(sessions): a recap is not a finished turn; set each turn's summary apart Oct 22, 2026
@MF-DEEV
MF-DEEV merged commit 932afa7 into main Oct 22, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant