mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-06 22:52:13 +00:00
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:
parent
9370a8c7f4
commit
714914b14c
2 changed files with 12 additions and 1 deletions
|
|
@ -89,10 +89,14 @@ test.describe("Plan review (HTTP comments)", () => {
|
||||||
timeout: 30_000,
|
timeout: 30_000,
|
||||||
});
|
});
|
||||||
await expect(owner.getByTestId("approve-plan")).toBeVisible();
|
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.
|
// Owner leaves a comment.
|
||||||
await addComment(owner, "Owner: looks solid, ship it.");
|
await addComment(owner, "Owner: looks solid, ship it.");
|
||||||
await expect(owner.getByTestId("plan-comment")).toHaveCount(1);
|
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
|
// 4. A COLLABORATOR opens the same plan: sees it AND the owner's comment
|
||||||
// (fetched over HTTP), but has NO approve button.
|
// (fetched over HTTP), but has NO approve button.
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,14 @@ export function PlanReview({ plan }: { plan: PlanData }) {
|
||||||
<Button
|
<Button
|
||||||
data-testid="reject-plan"
|
data-testid="reject-plan"
|
||||||
variant="secondary"
|
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")}
|
onClick={() => void decide("reject")}
|
||||||
>
|
>
|
||||||
Request changes
|
Request changes
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue