From 81e2c50aa9f3f7ce7b35e013b78787135a68187f Mon Sep 17 00:00:00 2001 From: eroslifestyle Date: Wed, 25 Nov 2026 03:15:50 +0100 Subject: [PATCH] fix(shared): allow one answer per ask_user_questions question (max 64) (#16702) 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 > - Agents ask board users questions with `ask_user_questions` interactions > - The question payload allows up to 64 questions (`askUserQuestionsPayloadFields`) > - The response schema `respondIssueThreadInteractionSchema` allows only 20 answers > - A card with 21 to 64 questions can be created, but the user cannot submit all answers > - This pull request raises the answer limit to 64, the same as the question limit > - The benefit is that every valid card can be answered ## Linked Issues or Issue Description **What happened?** An `ask_user_questions` card with more than 20 questions is accepted on creation. When the user answers every question, the response is rejected by validation because `answers` has a maximum of 20 items. **Steps to reproduce** 1. Create an `ask_user_questions` interaction with 21 questions (the limit is 64). 2. Answer all 21 questions. 3. Send the response to `respondIssueThreadInteractionSchema`. **Expected behavior** One answer per question is accepted, up to 64. **Actual behavior** Validation fails because `answers` allows at most 20 items. No existing public issue found (searched issues and PRs for `respondIssueThreadInteraction`). ## What Changed - `packages/shared/src/validators/issue.ts`: `answers` maximum changed from 20 to 64 to match the question maximum. - `packages/shared/src/validators/issue.test.ts`: new test. 64 answers pass. 65 answers fail. ## Verification - `LC_ALL=C pnpm --filter @paperclipai/shared exec vitest run src/validators/issue.test.ts` — 44 passed. ## Risks Low risk. The change only raises an upper bound to a value the question schema already allows. ## Model Used Claude (Anthropic), model ID `claude-sonnet-5-5`, with tool use and code execution in Claude Code. A human reviewed the change. ## 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 (none needed) - [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 - [ ] I will address all Greptile and reviewer comments before requesting merge --- packages/shared/src/validators/issue.test.ts | 13 +++++++++++++ packages/shared/src/validators/issue.ts | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/validators/issue.test.ts b/packages/shared/src/validators/issue.test.ts index 0dda20eec5e..7584bcce33a 100644 --- a/packages/shared/src/validators/issue.test.ts +++ b/packages/shared/src/validators/issue.test.ts @@ -568,6 +568,19 @@ describe("issue validators", () => { expect(document.body).toBe("# Plan\n\nShip it"); }); + it("accepts one answer per question up to the 64-question payload limit", () => { + const answers = Array.from({ length: 64 }, (_, i) => ({ + questionId: `q${i}`, + optionIds: [], + otherText: null, + })); + + expect(respondIssueThreadInteractionSchema.safeParse({ answers }).success).toBe(true); + expect( + respondIssueThreadInteractionSchema.safeParse({ answers: [...answers, answers[0]] }).success, + ).toBe(false); + }); + it("clamps oversized requestDepth values on create", () => { const parsed = createIssueSchema.parse({ title: "Clamp request depth", diff --git a/packages/shared/src/validators/issue.ts b/packages/shared/src/validators/issue.ts index f9b02da4054..8d6325b771d 100644 --- a/packages/shared/src/validators/issue.ts +++ b/packages/shared/src/validators/issue.ts @@ -2356,7 +2356,7 @@ export type WithdrawIssueThreadInteraction = z.infer< >; export const respondIssueThreadInteractionSchema = z.object({ - answers: z.array(askUserQuestionsAnswerSchema).max(20), + answers: z.array(askUserQuestionsAnswerSchema).max(64), summaryMarkdown: multilineTextSchema .pipe(z.string().max(20000)) .nullable()