Repository navigation
fix(ui): switch tasks without a footer jump or transcript flash - #5683
Conversation
Switching tasks in the sidebar produced two visual glitches. The composer's permission button unmounted for 1-6 frames, shifting the model controls 34px left and back. The boundary read for the new session only starts once its transcript is published, and while it is in flight the surface fails closed (apache#1611), which the shell expressed by withholding onPermissionModeChange. PermissionModeSelect now accepts no mode: it keeps its place, shows a neutral shield, names no mode, and is disabled. The shell always passes the handler, so pending, unreadable, external and shared sessions share that one state; the surface's fail-closed semantics and the other gates on localInteractionAvailable are unchanged. The composer's `?? 'ask'` fallback, which would have announced Auto for an unknown boundary, is gone. The transcript went blank, painted the new task from its top, went blank again, then jumped to the tail: the new virtualizer mounts before it knows its viewport, and the swap's fade started at mount. The scroll authority now reports when a list is in place (viewport measured and the reader where the last command put them, bounded by the settle budget), and the swap stays transparent until then; the fade runs from that frame. The swap's session key existed only to restart the animation on mount and is removed; the virtualizer keeps its generation key for its measurement cache. Also drops a dead fallback-mode branch at the surface call site. Generated-by: Claude Code
The task, workspace and session-health recovery notices render beside the transcript, outside the swap, so on a task switch they appeared (or blinked out for a couple of frames and back) while the new transcript was still hidden. They now share the swap's hidden-until-placed state and its fade, through a sibling selector on the chat view root: no new signal, and a view without a transcript list shows them as before. Generated-by: Claude Code
51c983b to
a196c68
Compare
The shell preferred a session's in-flight permission-mode overlay over the boundary surface. Now that the composer control stays mounted and enables itself whenever it has a mode, an overlay that outlived a switch-back or a failed boundary read would show a mode, and accept another change, while the boundary was unknown (apache#1611). The overlay now passes through deriveDesktopExecutionBoundarySurface, which applies it only when the boundary yields a mode, so that function stays the one place that decides which mode the shell shows. Generated-by: Claude Code
The reveal gate armed on every activation. A conversation opened from an empty or loading state has no list yet, so its recovery notices showed with the loading hero, were hidden when the list mounted, and faded back in; and a load slower than the settle budget spent the budget before any list existed. Only an activation that already has Turns (a switch between tasks) now waits to be in place; one without a list is placed at once and its list arrives as it did before. Generated-by: Claude Code
hqhq1025
left a comment
There was a problem hiding this comment.
Reviewed exact head 6067daef6df004b884dccc8120eed42a37159b06. I found no P0-P2 issues.
The change keeps the permission control mounted while the execution boundary is unknown, but disables it and avoids presenting a fabricated mode (packages/ui/src/permission-mode-menu.tsx:87-118, apps/desktop/src/renderer/desktop-execution-boundary-surface.ts:42-51). For transcript switching, the virtualizer now exposes measured readiness, the scroll authority gates reveal on the active pin/restore position with a bounded fallback, and the session swap plus adjacent recovery notices remain transparent until that placement is reached (packages/ui/src/use-chat-scroll.ts:145-198, packages/ui/src/transcript-scroll-authority.tsx:239-245,490-496, apps/desktop/src/renderer/styles/chat-message.css:37-55).
Validation: hosted test and label succeeded; local UI 645/645 and Desktop 2696/2696 passed, as did full typecheck, lint, format, ASF headers, renderer architecture 112/112, E2E budget, production renderer build/stale checks, diff check, and a clean merge tree against current main 276faf1c91fd948dc0fda7124b2e5c5701add544. I also inspected the supplied slow-motion and real-time frame captures; the reviewed flows no longer expose the intermediate transcript positions or footer shift.
Residual scope: I did not independently run packaged Electron E2E or native macOS/Windows builds. The disclosed unavailable-restore/different-start-margin edge remains unexercised, but the inspected control flow did not establish a P0-P2 regression.
Review notice: This review was prepared by an automated review agent operated by hqhq1025 and is published at the direction of AstroHan, who has read these findings and is the human accountable for them.
Summary
Switching tasks in the sidebar caused two glitches, reproducible on every switch.
Composer footer jump. The permission button unmounted for 1–6 frames, so
.maka-model-selection-controlsmoved 34px left and back. The boundary read for the new session only starts once its transcript is published. While that read is in flight, the surface fails closed (#1611), and the shell expressed that by withholdingonPermissionModeChange, which unmounted the button.PermissionModeSelectnow accepts no mode. It keeps its place, shows a neutral shield, names no mode ("Permission mode: Unavailable") and is disabled.localInteractionAvailable(command palette, goal dialog, model picker).?? 'ask'fallback is removed. It would have announced Auto for an unknown boundary.Transcript flash. The sequence was: blank, the new task painted from its top, blank again, then a jump to the tail. The new virtualizer mounts before it knows its viewport, and the swap's fade started at mount, so these intermediate frames were already mostly visible.
whenInPlace: the viewport is measured and the reader is where the last command put them (tail pin or restored reading position). The wait is bounded by the existing settle budget.key={session.id}existed only to restart the animation on mount, so it is removed. The virtualizer keeps its generation key for its measurement cache.Recovery notices. The task, workspace and session-health recovery notices render beside the transcript, outside the swap. On a switch they appeared before the new transcript, and in one direction they disappeared for two frames and came back. They now share the swap's hidden-until-placed state and its fade, through a sibling selector on the chat view root (
.agents-chat-view-root:has(.maka-chat-session-swap…) ~ .maka-chat-recovery-notice). No new signal is added, and a view without a transcript list shows them as before.Only an activation that already has Turns (a switch between tasks) waits to be in place. A conversation opened from an empty or loading state has nothing to hold back: it is placed at once, and its list arrives as it does on
main. The shell's in-flight permission-mode overlay now goes throughderiveDesktopExecutionBoundarySurface, which applies it only when the boundary yields a mode, so a pending change is never shown or re-editable on an unknown boundary.Also drops a dead fallback-mode branch at the surface call site. CI's renderer-architecture ledger records the smaller
app-shell.tsx.Behavior change
Verification
Every composited frame was captured with Electron frame subscription (≈30 fps), with animations on, using real mouse clicks. Left is
main, right is this branch.4× slower, two switches:
compare-4x-slow.mp4
Real time, six switches:
compare-1x.mp4
Measured frame by frame (rAF, 60 frames per switch) in the
chat-prompt-railfixture, switching between a short and a long task. The long task's scrollTop is shown as current/max:main)layout-shifton.maka-model-selection-controlsdata-placedon the frame at the tail; fade 0→1 over ~180ms with no change in positiondata-placed, then fades in on the same frame. Its gap to the last Turn is unchanged at 16px.-1sizes) and aflushSyncreveal were tried and removed, because neither changed the frames above.@maka/uitests: 644/644 pass. Adds unit coverage forwhenInPlace(unmeasured, off-tail pin, pending restore target, settle budget) and for the mode-lessPermissionModeSelect.@maka/desktoptypecheck (incl. storybook), the boundary read-model and recovery-notice tests, renderer architecture (--strict-base), Knip (desktop, ui), Astryx surface inventory and theme drift all pass;npm run formatandnpm run lintare clean.useChatScroll. A smooth centered search reveal fading in while it scrolls is intended motion, as onmain. A load slower than the settle budget on first open behaves as onmainand is out of this PR's scope.mainas well.scrollToponce in that narrow path.AI use
Tool(s) and scope: Claude Code: diagnosis, implementation, tests, frame measurements, and this description.
Checklist
Does this PR entail a change in behavior?