From f33db357f73d1e8cd26f8ed44b94385583222293 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Sat, 14 Nov 2026 22:14:27 -0600 Subject: [PATCH] fix(ui): let Request changes on a plan always take a revision note (#21721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - In planning work, an agent saves a Plan document and asks the person to confirm it with a request_confirmation card > - The card offers "Request changes"; it opens a revision note only when the request sets rejectRequiresReason, allowDeclineReason or declineReasonPlaceholder > - Paperclip's own plan confirmations (runner plan approval) always set rejectRequiresReason, but an agent that writes its own confirmation may not > - Then "Request changes" rejects the plan at once and the person cannot say what should change > - This pull request makes plan confirmations always open the revision note; the note stays optional unless required > - The benefit is that a plan can always be sent back with a reason, and the QA plan journey can complete ## Linked Issues or Issue Description **What happened?** On the QA Cloud stack the plan-revise-accept journey failed. The agent saved a correct two-step Plan and a confirmation bound to the latest revision, with labels "Confirm" / "Request changes" and `rejectRequiresReason: false`. Clicking "Request changes" rejected the plan immediately; no revision note opened. **Steps to reproduce** 1. Create a request_confirmation that targets the issue's `plan` document without `rejectRequiresReason`. 2. Open the task chat and click "Request changes". 3. The plan is rejected with no note. **Expected behavior** "Request changes" opens the revision note so the person can describe the change, as for Paperclip's own plan approvals. ## What Changed - `TaskChatCompactInteractionCard`: `collectsRejectReason` is true for any plan confirmation (issue_document target with key `plan`). The note label shows "(optional)" when a reason is not required, and the reject button stays enabled with an empty note. ## Verification - Red/green: new `TaskChatInteractionCard.test.tsx` case "opens the revision note for a plan even when the request does not require a reason" fails on master (the click rejects) and passes with the change. - `ui` vitest for `src/components/task-chat` and `IssueThreadInteractionCard`: 68 files, 1119 tests pass. UI typecheck clean. - QA Cloud: the plan journey failed at this step in run 43671188287 (the only failing product step in a 22/24 run). It will be rerun after deploy. ## Risks - Low risk. Only plan confirmations change: one extra step (the note box) before a plan rejection. Non-plan confirmations are unchanged. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 --- .../TaskChatCompactInteractionCard.tsx | 7 ++-- .../TaskChatInteractionCard.test.tsx | 32 +++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx b/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx index d971d6d5540..e5c4831cd16 100644 --- a/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx +++ b/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx @@ -858,14 +858,15 @@ function ConfirmationCard({ const setReason = (value: string) => updateDraft({ reason: value }); const [actionError, setActionError] = useState(null); const [revisionUploading, setRevisionUploading] = useState(false); + const isPlanConfirmation = + interaction.payload.target?.type === "issue_document" && + interaction.payload.target.key === "plan"; const collectsRejectReason = Boolean( + isPlanConfirmation || interaction.payload.rejectRequiresReason || interaction.payload.allowDeclineReason || interaction.payload.declineReasonPlaceholder, ); - const isPlanConfirmation = - interaction.payload.target?.type === "issue_document" && - interaction.payload.target.key === "plan"; useEffect(() => { if (!draftKey) return; const legacyReason = loadStructuredDraft(draftKey, ""); diff --git a/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx b/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx index c2ddbef6fe2..5d12bb57a08 100644 --- a/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx +++ b/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx @@ -735,6 +735,38 @@ describe("TaskChatInteractionCard", () => { expect(reasonGroup?.className).not.toContain("mt-3"); }); + it("opens the revision note for a plan even when the request does not require a reason", async () => { + const reject = vi.fn(); + const interaction = createRequestConfirmation({ + sourceRunId: "run-plan", + title: "Confirm the two-step plan", + payload: { + version: 1, + prompt: "Please review the plan.", + acceptLabel: "Confirm", + rejectLabel: "Request changes", + rejectRequiresReason: false, + target: { type: "issue_document", issueId: "issue-1", key: "plan", revisionId: "revision-1", revisionNumber: 1 }, + }, + }); + flushSync(() => { + root.render( + + + + + , + ); + }); + const requestChanges = Array.from(container.querySelectorAll("button")) + .find((button) => button.textContent?.trim() === "Request changes"); + flushSync(() => requestChanges?.click()); + expect(reject).not.toHaveBeenCalled(); + expect(container.querySelector('[data-testid="plan-revision-composer"]')).not.toBeNull(); + expect(container.textContent).toContain("(optional)"); + }); + it("shows one question at a time and preserves answers across pages", async () => { const submit = vi.fn(); flushSync(() => {