Skip to content

feat(mr): submit and manage human merge request reviews - #707

Closed
ImLunaHey wants to merge 2 commits into
mainfrom
luna/dep-8718-human-reviews
Closed

ImLunaHey wants to merge 2 commits into
mainfrom
luna/dep-8718-human-reviews

Conversation

@ImLunaHey

@ImLunaHey ImLunaHey commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

The CLI currently lacks a way to submit a human review with a summary and verdict, request changes, or read and withdraw review history. Add depot mr review with --comment, --approve, or --request-changes, plus depot mr reviews and depot mr withdraw-review.

Normal CLI use does not require --expected-head-oid or --request-key: the command captures the current head and generates a retry key. Failed submissions include the head and key for safely retrying an uncertain response. Existing approval and comment commands remain supported, and request-changes is advisory with no new merge gate.

Deploy database#845, then api#7087, before releasing this CLI.

Validation: full Go test suite, final focused MR/root tests, golangci-lint (zero issues), binary build and command help. Protocol bindings were regenerated from the API change.

Part of DEP-8718. T3 integration remains local.

Created with GPT-6 Astra in Codex.

Catch up on this pull request in Depot


Note

Medium Risk
Touches merge-request mutation paths and auth (turn-token allowlist); behavior is well covered by CLI tests but depends on coordinated API/database deploy.

Overview
Adds human review support to the Depot CLI: depot mr review (approve, request-changes, or comment with optional body), depot mr reviews (paginated history), and depot mr withdraw-review.

Submission pins the MR head (defaulting to current head), generates an idempotent --request-key for retries, and requires an explicit --expected-head-oid + request-key to replay after uncertain API responses or on closed/merged MRs. Agent turn tokens may list reviews but not submit or withdraw.

The change also extends the v1beta2 merge request API (proto + Connect client) with submit/list/withdraw review RPCs, MergeRequestReview types, and extra viewer permissions / GetMergeRequest flags for human review state.

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

@linear-code

linear-code Bot commented Nov 18, 2026

Copy link
Copy Markdown

DEP-8718

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 default effort and found 1 potential issue.

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 42dff35. Configure here.

Comment thread pkg/cmd/mr/review.go Resolved

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

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Beyond the inline finding, I checked the agent-turn allowlist change in mr.go. reviews only looks up the MR and calls ListMergeRequestReviews, so it makes no changes. review and withdraw-review are still blocked for turn tokens.

Extended reasoning...

The change adds three depot mr review commands, regenerated proto and connect bindings, and adds reviews to the read-only commands that agent-turn tokens may run. The permission surface is that allowlist, and the new entry maps to a list-only RPC that is covered in sandbox_test.go.

Comment thread pkg/cmd/mr/review.go Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

[!NOTE]
🤖 Cursor Grok 4.6 responding on behalf of Cursor Approval Agent

Risk: medium. Left a non-blocking comment; this automation did not approve. Cursor Bugbot completed with one unresolved finding that depot mr review can target a closed or merged merge request. Human review is needed and no reviewers were assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Cursor Grok 4.6 responding on behalf of Cursor Approval Agent

Risk: medium. Approved. Cursor Bugbot passed on the current head with no unresolved findings.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

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

I re-reviewed after the latest commit and didn't find any new bugs. mr review now runs requireState(OPEN) before submitting, unless both --request-key and --expected-head-oid were given for an explicit retry. A human look is still worthwhile because this adds reviews to the agent-turn allowlist and adds three new mutation/list RPCs that depend on the server deploy order.

What was reviewed:

  • The turn-token allowlist in mr.go: only reviews was added, it uses ResolveTurnReadAuth, and the error text and sandbox_test.go match.
  • review.go: the exactly-one-verdict check, the body requirement, head and key validation, random key generation, and the response-vs-request checks on submit and withdraw. Server strings go through printable().
  • mr reviews checks the --limit bounds and rejects any review whose MR id differs from the requested MR.
Extended reasoning...

The change adds three new MergeRequestService RPCs, with their proto, regenerated Go bindings and three CLI subcommands, and extends the agent-turn token allowlist to include mr reviews. The security-sensitive part is that allowlist: turn tokens may now run one more read-only command, while submit and withdraw stay limited to user auth. The earlier inline concern about reviewing non-open MRs is handled in the latest commit by requireState, with an exception only for explicit retries. I deferred instead of approving because the diff is large (about 1.7k lines, mostly generated), it changes permission gating, and it depends on coordinated API and database deploys that this review cannot verify.

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6 Astra responding on behalf of ImLunaHey

Closing this implementation because we are using Depot's existing comments, approvals/withdrawal and automated review checks. The separate human-review model and its schema-dependent commands/RPCs are no longer in scope. Database PR #845 is closed; no new review schema should be deployed. The T3 adapter is being returned to the existing released commands.

@ImLunaHey ImLunaHey closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant