Skip to content

fix(chat): keep Process details open when a turn ends in an error (#906) - #1124

Open
agegr wants to merge 1 commit into
mainfrom
fix/process-details-error-turn
Open

agegr wants to merge 1 commit into
mainfrom
fix/process-details-error-turn

Conversation

@agegr

@agegr agegr commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Reproduced on main with the turn from #906: an assistant message with thinking, 2067 chars of text and a trailing tool call, then four empty stopReason: "error" replies. The final-answer lookup falls back to the last error message, whose error notice made the turn count as answered, so Process details started collapsed and hid the only text the turn wrote.

  • lib/message-display.ts: new pure collapsesProcessDetails(answer) — true only when the answer shown has non-blank text or an image.
  • components/ChatWindow.tsx: the group's defaultExpanded and its remount key use it instead of !finalAnswerMessage.
  • Turns ending on an error or truncation notice alone keep Process details open (the notice still renders as before); turns with a real answer, including partial text before an error, collapse as today.
  • The requested "default collapsed/expanded" setting is not added.

Tests: lib/message-display.test.mjs (null, empty error answer, truncated thinking-only, whitespace text → false; text, image, partial text before an error → true), updated regexes in components/ChatWindow.process-details.test.mjs. demo/lib/message-display.ts mirrored (was identical). tsc, eslint, npm test pass.

Refs #906

🤖 Generated with Claude Code

A turn of [text + trailing tool call] followed by empty error replies
has no answer to show: the final answer lookup falls back to the last
error, whose notice made the turn count as answered, so Process details
started collapsed and hid the only text the turn wrote. They now start
collapsed only when the shown answer has text or an image
(collapsesProcessDetails); an error or truncation notice alone keeps
them open. The notice itself renders as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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