[Bug]: Cite button never returns for a selection after the timeline scrolls #15700
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/web (web and desktop)
Steps to reproduce#
- Open a thread with a few assistant responses, ideally one where the agent is still streaming.
- Select some text inside a completed assistant response. The Cite button appears next to the selection.
- Without clicking it, scroll the timeline. Scrolling with the wheel or trackpad does it, and so does the timeline following new streamed output.
- Stop scrolling. The text is still selected.
Expected behavior#
Once scrolling settles, the Cite button should come back next to the selection if the selection is still within an assistant response and on screen. If the selection has scrolled out of view, the button should stay hidden until it is visible again.
Actual behavior#
The button disappears on the first scroll and does not come back for that selection. The highlight stays, but there is no way to cite it:
- Right-clicking also dismisses the button, and no context menu has a cite action.
- Tab only focuses the button while it is visible.
- The only recovery is to clear the selection and select the text again. In an active thread, the timeline may keep moving and dismiss it again.
Cause#
observeSelectionActions (apps/web/src/lib/selectionActions.ts) handles scroll on the timeline viewport by calling onDismiss("cancel"). When no button is held, it also sets dismissed = true. After that, selectionChanged() stops rescheduling, so only a new mouseup gesture shows the actions again. selectionActions.test.ts covers this with the "%s dismisses pending actions and ignores a late selectionchange" case for scroll.
Hiding the button during a scroll makes sense, because otherwise it floats at a stale position. The problem is that the dismissal is permanent for the current selection. AssistantSelectionToolbar's update() already recalculates the position from the live range and clears the button when the range is outside the viewport. Re-running it after scrolling settles, and only when no button is held, seems like enough to fix this.
ThreadTerminalDrawer also uses observeSelectionActions, so the change probably belongs behind an option or in the citation toolbar rather than changing terminal behavior as a side effect.
Impact#
Minor bug or occasional failure. It is frequent during streaming, when the timeline moves on its own.
Version or commit#
T3 Code Nightly 0.0.46-nightly.20261004.2648 (5a96895a85b4). The relevant code is unchanged on main @ 4ee6bfd50e.
Environment#
macOS 27.0.1, T3 Code (Nightly) desktop app. The code path is shared by the web client.
Workaround#
Re-select the text. Extending the selection with Shift+Arrow should also bring the button back, because a non-Escape keydown clears the dismissed state. This is based on reading the code and was not checked manually.
Related#
juliusmarminge added labelsbug
juliusmarminge added labelsvia-triage
juliusmarminge closed this
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Triage#
Thanks for the precise write-up, @jlipworth. Your notes on the scroll latch and the terminal split both match the code.
What I found#
Confirmed on
mainat4ee6bfd. I didn't find another issue for this. #12943 is about the selection itself shifting during a drag, and #13334 is about an unsaved citation comment getting dropped. This only affects web and desktop, since mobile has no selection toolbar.onScrollalways callsonDismiss("cancel"). When the mouse button is up it also setsdismissed, and after thatselectionChanged()stops rescheduling, so a laterselectionchangecan't bring the button back. The scroll case inselectionActions.test.tslocks this in.AssistantSelectionToolbarlistens on the timeline wrapper in the capture phase. Wheel, trackpad, and follow-output scrolls all reach that handler, and so do scrolls in nested regions.update()places the button from the live range and hides it when the range is off-screen. Nothing calls it again after a scroll dismissal.ThreadTerminalDraweruses it to open a native context menu, so changing the shared default would affect the terminal too.dismissed, so Shift+Arrow should restore the button. I got that last part from reading the code, not from trying it.Likely fix area#
update()again once scrolling settles, but only when the mouse button is up.A maintainer will decide on the fix direction.