Skip to content

fix(desktop): stabilize composer during session switches and resizing - #5513

Draft
colaforniaw wants to merge 2 commits into
apache:mainfrom
colaforniaw:fix/composer-session-switch-stability
Draft

colaforniaw wants to merge 2 commits into
apache:mainfrom
colaforniaw:fix/composer-session-switch-stability

Conversation

@colaforniaw

@colaforniaw colaforniaw commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Switching Sessions could briefly show controls from the previous Session, while narrow Composer widths could compress the footer into the send button. An empty Composer could also show the branch icon through the translucent disabled Send button.

This change keeps the Composer footer on one row with a 520px minimum conversation width, preserves fixed space for Send, prevents stale session branch state from painting during a switch, and gives the Send/Stop slot an opaque backing while keeping the existing disabled appearance.

The Workbar remains under user control; narrow widths do not automatically move or collapse it.

Before / After

Scenario Before After
Narrow window: Composer footer in desktop
responsive-before.mp4
after-responsive.mp4
Narrow window: Composer footer in workhub
workhub-before.mp4
workhub-responsive-after.mp4
Session switch: stale controls and usage flicker
switch-before.mp4
switch-after.mp4

Review Focus

The Composer/session-switch fixes are the scope of this PR. The following narrow-screen behavior is a known limitation and is intentionally not solved here:

  • With the sidebar closed, the current minimum width leaves enough room for the Composer and Send button.
  • With the sidebar open, the sidebar and Composer compete for the same viewport width; at the narrow edge, the Send button can be clipped.
  • Increasing the native minimum width or synchronizing the renderer's live sidebar width back to the main process would make this PR responsible for a broader layout policy and still would not provide a good narrow-screen experience.
  • Hiding the context-usage control is not the intended product fix; it only masks the space constraint.

Follow-up

Open a separate PR for responsive sidebar behavior:

  • Automatically hide the sidebar below a narrow-screen breakpoint.
  • Restore it when the window becomes wide enough again, but only when it was hidden by the responsive rule; preserve an explicit user collapse.
  • Define the breakpoint against the actual Composer, WorkHub, and Side Chat layout constraints rather than a single hard-coded native minimum.
  • Cover native window resizing, sidebar state restoration, WorkHub/Side Chat, and visual or E2E verification.

This keeps the current PR focused on Composer and session-switch correctness while giving narrow windows the product behavior users expect: sidebar visible when wide and automatically hidden when narrow.

Verification

  • Manual visual verification confirmed the Composer remains single-line, the Send button no longer reveals the branch icon, and Session switching no longer shows stale branch state.
  • git diff --check passed.
  • npm --workspace @maka/desktop run check:architecture -- --base d0dd3edf202f120c5ea950825160dfd02b426145 --strict-base passed, including 112 architecture checker tests.
  • PR CI passed: package and test checks passed.
  • Storybook smoke reached the relevant Composer/WorkHub stories successfully; one unrelated design-system-functional-motion--retained-functional-motion story still reports one CSS animation where zero is expected.
  • Full local typecheck and focused tests were not rerun after the last visual fixes; PR CI is the merge-gate evidence for this change.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex assisted with the Composer behavior, layout, usage state, and regression coverage. The commit carries Generated-by: Codex.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/L Under 1000 readable lines label Sep 19, 2026
@colaforniaw
colaforniaw force-pushed the fix/composer-session-switch-stability branch 7 times, most recently from 0b97612 to fd18a8a Compare September 22, 2026 02:27
@github-actions github-actions Bot added effort/XL Under 2500 readable lines and removed effort/L Under 1000 readable lines labels Sep 22, 2026
@colaforniaw
colaforniaw force-pushed the fix/composer-session-switch-stability branch 11 times, most recently from 45e6d3a to 616208e Compare September 23, 2026 10:37
@colaforniaw
colaforniaw force-pushed the fix/composer-session-switch-stability branch 2 times, most recently from 6665804 to 2dbebdd Compare September 23, 2026 13:15
@colaforniaw
colaforniaw force-pushed the fix/composer-session-switch-stability branch from 2dbebdd to c5897dd Compare September 23, 2026 14:33

@me2seeks me2seeks 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.

Automated review notice: This comment was posted by an automated review agent operated by me2seeks make. It is not an independent human review and does not replace one.

Summary

Stabilizes the Composer across Session switches (permission/usage/model controls no longer flash stale state or unmount) and reworks the footer layout with a 520px conversation floor so narrow widths clip instead of reflowing into Send. The issues are real and the direction (state keyed to session/model/provider, layout floor in a shared token) is right; most changes are well tested.

Findings

  1. [P2] dismissCompanionCopy's idle-wait never observes the dominant idle shape. The break condition session.runningTurnIds?.length === 0 (apps/desktop/src/renderer/features/workbar/tools/side-chat/quote-companion-core.ts:222) is false when the key is absent — and the catalog omits runningTurnIds for idle sessions (apps/desktop/src/main/runtime-host-session-catalog-ipc-main.ts:512-518 returns the summary unchanged when the live list is empty; asserted absent at apps/desktop/src/main/tests/runtime-host-session-catalog-running-turns.test.ts:55; session-local-service.ts:265 sets it undefined for cached sessions). So when stop has already retired the turn — the common case — the loop spins all 40 attempts (~2s, 40 listSessions IPCs) before attempting cleanup. The new test's fake explicitly includes runningTurnIds: [] (apps/desktop/src/main/tests/quote-companion-disposal.test.ts:102), so it passes while production eats a fixed ~2s dismissal stall. Fix: (session.runningTurnIds?.length ?? 0) === 0, and make the fake omit the key in its idle response.
  2. [P3] .maka-composer-send-slot is declared twice with identical properties (apps/desktop/src/renderer/styles/composer.css:331 and :342) — dead duplicate from the two stacked comment blocks; keep one.
  3. [P3] The floating-WorkHub thinking-level sheet e2e block was deleted from apps/desktop/e2e/workhub-layout.spec.ts (old lines ~212-224) with no replacement for sheet interaction/viewport fit; the new NarrowComposerFooter story only asserts the field stays visible. Either restore equivalent coverage or note why it is no longer valid.

Verdict

needs-changes — finding 1 adds a guaranteed ~2s stall on a reachable user flow, and the PR is still a draft.

This branch has not been deployed

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

Labels

effort/XL Under 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants