Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 7, 2025

Remove bounding box/collapse and render reasoning with a heading and persistent timer.

Summary

  • Render a "Thinking" heading with codicon and a persistent timer while streaming.
  • Display reasoning content as italic Markdown beneath the heading.
  • Persist timer metadata on the message (startedAt, elapsedMs) via updateMessageReasoningMeta.

Changes

  • webview-ui/src/components/chat/ReasoningBlock.tsx
    • Renders a "Thinking" heading and a timer (seconds).
    • Italic Markdown for reasoning content.
    • Posts updateMessageReasoningMeta on start and when streaming stops.
  • webview-ui/src/components/chat/ChatRow.tsx
    • Uses simplified ReasoningBlock props: { content, ts, isStreaming, isLast, metadata }.
  • src/core/webview/webviewMessageHandler.ts
    • Handles updateMessageReasoningMeta to persist reasoning metadata on a specific message.

Typing

  • Add updateMessageReasoningMeta to the WebviewMessage type with payload:
    { messageTs: number; reasoningMeta?: { startedAt?: number; elapsedMs?: number } }.

i18n

  • Uses keys: chat.reasoning.thinking and chat.reasoning.seconds (ensure coverage across all webview-ui locales).

Notes

  • Removed the prior bounding box, collapse behavior, and animated transitions in ReasoningBlock.
  • Prefer Tailwind utility classes and VS Code theme variables over inline styles and arbitrary pixel spacing.

Testing

  • webview-ui: all tests passing
  • src: all tests passing

Screenshot:

image

@roomote roomote bot requested review from cte, jr and mrubens as code owners September 7, 2025 04:23
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused labels Sep 7, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like debugging in production - technically possible but morally questionable.

* Render reasoning as simple italic text, matching how <thinking> content is shown.
* No borders, boxes, headers, timers, or collapsible behavior.
*/
export const ReasoningBlock = ({ content }: ReasoningBlockProps) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing test coverage for this component. Even though it's simpler now, would it make sense to add basic tests to ensure it renders correctly and maintains the expected styling?

)}
{isCollapsed ? <CaretDownIcon /> : <CaretUpIcon />}
</div>
<div className="px-3 py-1">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding accessibility support here. Since we're relying solely on visual styling (italic text) to distinguish reasoning content, could we add an ARIA label or role to help screen reader users? Something like:


const { mcpServers, alwaysAllowMcp, currentCheckpoint, mode, apiConfiguration } = useExtensionState()
const { info: model } = useSelectedModel(apiConfiguration)
const [reasoningCollapsed, setReasoningCollapsed] = useState(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The state and are no longer used after the simplification. Should we remove this unused import and state declaration?

}
}, [thought, prevThought])

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice documentation! Could we expand it slightly to explain the design rationale? For example:

{isCollapsed ? <CaretDownIcon /> : <CaretUpIcon />}
</div>
<div className="px-3 py-1">
<div className="italic text-muted-foreground">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider using a more semantic class name for better maintainability. Instead of just , perhaps or ? This would make the styling intent clearer:

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 7, 2025
@hannesrudolph hannesrudolph force-pushed the feature/flatten-reasoning-italic-thinking branch from 00afe75 to ea322fd Compare September 8, 2025 21:13
…fect guard; add ReasoningMeta typing; reduce any casts
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 8, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 8, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Sep 8, 2025
- Remove unnecessary persistence logic for timer state
- Remove updateMessageReasoningMeta handler from webviewMessageHandler
- Remove ReasoningMeta type and related fields from WebviewMessage
- Keep simple ephemeral timer that runs while reasoning is active
- Only show timer when elapsed time is greater than 0
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants