Repository navigation
fix(ui): the chat header's agent menu moves into the messages' column when it does not fit beside them - #6729
Conversation
… when the margin is too narrow Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🛡️ Code Guardian 🛡️ — ✅ Code Review @ a98f2fe
PR #6729: fix(ui): the chat header's agent menu moves into the messages' column when it does not fit beside them
Author: dam-application[bot] | Branch: fix/6728-chat-header-agent-menu → main | Changes: +156 −8 (4 files)
Summary
The chat header now measures its start and its end. When either one does not fit its margin, the header moves inside the messages' column, as in a narrow chat.
3 suggestion(s) dropped under the 🟢 budget.
Findings
- ✅ Looks good: In the narrow layout a very long name truncates, and
naturalWidthadds the cut back. Thus both layouts measure the same width, and the header does not flip between them. The comment-types check and the two changed test files (24 tests) pass.
Documentation Check (doc-drift)
- 🟢 Suggestion: The chat-view page still says that only a narrower chat puts the header inside the messages' column. Add the new case: a wide chat whose margin is too narrow for the agent menu or New chat (
docs/architecture/chat-view.md:18).
Issue Fit
✅ No findings.
TypeScript Engineering Review
✅ No findings.
React UI Engineering Review
- 🟢 Suggestion: While the side panel fills the view, the header has no box. Then
measurereads width 0 and setsflanksto false. When the chat shows again, its first frame paints the inside layout before the observer setsflanksback. Skip the measure while the header width is 0 (packages/ui/src/modules/sessions/components/classic-chat-layout.tsx:68).
Verdict
APPROVE — No finding blocks, and the change meets both acceptance criteria of #6728.
Review by Code Guardian 🛡️ · automated code guardian · ibm/aws/claude-opus-5-5 on pi
|
This pull request is ready for review. Code Guardian (
Next: I answer each review round here. Written by this agent — https://dam-dev.apps.dam-cl.fmaas.res.ibm.com/a/agent-677ca492fbca62dd?s=489ca0c7-dcee-4d39-bf14-557f606eeba4 |
In a wide chat, the header places the agent menu in the margin left of the messages.
That margin is only as wide as the space beside the 749px well, about 120px in a chat just over 1024px wide.
When the menu (avatar, name, chevron, Shared badge, running count) was wider than the margin, it spilled past the chat's left edge and under the expanded sidebar, so the person could not open the agent menu.
Now the header measures its start and its end. When either one does not fit in its margin, the header uses the narrow layout, which places both inside the messages' column.
When both fit, the header flanks the messages as before.
Reviewer guide
What changes in substance
@5xl/chat:grid classes on the header row, its start and its end apply only whenheaderFlankssays that both sides fit.Below the
@5xlbreakpoint the result is the same as before, because the container query still gates those classes.headerFlanks(lib/classic-chat-layout.ts) is a pure rule: margin = (header width − 749) / 2 − 16. The start may reach 8px past it (the-mr-2). The end must fit in the margin.useHeaderFlanks(components/classic-chat-layout.tsx) measures in a layout effect on mount, so the first paint is already correct. After that aResizeObserveron the header, the start and the end measures again.Where to look closely
naturalWidthadds back the width that a truncated descendant (for example, the name with an ellipsis) cuts off. Without it, a start that shrinks inside the well would measure narrower than in the grid. The header would then go back and forth between the two layouts.lib/classic-chat-layout.tsrepeat the numbers in the header's class names (minmax(0,749px),gap-x-4,-mr-2). A change to one needs the same change to the other.Ruled out
Screenshots
The real header (the agent menu, the Shared badge and the running count), rendered with the app's built CSS in Chromium, beside a 256px stand-in sidebar (not taken in the app: the before needs
main).A 1050px chat, a shared agent with one running process. Before: only "…red ••• 1 running" shows. After: the menu sits at the messages' edge.
The same chat, an agent with a long name.
A 1700px chat where the menu fits beside the messages: no change from today (AC-2).
Demo
Environment: https://app-issue-6728-688139.env-dam-dev.apps.dam-cl.fmaas.res.ibm.com
This branch is installed there. To try it:
dev/dev, and accept the Terms of Use if asked.Taken in that install. A 1060px chat, where the menu does not fit beside the messages:
A 1700px chat, where it fits, with no change from today:
Testing
mise run checkpasses.mise run teststops onvm-runnerboot::tests::an_entry_holding_a_locked_file_is_kept_whole, which fails in this sandbox onmaintoo. This change does not touchvm-runner.mise run //packages/ui:test, run on its own: 341 files, 2270 tests pass.headerFlankscases at 1024px and 1100px (fits, start too wide, end too wide). The header test now gives the header real widths and checks that a 230px start in a 1050px chat drops the grid classes. That test fails onmain.Fixes #6728
🤖 Generated with Claude Code
Written by this agent — https://dam-dev.apps.dam-cl.fmaas.res.ibm.com/a/agent-677ca492fbca62dd?s=489ca0c7-dcee-4d39-bf14-557f606eeba4