The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 09:30 UTC
fix(pi): show an extension dialog's title once (#22463)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Victor Vogel committed
Oct 31, 2026 at 21:21 UTC
253acdeaf91b2270d5098f0d583c0e743cde454d
2 files changed
+38
-6
packages/provider-pi/src/server/adapter.test.ts
+32
@@ -3301,6 +3301,34 @@ describe("PiAdapterV2", () => {
3301
}).pipe(Effect.scoped, Effect.provide(layerTest)),
3302
);
3303
3304
+ it.effect("keeps an input dialog's title as the header above its placeholder", () =>
3305
+ Effect.gen(function* () {
3306
+ const fake = yield* makeFakePi;
3307
+ const { runtime, takeEvent } = yield* openRuntime(fake);
3308
+ yield* runtime.ensureThread({
3309
+ threadId: THREAD_ID,
3310
+ modelSelection: modelSelection("default"),
3311
+ runtimePolicy,
3312
+ });
3313
+ yield* fake.emit({
3314
+ type: "extension_ui_request",
3315
+ id: "ui-input-placeholder",
3316
+ method: "input",
3317
+ title: "Name",
3318
+ placeholder: "Your name",
3319
+ });
3320
+ const event = yield* takeEvent(
3321
+ (event) =>
3322
+ event.type === "turn_item.updated" && event.turnItem.type === "user_input_request",
3323
+ );
3324
+ if (event.type !== "turn_item.updated" || event.turnItem.type !== "user_input_request") {
3325
+ return assert.fail("expected a user input request");
3326
+ }
3327
+ assert.equal(event.turnItem.questions[0]?.header, "Name");
3328
+ assert.equal(event.turnItem.questions[0]?.question, "Your name");
3329
+ }).pipe(Effect.scoped, Effect.provide(layerTest)),
3330
+ );
3331
+
3332
it.effect("emits a valid empty select option and returns its original value", () =>
3333
Effect.gen(function* () {
3334
const fake = yield* makeFakePi;
@@ -3332,6 +3360,8 @@ describe("PiAdapterV2", () => {
3360
["Empty value", ""],
3361
],
3362
);
3363
+ assert.equal(questions[0]?.header, "Question");
3364
+ assert.equal(questions[0]?.question, "Pick a tag");
3365
yield* runtime.respondToRuntimeRequest({
3366
requestId: event.turnItem.requestId,
3367
answers: { "ui-select": "" },
@@ -3366,6 +3396,7 @@ describe("PiAdapterV2", () => {
3396
if (event.type !== "turn_item.updated" || event.turnItem.type !== "user_input_request") {
3397
return assert.fail("expected a user input request");
3398
}
3399
+ assert.equal(decodeUserInputQuestions(event.turnItem.questions)[0]?.header, "Question");
3400
assert.equal(decodeUserInputQuestions(event.turnItem.questions)[0]?.question, title);
3401
yield* runtime.respondToRuntimeRequest({
3402
requestId: event.turnItem.requestId,
@@ -3401,6 +3432,7 @@ describe("PiAdapterV2", () => {
3432
return;
3433
assert.equal(event.turnItem.questions[0]?.initialAnswer, prefill);
3434
assert.deepEqual(event.turnItem.questions[0]?.options, []);
3435
+ assert.equal(event.turnItem.questions[0]?.header, "Question");
3436
assert.equal(event.turnItem.questions[0]?.question, "Commit message");
3437
const edited = " fix(server): edited commit message\n\n";
3438
yield* runtime.respondToRuntimeRequest({
packages/provider-pi/src/server/adapter.ts
+6
-6
@@ -3333,15 +3333,15 @@ function piQuestion(
3333
value: "",
3334
},
3335
];
3336
+ // Pi's select and editor dialogs carry only a title, so show it once, as the question.
3337
// Extensions may send a blank placeholder, which is not a valid question.
3337
- const question =
3338
- [recordString(event, "message"), recordString(event, "placeholder")].find(
3339
- (text) => text !== undefined && text.trim().length > 0,
3340
- ) ?? title;
3338
+ const detail = [recordString(event, "message"), recordString(event, "placeholder")].find(
3339
+ (text) => text !== undefined && text.trim().length > 0,
3340
+ );
3341
return {
3342
id: questionId,
3343
- header: title,
3344
- question,
3343
+ header: detail === undefined ? "Question" : title,
3344
+ question: detail ?? title,
3345
...(method === "editor" ? { initialAnswer: recordString(event, "prefill") ?? "" } : {}),
3346
options,
3347
};