feat(open-swe): disable "Request changes" until the plan has a comment (#1602)

Requesting changes hands the reviewer comments to the agent, so it's
meaningless with none. Disable the button (with a hint tooltip) until at
least one comment exists; approve is unaffected.
This commit is contained in:
Ramon Nogueira 2026-06-23 19:02:08 -04:00 • committed by GitHub
parent 9370a8c7f4
commit 714914b14c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -89,10 +89,14 @@ test.describe("Plan review (HTTP comments)", () => {
timeout: 30_000,
});
await expect(owner.getByTestId("approve-plan")).toBeVisible();
// "Request changes" is meaningless with no feedback → disabled until a
// comment exists.
await expect(owner.getByTestId("reject-plan")).toBeDisabled();
// Owner leaves a comment.
await addComment(owner, "Owner: looks solid, ship it.");
await expect(owner.getByTestId("plan-comment")).toHaveCount(1);
await expect(owner.getByTestId("reject-plan")).toBeEnabled();
// 4. A COLLABORATOR opens the same plan: sees it AND the owner's comment
// (fetched over HTTP), but has NO approve button.

View file

@ -128,7 +128,14 @@ export function PlanReview({ plan }: { plan: PlanData }) {
<Button
data-testid="reject-plan"
variant="secondary"
disabled={busy !== null || decision !== null}
// Requesting changes feeds the comments to the agent, so it's
// meaningless with none — disable until at least one is left.
disabled={busy !== null || decision !== null || comments.length === 0}
title={
comments.length === 0
? "Leave a comment first to request changes"
: undefined
}
onClick={() => void decide("reject")}
>
Request changes