fix(desktop): send inline diff comments to the selected chat

PR
10h ago
+266-14

Why

A reviewer can select a changed line, write feedback, and press Send while the agent’s chat is visible, only for the comment to stay in the composer. The desktop sends it through the terminal path, and its default target can also differ from the visible chat.

Use the active chat as the default when its binding is available, then send the line reference and feedback to the selected chat. An explicit terminal target still uses the terminal path. In the desktop walkthrough, Codex receives the comment in the existing conversation, edits the file, and the reviewer sees the updated diff.

Related to #5189, which concerns identifying targets in the selector. Target labels are a separate change.

What the person sees

  1. Select a changed line in the diff and write feedback.
  2. Send it to the selected chat; the line reference and feedback appear in the existing conversation.
  3. The agent makes the requested change, and the person checks the updated diff.

Example after the fix

In this isolated test, the user asks in Korean to change the free-shipping threshold to 30,000. The line comment appears in the existing chat and the updated test-file diff is visible on the right. The screenshot shows the result after the fix; it does not depict the failure before the fix.

paradev-pr9606-review-safe

No special prompt or separate review app is required. The shipping-fee example in the verification below is test data, not a required prompt or product requirement.

Verification

  • Split PR head 86e654b: in an isolated non-root ARM64 Debian container with Ubuntu 24.04 login-shell PATH behavior, Node 22, and Bun 1.4.3, the complete turbo test test:integration:terminal --continue --force --concurrency=4 --log-order=stream run completed 30/31 tasks with no cache. The only failing task was @superset/agent-setup#test: its two GNU tail session-log Start tests failed, both addressed independently by #9620. This is a local synthetic run, not GitHub CI.

  • Compared the base and PR code in the same isolated local workspace using the desktop UI and CDP. Before the change, a line comment to the active Codex chat stayed in the composer and did not appear in that chat. At 86e654b, the comment appeared in that chat; Codex edited the test file and the diff updated from a 40,000 to a 30,000 threshold. A temporary local-only guard disabled unrelated development-profile cleanup to protect existing profiles; it is not included in the PR.

  • After splitting, the two focused test files passed on macOS (4 tests): target selection and chat dispatch, including a check that sending to chat does not write to the terminal. Repository-wide lint and typecheck passed on macOS on the prior combined tree. The later watcher-only commit has now been split into #9620.

  • On the prior combined tree, the full test and terminal integration suite passed 31/31 tasks in an isolated ARM64 Debian container with Ubuntu 24.04 shell settings, Node 22 and Bun 1.4.3. This was not GitHub CI and does not establish a full-suite pass for this split PR; without #9620 the two existing GNU tail timing tests may fail. GitHub CI and Deploy Preview were awaiting maintainer approval; the CLA check passed.

Summary by CodeRabbit

  • New Features
    • Line comments can now be sent to the chat session associated with the selected terminal. When no chat session is available, comments continue to be sent to the terminal.
    • The active chat terminal is preferred when choosing a comment target.
  • Bug Fixes
    • Failed chat comment submissions display an error and leave the comment composer open so you can retry.