Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 28, 2025

This PR implements the feature requested in #6309 to automatically expand the last reasoning block so users can see the model's thinking process as it happens.

Changes Made

  • Auto-expand last reasoning block: The reasoning block is now initialized as expanded when it is the last message in the chat
  • Auto-collapse when no longer last: Added a useEffect hook that automatically collapses reasoning blocks when they are no longer the last message
  • Comprehensive tests: Added unit tests to verify the new behavior works correctly

Implementation Details

The implementation follows the approach suggested in the issue:

  • Modified the initial state of reasoningCollapsed in ChatRow.tsx to check if the message is the last one and is a reasoning message
  • Added a useEffect that monitors changes to the isLast prop and collapses reasoning blocks when they're no longer the last message

Testing

  • All existing tests pass ✅
  • New tests added specifically for this feature ✅
  • Linting and type checking pass ✅

Acceptance Criteria Met

✅ Given the reasoning block is the last message, then the reasoning block default state is expanded
✅ Given the reasoning block is no longer the last message, then the reasoning block automatically collapses

Fixes #6309


Important

This PR auto-expands the last reasoning block in a chat and collapses it when it's no longer the last, with comprehensive tests added.

  • Behavior:
    • Auto-expand last reasoning block in ChatRow.tsx when it is the last message.
    • Auto-collapse reasoning block in ChatRow.tsx when it is no longer the last message.
  • Implementation:
    • Modified reasoningCollapsed state initialization in ChatRow.tsx to check if the message is the last and is a reasoning message.
    • Added useEffect in ChatRow.tsx to monitor isLast prop changes and collapse reasoning blocks accordingly.
  • Testing:
    • Added unit tests in ChatRow.spec.tsx to verify auto-expand and auto-collapse behavior.
    • Tests ensure non-reasoning messages are unaffected and manual toggle of reasoning block is possible.

This description was created by Ellipsis for ddef204. You can customize this summary. It will automatically update as commits are pushed.

- Initialize reasoning block as expanded when it is the last message
- Add useEffect to auto-collapse reasoning blocks when they are no longer the last message
- Add comprehensive tests for the new behavior

Fixes #6309
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 28, 2025 20:08
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 28, 2025
@roomote roomote bot mentioned this pull request Jul 28, 2025
4 tasks
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 28, 2025
@diwakar-s-maurya
Copy link

I tested it. It works as expected.

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 30, 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 Jul 30, 2025
@daniel-lxs
Copy link
Member

Closing, please see #6309 (comment)

(Also this PR didn't work for me at all)

@daniel-lxs daniel-lxs closed this Jul 30, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Jul 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Let user read the last reasoning block

5 participants