Skip to content

feat(desktop): quote selected timeline text into the composer - #55664

Merged
usrnk1 merged 5 commits into
betafrom
timeline-quotes
Oct 19, 2026
Merged

usrnk1 merged 5 commits into
betafrom
timeline-quotes

Conversation

@usrnk1

@usrnk1 usrnk1 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #48664

Related: #53189, #54581 (quoting covers part of each)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Lets you select text anywhere in the session timeline and quote it into the composer, with an optional comment per quote.

  • Selecting text shows a small Quote toolbar. It works across messages, tool output and inline diffs, and with Cmd/Ctrl+A or the app menu's Select All (scoped to the timeline).
  • Only selectable text is quoted, so buttons, titles and timestamps are left out. Table cells are joined with tabs, and diff lines keep their -/+ markers. Over 20k characters the action is disabled with "Selection too long" instead of cutting the text.
  • Placement: up to 3 lines, the toolbar sits above the selection. Taller selections get it at the end you dragged towards. If both ends are off screen it pins to the timeline's bottom. On touch screens it docks to the bottom, out of the way of the system selection menu.
  • Quotes are a new quote composer context item, shown as chips. Hovering a chip shows "Add comment" (or "Edit comment"), and clicking opens the same comment editor used for file comments, anchored to the chip. Alt/⌥-click on Quote adds the quote and opens its comment box focused. Enter with an empty comment keeps the quote with no comment.
  • The model gets each quote as > prefixed lines, followed by the comment if there is one. Quotes are stored in message metadata, so sent messages show them as cards and revert/fork restores them.
  • Quoting is unavailable in shell mode and in child sessions.

How did you verify your code works?

  • bun typecheck in app, session-ui and ui. bun run lint:changed passes.
  • App unit tests for composer and session pass (176), including a new request.test.ts case for how quotes are sent.
  • New e2e cases in timeline-stream.spec.ts: quoting across messages, tables and diffs; toolbar placement (down/up drags, triple-click, select all, resize, touch vs narrow mouse); keyboard (Tab/Escape); the length limit; clearing on outside click; chip comments; and Alt-click. The timeline-stream and session-queue suites pass (83).
  • The quote e2e cases pass 80/80 against the built app at 5 workers with no retries, and the whole timeline-stream.spec.ts file passes fully parallel.
  • The timeline streaming benchmark shows no regression (5 runs each, base vs branch, 30x CPU throttle).
  • Checked manually in the desktop dev build.

Screenshots / recordings

Selection toolbar:

Tooltip with the Alt-click shortcut:

Alt-click opens the quote's comment in the composer:

Quote chips, with the hover hint on a quote without a comment:

Sent message:

Touch screens dock the action to the bottom:

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Fixes #48664

Related: #53189, #54581

@opencode-agent opencode-agent Bot 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.

Looks good. I ran the 8 new quote e2e cases in headless Chromium and all pass. The composer and session unit tests pass (176), and typecheck passes in app, session-ui and ui. In a quick before/after run (screenshots below), the Quote toolbar appears under a selected reply, and Alt-click adds the quote chip with its comment editor open. The base shows no toolbar.

Public API is unchanged. The new quote context item and comment type are internal app/session-ui types, and allowEmpty is an optional prop on LineCommentEditor. The SDK, server API, plugins, config and CLI are untouched.

No blocking concerns.

Fixes #48664
Related: #53189, #54581

Before

After

After

@FlapPearLabs

Copy link
Copy Markdown

Registering a real-user signal for review: I use the Desktop app daily for long agent sessions, and quoting a specific sentence of a previous answer to comment on it is the interaction I reach for most. Today it costs six steps (drag-select, copy, focus composer, paste, hand-wrap in >, then type), and the pasted text arrives indistinguishable from something I typed, so the model gets no structural signal about which part of its turn I'm reacting to. The quote chips plus Alt-click-to-comment path here is the right shape — better than what I would have proposed.

The edge cases in the description are the ones that actually matter in practice: selections crossing message and diff boundaries, excluding buttons and timestamps, and refusing silently-truncated quotes over the length limit.

Follow-up, explicitly not a request to expand this PR: the same surface would be worth exposing to plugins eventually, because the three missing pieces are also what several neighbouring requests need (#54002 markdown copy, #55195 pinning a selection):

  • an event when a transcript selection settles, carrying sessionID / messageID / partID and the selected range, so a plugin does not have to scrape the DOM;
  • a slot anchored to that selection — existing slots (session.composer.top, session.panel) are fixed-position, so nothing can currently follow a selection;
  • a Desktop-side equivalent of the TUI's prompt insertion (client.tui.appendPrompt), which plugins such as opencode-quick-reply already use.

None of that needs to land here. I'm only noting it so the selection plumbing this PR builds is not accidentally shaped in a way that closes the door on it later.

Separately: my #56836 is the same request and can be closed as the duplicate it is — sorry for the noise, I should have searched harder before filing.

@usrnk1
usrnk1 changed the base branch from dev to beta October 19, 2026 14:47
@usrnk1
usrnk1 merged commit 02fa738 into beta Oct 19, 2026
19 checks passed
@usrnk1
usrnk1 deleted the timeline-quotes branch October 19, 2026 14:56
@amrkmn amrkmn mentioned this pull request Oct 27, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Quote selected assistant text into the composer

2 participants