Skip to content

feat(web): attach selected response text - #5224

Open
darox wants to merge 1 commit into
pingdotgg:mainfrom
darox:codex/chat-annotations-desktop
Open

feat(web): attach selected response text#5224
darox wants to merge 1 commit into
pingdotgg:mainfrom
darox:codex/chat-annotations-desktop

Conversation

@darox

@darox darox commented Aug 2, 2026

Copy link
Copy Markdown

What Changed

Adds response-text annotations to web and desktop chat.

Users can select text from an assistant response, choose Add to chat, and include an optional comment. Pending selections are grouped in a composer chip where they can be reviewed or removed before sending.

Selections are sent as structured prompt context and displayed as a compact annotation summary instead of exposing the serialized markup in the conversation.

Why

Referencing part of an assistant response currently requires manually copying and pasting it into the composer. This makes the excerpt and the user’s instruction harder to distinguish.

Attaching the exact selection keeps that context explicit while leaving the composer and conversation readable.

UI Changes

Before

Selecting text in an assistant response did not provide an action for attaching it to the next message.

image

After

Selecting response text opens an Add to chat action.

image

An optional comment can be added to explain why the text is relevant.

image

Multiple selections are grouped and can be reviewed or removed individually.

image

Sent messages display a compact annotation summary without showing the underlying prompt markup.

image image

Interaction video

Screen.Recording.2026-08-02.at.1.00.54.PM.mov

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Model: OpenAI Codex · Harness: Codex desktop

Note

Add selected response text attachment to the chat composer

  • Users can select text in assistant messages to open a popover (ChatTextSelectionPopover) that lets them add the selection (with an optional comment) to the composer draft as a chat selection annotation.
  • Annotations are serialized as XML blocks and appended to the outgoing prompt via appendChatSelectionAnnotationsToPrompt; the composer shows a summary chip (ComposerPendingChatSelectionAnnotations) to review or remove pending annotations before sending.
  • The composerDraftStore persists chat selection annotations alongside other draft content (storage version bumped to 9), restores them on send failure, and treats their presence as sendable content.
  • User message bubbles in the timeline parse and hide raw annotation markup, displaying a summary chip instead; annotation-only messages suppress the empty bubble.
  • Behavioral Change: resolvePlanFollowUpSubmission now stays in plan mode when chat selection annotations are present even if draft text is empty.

Macroscope summarized 6163c32.


Note

Medium Risk
Touches composer send/rollback, draft persistence, and prompt serialization for outbound messages, but changes are localized to chat UI with tests for round-trip and markup edge cases.

Overview
Adds response-text annotations so users can quote assistant output in the next message without copy-paste.

Selecting text in an assistant markdown response opens an Add to chat popover (optional comment). Pending selections live in the composer as reviewable chips, persist in the draft store (storage version bump), and count toward sendable content and plan follow-up mode.

On send, annotations are appended as structured chat_selection XML blocks marked data-t3code-appended; only app-generated blocks are parsed as annotations—user-authored similar markup stays plain text. The timeline shows a compact N annotation(s) summary instead of raw markup; annotation-only messages skip an empty user bubble. Failed sends and plan follow-ups restore cleared drafts when the composer was not edited mid-flight.

Reviewed by Cursor Bugbot for commit 6163c32. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dbc74acc-6b30-47ef-87fc-bd5de56c6d03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Aug 2, 2026
Comment thread apps/web/src/composerDraftStore.ts
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
@darox
darox marked this pull request as ready for review August 2, 2026 12:50
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
@macroscopeapp

macroscopeapp Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new user-facing feature (attaching selected response text to messages) with new UI components, new state management, and new interaction flows. New features with this scope warrant human review.

You can customize Macroscope's approvability policy. Learn more.

@darox
darox force-pushed the codex/chat-annotations-desktop branch 2 times, most recently from 9d445cd to 2d7789d Compare August 2, 2026 13:04
Comment thread apps/web/src/components/ChatMarkdown.tsx
Comment thread apps/web/src/chatSelectionAnnotation.ts
Comment thread apps/web/src/components/ChatMarkdown.tsx Outdated
Comment thread apps/web/src/components/ChatMarkdown.tsx
@darox
darox force-pushed the codex/chat-annotations-desktop branch from 6907e9a to 869feb2 Compare August 2, 2026 13:26
Comment thread apps/web/src/components/chat/ChatComposer.tsx
@darox
darox force-pushed the codex/chat-annotations-desktop branch from 869feb2 to 1f9c8a8 Compare August 2, 2026 13:35
Comment thread apps/web/src/components/chat/ChatTextSelectionPopover.tsx Outdated
Comment thread apps/web/src/components/chat/MessagesTimeline.tsx
@darox
darox force-pushed the codex/chat-annotations-desktop branch 2 times, most recently from 4983c1e to 0275673 Compare August 2, 2026 13:45
Comment thread apps/web/src/components/ChatMarkdown.tsx Outdated
Comment thread apps/web/src/components/ChatMarkdown.tsx Outdated
@darox
darox force-pushed the codex/chat-annotations-desktop branch from 0275673 to 4108b83 Compare August 2, 2026 14:07
Comment thread apps/web/src/components/ChatMarkdown.tsx
Comment thread apps/web/src/components/ChatMarkdown.tsx
@darox
darox force-pushed the codex/chat-annotations-desktop branch from 4108b83 to 760517f Compare August 2, 2026 14:23
Comment thread apps/web/src/components/chat/ChatTextSelectionPopover.tsx
Comment thread apps/web/src/chatSelectionAnnotation.ts
Comment thread apps/web/src/components/ChatMarkdown.tsx Outdated
@darox
darox force-pushed the codex/chat-annotations-desktop branch from 760517f to 6982ab0 Compare August 2, 2026 14:37
Comment thread apps/web/src/components/ChatMarkdown.tsx

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6982ab0. Configure here.

Comment thread apps/web/src/components/ChatMarkdown.tsx
Comment thread apps/web/src/components/ChatMarkdown.tsx Outdated
@darox
darox force-pushed the codex/chat-annotations-desktop branch from 6982ab0 to 6163c32 Compare August 2, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant