Skip to content

fix(web): show the whole last turn in the Claude response viewer's brief view - #400

Open
shenlvkang-collab wants to merge 1 commit into
Ark0N:masterfrom
shenlvkang-collab:pr/claude-viewer-last-turn
Open

fix(web): show the whole last turn in the Claude response viewer's brief view#400
shenlvkang-collab wants to merge 1 commit into
Ark0N:masterfrom
shenlvkang-collab:pr/claude-viewer-last-turn

Conversation

@shenlvkang-collab

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #369. The eye button's brief view rendered data.text, which is one row: the last assistant row of the transcript. A Claude answer is a median of 3 model messages (p90 11) split around tool calls, so the brief view usually showed the tail of an answer ("Done.", "Let me look.") while the substance appeared only after More. The full view was fine, which is why the brief one read as broken by comparison.

  • The brief view now asks ?context=turn. The Claude reader answers with the assistant messages of the last answered turn (selectLastAnsweredTurn() in response-viewer-transcript.ts: the highest turn that has an assistant row, so a prompt queued after the answer does not blank the view), and the frontend renders them exactly as the full view renders that turn — one badge, then continuation segments, gated on the numeric turn as before.
  • data.text is unchanged in every context — still the last assistant row, never messages.at(-1) — because agent pollers hash it (skills/codeman/preamble.sh).
  • Readers that emit no turns (Codex, the pane parser, DeepSeek, an older server) return text only for context=turn, and the brief view keeps its single card for them. The terminal-buffer fallback is untouched.

Docs: skills/codeman/reference/endpoints.md (new row), docs/architecture-invariants.md (the viewer paragraph). Changeset: patch.

Test plan

  • test/routes/session-routes-claude-last-response.test.ts: context=turn returns the last answered turn's assistant rows (not the queued prompt after it) with text still the last row; empty list before the first answer.
  • test/response-viewer-last-turn.test.ts (new): the pure selector (highest answered turn, no numeric turns → empty, turn 0 kept) and the brief view in jsdom (requests context=turn, one badge + segments, falls back to text, ignores user/blank rows).
  • test/response-viewer-turn-segments.test.ts, test/response-viewer-transcript.test.ts unchanged and green.
  • tsc --noEmit, eslint, prettier.

🤖 Generated with Claude Code

https://claude.ai/code/session_01McLWqCWBuQYGuPMScb4Aou

…ief view

The eye button rendered `data.text`, which is one row: the last assistant
row of the transcript. A Claude answer is a median of 3 model messages
(p90 11) split around tool calls, so the brief view usually showed the tail
of an answer ("Done.", "Let me look.") and the substance appeared only after
More. The full view was fine, which is why the brief one read as broken by
comparison.

The brief view now asks `?context=turn`. The reader answers with the
assistant messages of the last ANSWERED turn (`selectLastAnsweredTurn`: the
highest `turn` that has an assistant row, so a prompt queued after the
answer does not blank the view) and the frontend renders them exactly as
the full view renders that turn: one badge, then continuation segments,
gated on the numeric `turn` as before.

`data.text` is unchanged in every context — still the last assistant row,
never `messages.at(-1)` — because agent pollers hash it. Readers that emit
no turns (Codex, the pane parser, DeepSeek, an older server) return `text`
only for `context=turn`, and the brief view keeps its single card for them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01McLWqCWBuQYGuPMScb4Aou
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