Skip to content

Commit 1327e7b

Browse files
fix(server): preserve Claude question option previews (#21932)
1 parent a09b9ca commit 1327e7b

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,17 @@ describe("ClaudeAdapterV2 runtime query policy", () => {
302302
});
303303

304304
it("projects AskUserQuestion input with question text as the answer key", () => {
305+
const preview = "\n **Proposed change**\n\n```ts\n\tconst enabled = true;\n```\n ";
305306
assert.deepEqual(
306307
ClaudeAdapterV2.claudeUserInputQuestions({
307308
questions: [
308309
{
309310
header: "Approach",
310311
question: "Which approach?",
311-
options: [{ label: "Simple", description: "Use fewer moving parts" }],
312+
options: [
313+
{ label: "Simple", description: "Use fewer moving parts", preview },
314+
{ label: "Safe", description: "Keep the current setup" },
315+
],
312316
multiSelect: true,
313317
},
314318
],
@@ -318,7 +322,10 @@ describe("ClaudeAdapterV2 runtime query policy", () => {
318322
id: "Which approach?",
319323
header: "Approach",
320324
question: "Which approach?",
321-
options: [{ label: "Simple", description: "Use fewer moving parts" }],
325+
options: [
326+
{ label: "Simple", description: "Use fewer moving parts", preview },
327+
{ label: "Safe", description: "Keep the current setup" },
328+
],
322329
multiSelect: true,
323330
},
324331
],

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3404,7 +3404,15 @@ export function claudeUserInputQuestions(
34043404
if (label.length === 0) return [];
34053405
const description =
34063406
typeof optionRecord.description === "string" ? optionRecord.description.trim() : "";
3407-
return [{ label, description: description || label }];
3407+
return [
3408+
{
3409+
label,
3410+
description: description || label,
3411+
...(typeof optionRecord.preview === "string"
3412+
? { preview: optionRecord.preview }
3413+
: {}),
3414+
},
3415+
];
34083416
})
34093417
: [];
34103418
return [

‎packages/contracts/src/orchestrationV2.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,7 @@ export const OrchestrationV2UserInputQuestion = Schema.Struct({
11321132
label: TrimmedNonEmptyString,
11331133
description: TrimmedNonEmptyString,
11341134
value: Schema.optional(Schema.String),
1135+
preview: Schema.optional(Schema.String),
11351136
}),
11361137
),
11371138
multiSelect: Schema.optional(Schema.Boolean),

0 commit comments

Comments
 (0)