Skip to content

fix(ui): show agent edit control and prevent chat horizontal overflow#2002

Open
amit-chaubey wants to merge 1 commit into
kagent-dev:mainfrom
amit-chaubey:fix/ui-agent-details-edit-button-clipping
Open

fix(ui): show agent edit control and prevent chat horizontal overflow#2002
amit-chaubey wants to merge 1 commit into
kagent-dev:mainfrom
amit-chaubey:fix/ui-agent-details-edit-button-clipping

Conversation

@amit-chaubey

Copy link
Copy Markdown

Summary

Fixes the agent edit button being clipped in the Agent Details sidebar when agent names or model strings are long. Moves the edit action into the sidebar header and adds min-w-0 on the chat column to prevent horizontal overflow.

Test plan

  • Open an agent chat and confirm the edit button is fully visible in the Agent Details sidebar
  • Test with a long agent name and model string
  • Confirm the chat area does not scroll horizontally
  • Run UI tests: cd ui && npm test -- AgentDetailsSidebar

Copilot AI review requested due to automatic review settings June 12, 2026 15:27
@amit-chaubey amit-chaubey requested a review from peterj as a code owner June 12, 2026 15:27
@github-actions github-actions Bot added the bug Something isn't working label Jun 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR improves the Agent Details sidebar header/layout to better handle long agent refs and model strings, while also adjusting chat layout containers to prevent horizontal overflow issues. It also adds a dedicated unit test and updates the Jest environment to support responsive hooks in jsdom.

Changes:

  • Refactored AgentDetailsSidebar header to include an always-visible edit control and split agent ref/model into separate truncated lines.
  • Updated chat layout container classes to use min-w-0/flex wrappers for better overflow behavior.
  • Added jsdom matchMedia mock and a new sidebar test validating edit link + long-text rendering.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui/src/components/sidebars/tests/AgentDetailsSidebar.test.tsx Adds coverage for edit link accessibility/name and long agent ref/model rendering behavior.
ui/src/components/sidebars/AgentDetailsSidebar.tsx Refactors sidebar header + truncation behavior; moves edit control to header and separates agent ref/model lines.
ui/src/components/chat/ChatLayoutUI.tsx Adjusts main layout wrapper to flex/min-width constraints to reduce horizontal overflow.
ui/src/components/chat/ChatInterface.tsx Replaces min-w-full with min-w-0 on root container to prevent unwanted horizontal scrolling.
ui/jest.setup.ts Adds window.matchMedia mock required by sidebar responsive behavior under jsdom.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +236 to +237
const agentRef = `${selectedTeam?.agent.metadata.namespace}/${selectedTeam?.agent.metadata.name}`;
const editHref = `/agents/new?edit=true&name=${selectedAgentName}&namespace=${currentAgent.agent.metadata.namespace}`;
Comment thread ui/jest.setup.ts
Comment on lines +35 to +47
Object.defineProperty(window, "matchMedia", {
writable: true,
value: jest.fn().mockImplementation((query: string) => ({
matches: false,
media: query,
onchange: null,
addListener: jest.fn(),
removeListener: jest.fn(),
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
dispatchEvent: jest.fn(),
})),
});
@peterj

peterj commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

thanks for your PR -- can you sign the DCO?

Move the edit action to the Agent Details header so long agent names and
model strings no longer clip it, and constrain the chat column with min-w-0.

Signed-off-by: AmitChaubey <amit.katyayana@gmail.com>
@amit-chaubey amit-chaubey force-pushed the fix/ui-agent-details-edit-button-clipping branch from 4595531 to 6f6c46f Compare June 13, 2026 13:21
@amit-chaubey

Copy link
Copy Markdown
Author

thanks for your PR -- can you sign the DCO?

Done — signed off and force-pushed. Also addressed the two Copilot review comments
(derive editHref from agent metadata + URL-encode, and configurable: true on the
matchMedia mock).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants