Skip to content

fix(ui): the chat header's agent menu moves into the messages' column when it does not fit beside them - #6729

Merged
jezekra1 merged 2 commits into
mainfrom
fix/6728-chat-header-agent-menu
Nov 19, 2026
Merged

jezekra1 merged 2 commits into
mainfrom
fix/6728-chat-header-agent-menu

Conversation

@dam-application

@dam-application dam-application Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

  • The flanking layout depends on the fit and on the width. The @5xl/chat: grid classes on the header row, its start and its end apply only when headerFlanks says that both sides fit.
    Below the @5xl breakpoint 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 a ResizeObserver on the header, the start and the end measures again.

Where to look closely

  • naturalWidth adds 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.
  • The geometry constants in lib/classic-chat-layout.ts repeat 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

  • A CSS-only fix. A container query cannot see the width of the content, and a wider first grid column would move the header's middle column off the messages.
  • Truncating the name to fit the margin. The issue asks for the whole menu to stay visible.

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.

Before, 1050px
After, 1050px

The same chat, an agent with a long name.

Before, 1050px, long name
After, 1050px, long name

A 1700px chat where the menu fits beside the messages: no change from today (AC-2).

After, 1700px

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:

  1. Sign in as dev / dev, and accept the Terms of Use if asked.
  2. Open the agent "Release notes and changelog writer" in the sidebar, with the sidebar expanded.
  3. Make the window narrower until the chat is a little over 1024px wide. The agent menu moves into the messages' column. Make it wider again, and it moves back beside the messages.

Taken in that install. A 1060px chat, where the menu does not fit beside the messages:

Demo, 1060px chat

A 1700px chat, where it fits, with no change from today:

Demo, 1700px chat

Testing

  • mise run check passes.
  • mise run test stops on vm-runner boot::tests::an_entry_holding_a_locked_file_is_kept_whole, which fails in this sandbox on main too. This change does not touch vm-runner.
  • mise run //packages/ui:test, run on its own: 341 files, 2270 tests pass.
  • New tests: headerFlanks cases 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 on main.
  • In Chromium, before this change the start of the header began 155px (short name) and 245px (long name) past the chat's left edge at 1050px. After it, the start begins 150px inside the chat.

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

dam-application Bot and others added 2 commits November 19, 2026 10:55
… 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>
@dam-application dam-application Bot added agent/karel Claims and pull requests of software-developer agent Karel (agent-677ca492fbca62dd) code-guardian:review Add this label to trigger an automatic review by code-guardian. qa:design labels Nov 19, 2026

@dam-code-protector dam-code-protector Bot 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.

🛡️ 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 naturalWidth adds 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 measure reads width 0 and sets flanks to false. When the chat shows again, its first frame paints the inside layout before the observer sets flanks back. 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

@dam-code-protector dam-code-protector Bot removed the code-guardian:review Add this label to trigger an automatic review by code-guardian. label Nov 19, 2026
@dam-application

Copy link
Copy Markdown
Contributor Author

This pull request is ready for review. Code Guardian (code-guardian:review) and design review (qa:design) are requested.

  • The fix: the chat header measures the agent menu. When the menu does not fit in the margin left of the messages, the header uses the narrow layout and the menu moves into the messages' column. When it fits, nothing changes.
  • mise run check passes. The UI tests pass: 341 files, 2270 tests.
  • The demo Environment holds this branch. The steps and screenshots are in the body under Demo.

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

@jezekra1
jezekra1 merged commit 9a8acaa into main Nov 19, 2026
22 checks passed
@jezekra1
jezekra1 deleted the fix/6728-chat-header-agent-menu branch November 19, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/karel Claims and pull requests of software-developer agent Karel (agent-677ca492fbca62dd) qa:design

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI - The chat header's agent menu is cut off under the expanded sidebar

1 participant