Capability or area
generation-ui — Generation page, session panel + composer (imagent-ui/app/components/GenerationChat.tsx)
Problem
Clicking a different session in the sidebar does not clear the composer.
A draft typed into one session stays in the composer after switching to a
completely different session, and can be sent into the wrong session if
the user does not notice.
createSession already clears the composer correctly:
// GenerationChat.tsx ~line 389
function createSession() {
const reusableSession = sessions.find((session) => session.messages.length === 0);
if (reusableSession) {
setActiveSessionId(reusableSession.id);
setPrompt("");
clearInputImage();
setSidebarCollapsed(false);
return;
}
// ...same pattern for the brand-new-session branch
}
But the two sidebar session-switch handlers only update the active id:
// GenerationChat.tsx ~line 764 (collapsed rail) and ~line 783 (full list)
onClick={() => {
if (sessions.length) {
setActiveSessionId(session.id);
}
}}
Reproducible on main (04c818a):
- Send a prompt in session A so it has content, then create session B.
- Type a draft into Bs composer (do not send it).
- Click session A in the sidebar.
- The transcript correctly switches to A, but the composer still shows
Bs draft, sitting right above an enabled Send button — sending now
would deliver Bs draft into A.
Proposed change
Inside the approved Generation UI files only
(app/components/GenerationChat.tsx):
- Add a small
switchSession(sessionId) helper (mirroring what
createSession already does) that resets the composer (setPrompt(""),
clearInputImage()) whenever the active session actually changes, and
call it from both sidebar click handlers instead of calling
setActiveSessionId directly.
- No-op if the clicked session is already active, so an in-progress draft
is not wiped by re-clicking the current session.
No visual/layout changes — state-management fix only.
Expected agent impact
None — Generation page UI only; no agent, runtime, or benchmark behavior
changes. Switching sessions no longer risks delivering a draft (or an
attached image) into the wrong conversation.
Capability or area
generation-ui — Generation page, session panel + composer (
imagent-ui/app/components/GenerationChat.tsx)Problem
Clicking a different session in the sidebar does not clear the composer.
A draft typed into one session stays in the composer after switching to a
completely different session, and can be sent into the wrong session if
the user does not notice.
createSessionalready clears the composer correctly:But the two sidebar session-switch handlers only update the active id:
Reproducible on
main(04c818a):Bs draft, sitting right above an enabled Send button — sending now
would deliver Bs draft into A.
Proposed change
Inside the approved Generation UI files only
(
app/components/GenerationChat.tsx):switchSession(sessionId)helper (mirroring whatcreateSessionalready does) that resets the composer (setPrompt(""),clearInputImage()) whenever the active session actually changes, andcall it from both sidebar click handlers instead of calling
setActiveSessionIddirectly.is not wiped by re-clicking the current session.
No visual/layout changes — state-management fix only.
Expected agent impact
None — Generation page UI only; no agent, runtime, or benchmark behavior
changes. Switching sessions no longer risks delivering a draft (or an
attached image) into the wrong conversation.