fix(flow-chat): stabilize tool card collapse behavior - #2367
Merged
Conversation
Keep auto-managed completed file cards on the compact preview from the first completed render through collapse unmount. This prevents transient expanded diff height from advancing the tail-follow target and moving earlier chat content upward. Preserve the full diff preview for manually expanded cards and cover both completion and collapse transitions in tests.
Keep TodoWrite cards collapsed while tasks stream or change status. Preserve expansion only after an explicit user toggle and cover the behavior with focused interaction tests.
Register workspace menu, option, divider, and active state descriptors so the Appearance contract audit recognizes the existing DOM markers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
automatic collapse.
explicitly expanded by the user.
Type and Areas
Type:
Regression fix / UI/UX / test
Areas:
Web UI / FlowChat tool cards
Motivation / Impact
Completed file cards could briefly switch from the compact preview to the
larger diff preview before collapsing. Tail-follow interpreted this transient
height increase as new output and moved earlier chat content upward.
File cards now retain their compact preview from the first completed render
through collapse unmount. Manually expanded cards still show the full diff
preview.
TodoWrite cards previously remained expanded while all tasks were pending.
They now stay collapsed throughout streaming and task-status updates. Expansion
changes only in response to an explicit user click.
Verification
Passed:
pnpm --dir src/web-ui exec vitest run src/flow_chat/tool-cards/FileOperationToolCard.test.tsx src/flow_chat/tool-cards/useToolCardHeightContract.test.tsx --pool=threads --maxWorkers=1pnpm --dir src/web-ui exec vitest run src/flow_chat/tool-cards/TodoWriteDisplay.test.tsx src/flow_chat/tool-cards/useToolCardHeightContract.test.tsx --pool=threads --maxWorkers=1FileOperationToolCard.tsxandTodoWriteDisplay.tsxgit diff --checkNot run:
state and do not change transport or persisted data contracts
Reviewer Notes
The file-card fix intentionally changes preview selection rather than adding
scroll compensation or modifying the FlowChat follow/hold rules. This prevents
the transient height from entering viewport geometry in the first place.
TodoWrite no longer has an automatic expansion state. User-selected expansion
is preserved across subsequent streaming updates.
Checklist