Skip to content

feat: fold assistant process details#120

Open
zhudatou630 wants to merge 1 commit into
agegr:mainfrom
zhudatou630:codex/process-details-folding
Open

feat: fold assistant process details#120
zhudatou630 wants to merge 1 commit into
agegr:mainfrom
zhudatou630:codex/process-details-folding

Conversation

@zhudatou630

Copy link
Copy Markdown
Contributor

Summary

  • Collapse completed intermediate assistant process messages under a Process details disclosure.
  • Keep the final answer visible and keep the currently-running tail expanded.
  • Hide empty completed thinking blocks and use English UI labels to match the existing app style.

Why

Long tool-heavy conversations become hard to scan when every intermediate thinking/tool block stays fully expanded. Folding completed process details keeps the answer readable without losing access to the underlying work.

Validation

  • node --test lib/message-display.test.mjs
  • node_modules/.bin/tsc --noEmit
  • npm run lint

@zhudatou630 zhudatou630 marked this pull request as ready for review July 5, 2026 15:14
Copilot AI review requested due to automatic review settings July 5, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces shared helpers and UI logic to collapse completed assistant “process” content (thinking/tool calls and intermediate messages) into a “Process details” disclosure, while keeping the final answer visible and hiding empty completed thinking blocks to improve scanability of long conversations.

Changes:

  • Added lib/message-display.ts utilities to filter/hide empty completed thinking blocks and split assistant blocks into “answer” vs “process”.
  • Updated MessageView to use the new displayable-block filtering and skip rendering empty completed assistant messages.
  • Updated ChatWindow rendering to group intermediate messages and non-answer assistant blocks under a collapsible “Process details” section.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
lib/message-display.ts New helper utilities for filtering/splitting assistant content blocks and counting tool calls.
lib/message-display.test.mjs Unit tests for the new message-display helper behavior.
components/MessageView.tsx Uses displayable-block filtering and hides empty completed assistant messages.
components/ChatWindow.tsx Adds folding/grouping UI and logic to keep final answers visible while collapsing process details.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/message-display.ts
Comment on lines +22 to +31
export function splitFinalAssistantBlocks(
message: AssistantMessage,
options: DisplayOptions = {},
): { answerBlocks: AssistantContentBlock[]; processBlocks: AssistantContentBlock[] } {
const blocks = getDisplayableAssistantBlocks(message, options);
return {
answerBlocks: blocks.filter(isFinalAnswerBlock),
processBlocks: blocks.filter((block) => !isFinalAnswerBlock(block)),
};
}
Comment thread components/ChatWindow.tsx
Comment on lines +47 to +52
function assistantTextLength(message: AgentMessage): number {
if (message.role !== "assistant") return 0;
return ((message as AssistantMessage).content ?? [])
.filter((block) => block.type === "text")
.reduce((sum, block) => sum + block.text.trim().length, 0);
}
Comment thread components/ChatWindow.tsx
Comment on lines +98 to +100
<button
onClick={() => setExpanded((v) => !v)}
style={{
Comment on lines 296 to 300
const time = showTimestamp ? formatTime(message.timestamp) : null;
const blocks = message.content ?? [];
const blocks = getDisplayableAssistantBlocks(message, { isStreaming });
const [hovered, setHovered] = useState(false);
const [copied, setCopied] = useState(false);
const streamStartRef = useRef<number | null>(null);
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.

2 participants