fix(interactions): accept intuitive ask_user_questions payload shape - #11096
Open
sagiw wants to merge 3 commits into
Open
fix(interactions): accept intuitive ask_user_questions payload shape#11096sagiw wants to merge 3 commits into
sagiw wants to merge 3 commits into
Conversation
Agents (incl. the CTO) commonly build ask_user_questions payloads with
options as plain strings and no selectionMode — the shape of Claude's own
AskUserQuestion tool — but askUserQuestionsPayloadSchema required option
objects {id,label} and a mandatory selectionMode, so every such request
was rejected with 400 and the questions never reached the user.
Normalize the intuitive shape instead of rejecting it: string options are
coerced to {id,label} (id slugified from the label), and selectionMode
defaults to "single". Fully backward-compatible — canonical object
payloads validate identically and duplicate-option protection is intact.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
✅ All checks passing — ready for Greptile review and maintainer approval. — commitperclip |
Verifies the intuitive string-option / omitted-selectionMode shape now parses and normalizes, the canonical object shape is unchanged, and duplicate option ids are still rejected after normalization. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
Linked Issues or Issue Description
No public GitHub issue exists; the underlying bug is described inline below.
What happened?
Agents send
ask_user_questionspayloads with options as plain strings and noselectionMode(Claude's ownAskUserQuestiontool shape).askUserQuestionsPayloadSchemarequired option objects{ id, label }and a mandatoryselectionMode, soPOST /api/issues/:id/interactionsreturned400and the questions never reached the user. An orchestrator was observed repeatedly hitting this400while asking a human for staging deploy authorization.Expected behavior
The intuitive payload shape is accepted and normalized to the canonical form, so the questions reach the user. Canonical object-shaped payloads keep validating exactly as before.
Steps to reproduce
POST /api/issues/:id/interactionswith anask_user_questionspayload whoseoptionsare strings (e.g.["Yes", "No"]) and withselectionModeomitted.400and no prompt is shown to the user.{ id, label }with a slugifiedid, andselectionModedefaults to"single".What Changed
packages/shared/src/validators/issue.ts:askUserQuestionsQuestionOptionSchemanow preprocesses string options into{ id, label }, slugifyingidfrom the label; object options missing anidalso get a slugifiedid.packages/shared/src/validators/issue.ts:selectionModeis nowoptional()and defaults to"single".packages/shared/src/validators/issue.test.ts: added tests for string-shape normalization, canonical-shape pass-through, and duplicate-id rejection after normalization.Verification
cd packages/shared && npx vitest run src/validators/issue.test.ts→ 35/35 pass, including the 3 newaskUserQuestionsPayloadSchemacases.400string-shape payload now parses; options normalize to{ id: "yes-ship-it", label: "Yes, ship it" };selectionModedefaults to"single".Risks
Low risk. The change is purely additive and backward-compatible: canonical object-shaped payloads validate identically, and duplicate-id protection is unchanged. There is no database migration and no change to stored data.
Model Used
Claude Opus 4.8 (
claude-opus-4-8), via Claude Code, with tool use and code execution.Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template#NNN/github.com/paperclipai/paperclipURLs)