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, 19:30 UTC
fix(pi): stop blank input placeholders from failing the run (#23235)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Victor Vogel committed
Oct 23, 2026 at 02:09 UTC
6d9ec7bdf9a633da430a47149f271e1e36ef3c79
2 files changed
+39
-1
packages/provider-pi/src/server/adapter.test.ts
+34
@@ -3126,6 +3126,40 @@ describe("PiAdapterV2", () => {
3126
}).pipe(Effect.scoped, Effect.provide(layerTest)),
3127
);
3128
3129
+ it.effect("asks an input dialog's title when its placeholder is blank", () =>
3130
+ Effect.gen(function* () {
3131
+ const fake = yield* makeFakePi;
3132
+ const { runtime, takeEvent } = yield* openRuntime(fake);
3133
+ yield* runtime.ensureThread({
3134
+ threadId: THREAD_ID,
3135
+ modelSelection: modelSelection("default"),
3136
+ runtimePolicy,
3137
+ });
3138
+ const title = "Which database?\n1. Postgres\n2. Type something.\nType your answer:";
3139
+ yield* fake.emit({
3140
+ type: "extension_ui_request",
3141
+ id: "ui-input",
3142
+ method: "input",
3143
+ title,
3144
+ placeholder: "",
3145
+ });
3146
+ const event = yield* takeEvent(
3147
+ (event) =>
3148
+ event.type === "turn_item.updated" && event.turnItem.type === "user_input_request",
3149
+ );
3150
+ if (event.type !== "turn_item.updated" || event.turnItem.type !== "user_input_request") {
3151
+ return assert.fail("expected a user input request");
3152
+ }
3153
+ assert.equal(decodeUserInputQuestions(event.turnItem.questions)[0]?.question, title);
3154
+ yield* runtime.respondToRuntimeRequest({
3155
+ requestId: event.turnItem.requestId,
3156
+ answers: { "ui-input": "SQLite" },
3157
+ });
3158
+ const response = yield* fake.takeRequest("extension_ui_response");
3159
+ assert.equal(response["value"], "SQLite");
3160
+ }).pipe(Effect.scoped, Effect.provide(layerTest)),
3161
+ );
3162
+
3163
it.effect("keeps the complete editor prefill editable and returns exact edited text", () =>
3164
Effect.gen(function* () {
3165
const fake = yield* makeFakePi;
packages/provider-pi/src/server/adapter.ts
+5
-1
@@ -3322,7 +3322,11 @@ function piQuestion(
3322
value: "",
3323
},
3324
];
3325
- const question = recordString(event, "message") ?? recordString(event, "placeholder") ?? title;
3325
+ // Extensions may send a blank placeholder, which is not a valid question.
3326
+ const question =
3327
+ [recordString(event, "message"), recordString(event, "placeholder")].find(
3328
+ (text) => text !== undefined && text.trim().length > 0,
3329
+ ) ?? title;
3330
return {
3331
id: questionId,
3332
header: title,