Skip to content

Add Ctrl/Cmd+Enter shortcut for code review "Send to Agent"#12982

Open
warp-dev-github-integration[bot] wants to merge 7 commits into
masterfrom
factory/code-review-send-to-agent-keybinding
Open

Add Ctrl/Cmd+Enter shortcut for code review "Send to Agent"#12982
warp-dev-github-integration[bot] wants to merge 7 commits into
masterfrom
factory/code-review-send-to-agent-keybinding

Conversation

@warp-dev-github-integration

@warp-dev-github-integration warp-dev-github-integration Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Human Remarks (Andy)

The idea of this PR is to make sending the comments from code review to the agent more keyboard-driven. We have cmd/ctrl-enter for adding a single comment, but after you do that you have to go back to the mouse to click "send to agent". This PR adds that same keystroke to the "send to agent button".

Description

In the code review panel, a review comment can be submitted with cmdorctrl-enter (Ctrl+Enter on Windows/Linux, ⌘+Enter on macOS) and the composer's Comment button renders that keystroke. The comment tray's Send to Agent button, however, had no keyboard binding and no keystroke hint — so there was no keyboard-driven way to send queued comments to the agent.

This adds that shortcut, using the exact same binding as submitting a comment, and renders the keystroke on the button.

How:

  • Add a shared CODE_REVIEW_SUBMIT_KEYSTROKE (cmdorctrl-enter) in code_review, used by both the composer's Comment button and the new send path so they're literally the same binding.
  • Convert Send to Agent from a plain ui_builder accent button to an ActionButton (PrimaryTheme, which uses theme().accent() so it looks the same) with with_keybinding(...), so it renders the Ctrl ↵ / ⌘ ↵ chip just like the Comment button. Disabled state + tooltip are kept in sync via sync_send_button.
  • Register a code_review:submit_review_comments editable binding for cmdorctrl-enter, scoped to the existing CodeReviewView_NotEditing keymap context so it can't fire while composing a comment (no conflict with the composer's own cmdorctrl-enter). It dispatches a new CodeReviewAction::SubmitReviewComments.
  • Add CommentListView::can_send and guard both the button's enabled state and the keyboard handler with it, so the shortcut is a no-op exactly when the button is disabled (no sendable comments / no destination / AI unavailable).

Linked Issue

Reported via the factory-client Slack bug-triage thread (no GitHub issue). Spec was approved by the reporter in-thread.

Testing

  • I have manually tested my changes locally (built and ran Warp, drove the code review panel via computer use).

Verified on the running app against /workspace/repro-repo:

  • The Send to Agent button now renders a boxed Ctrl ↵ shortcut (matching the Comment button).
  • Pressing Ctrl+Enter with focus in the comment tray (not composing) sends the queued comments to the agent (tray clears, an agent conversation opens).
  • Pressing Ctrl+Enter while composing a comment still only saves the comment — it does not also send to the agent (the _NotEditing context gating works).
  • Existing cmdorctrl-s / cmdorctrl-f / f code-review shortcuts and comment save/cancel are unaffected.

Note: per the reporter's request, a dedicated regression/unit test was intentionally skipped for this change. ./script/format and cargo clippy --all-features -- -D warnings pass. The full cargo nextest suite could not be run in this cloud runner because compiling the warp crate's test target exceeds the environment's memory limit (OOM/SIGKILL); CI will run the test suite.

Screenshots / Videos

Screenshot of the corrected button is posted in the Slack triage thread.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-IMPROVEMENT: Code review comments can now be sent to the agent with the keyboard (Ctrl/Cmd+Enter), and the shortcut is shown on the "Send to Agent" button.

Conversation: https://staging.warp.dev/conversation/1bc9ad74-95e9-4f6f-8dd0-cfcafe4fcacd
Run: https://oz.staging.warp.dev/runs/019ef812-8c8f-7be0-90c5-5d389eccb995
This PR was generated with Oz.

The code review comment composer's "Comment" button can be submitted with
cmdorctrl-enter and renders that keystroke, but the comment tray's "Send to
Agent" button had no keyboard path and no keystroke hint.

- Add a shared `CODE_REVIEW_SUBMIT_KEYSTROKE` ("cmdorctrl-enter") used by both
  the composer's submit button and the new send path, so they're the exact
  same binding.
- Convert "Send to Agent" to an `ActionButton` (PrimaryTheme) with that
  keybinding so it renders the keystroke chip, matching the "Comment" button.
- Register a `code_review:submit_review_comments` editable binding scoped to the
  `CodeReviewView_NotEditing` context (so it can't fire while composing a
  comment), handled via a new `CodeReviewAction::SubmitReviewComments`.
- Add `CommentListView::can_send` and guard both the button's enabled state and
  the keyboard handler with it so the shortcut is a no-op when sending is
  disabled.

Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Jun 24, 2026
The keystroke chips on the "Send to Agent" and "Comment" buttons are rendered
from a fixed CODE_REVIEW_SUBMIT_KEYSTROKE, and comment submission is a fixed
editor binding. Registering the send trigger as an editable binding meant a user
rebinding it in settings would desync the actual key from what the buttons show.

Register it as a FixedBinding instead, so the trigger, both rendered chips, and
the comment-submit binding all derive from the one constant and can't drift.

Co-Authored-By: Oz <oz-agent@warp.dev>
@warp-dev-github-integration warp-dev-github-integration Bot force-pushed the factory/code-review-send-to-agent-keybinding branch from f37d682 to d85b9cf Compare June 24, 2026 17:45
oz-agent and others added 2 commits June 24, 2026 18:16
The "Send to Agent" shortcut (cmdorctrl-enter) only applies in the
`CodeReviewView_NotEditing` context, i.e. when the review pane itself holds
focus. After authoring a comment, focus is left inside the child editor (the
inline line-comment editor or the pane composer), so the shortcut didn't fire
until the user clicked back into the pane.

Refocus the review pane in `update_review_comment` once a comment is committed,
so the shortcut works immediately in the natural "add comments then send" flow.
Mirrors the existing focus_self() after reverting a diff hunk.

Co-Authored-By: Oz <oz-agent@warp.dev>
);
}

ctx.focus_self();

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.

Need to make sure we transfer focus to that the Code review view can receive the subsequent keystroke without having to click it.

@acarl005

Copy link
Copy Markdown
Contributor

/oz-review

@acarl005 acarl005 marked this pull request as ready for review June 24, 2026 19:52
@oz-for-oss

oz-for-oss Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@acarl005

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss

oz-for-oss Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@acarl005

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss 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.

Overview

This PR adds a shared code review submit keystroke, renders it on the comment tray's Send to Agent action, and registers Ctrl/Cmd+Enter to submit queued review comments when the code review pane is not editing.

Concerns

  • ⚠️ [IMPORTANT] This is a user-facing UI/behavior change, but the provided PR artifacts only state that a screenshot was posted in Slack; they do not include an attached screenshot or recording in the PR description/comments that reviewers can inspect. Please attach visual evidence demonstrating the shortcut chip and end-to-end Send to Agent shortcut behavior.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]

This comment was marked as resolved.

oz-agent and others added 3 commits June 24, 2026 20:29
The code review send-to-agent work made `CommentListView::sync_send_button`
read the `AIRequestUsageModel` singleton when comments are populated (to compute
the "Send to Agent" button's enabled state/tooltip). The `find_model` tests use
their own lighter test harness that never registered that singleton, so they
panicked once a `CodeReviewView` populated comments.

Register `ServerApiProvider` + `AIRequestUsageModel` in the find_model test
harness, matching `code_review_view_tests::initialize_test_app`.

Co-Authored-By: Oz <oz-agent@warp.dev>
@acarl005 acarl005 requested a review from kevinchevalier June 24, 2026 21:28
@acarl005

Copy link
Copy Markdown
Contributor

/oz-review

@oz-for-oss

oz-for-oss Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@acarl005

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss 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.

Overview

This PR adds a shared Ctrl/Cmd+Enter shortcut and keybinding hint for sending queued code review comments to the agent. The implementation keeps the shortcut scoped to the non-editing code review context and guards both the button and shortcut with the sendable-comments checks.

Concerns

  • The change is user-facing, but the PR context only says a screenshot exists in a Slack thread; no screenshot or recording is attached to the PR description/context for reviewers to verify the rendered shortcut and end-to-end behavior.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

});

let send_button = ctx.add_view(|ctx| {
ActionButton::new("Send to Agent", PrimaryTheme)

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.

⚠️ [IMPORTANT] For this user-facing change, please include screenshots or a screen recording in the PR demonstrating the shortcut chip and Ctrl/Cmd+Enter send flow working end to end. A screenshot referenced only from Slack is not attached PR evidence for reviewers.

@kevinchevalier

kevinchevalier commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Are we cool with this style change on the button? It seems a little big.

Screenshot 2026-06-24 at 4 58 42 PM

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.

3 participants