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 21, 18:30 UTC
fix(server): pending request reads keep question option previews (#35644)
Julius Marminge committed
Nov 12, 2026 at 14:50 UTC
d9bed934d0b002444e2d3807f311f66c30fc5d34
2 files changed
+75
apps/server/src/mcp/toolkits/core.test.ts
+74
@@ -222,6 +222,80 @@ it.effect("an answered question reports already answered instead of not found",
222
);
223
});
224
225
+it.effect("a pending question read keeps option previews", () => {
226
+ const shell = McpToolAccessTestkit.liveThreadShell(threadId);
227
+ const requestId = RuntimeRequestId.make("previewed-question");
228
+ const projection = McpToolAccessTestkit.idleThreadProjection(shell);
229
+ const questions = [
230
+ {
231
+ id: "post",
232
+ header: "Review",
233
+ question: "Post it?",
234
+ options: [{ label: "Post", description: "Publish the draft", preview: "Full proposed text" }],
235
+ },
236
+ ];
237
+ return Effect.gen(function* () {
238
+ const server = yield* McpServer.McpServer;
239
+ const result = yield* server
240
+ .callTool({ name: "t3_pending_request", arguments: { action: "read", requestId } })
241
+ .pipe(
242
+ Effect.provideService(McpInvocationContext.McpInvocationContext, scope),
243
+ Effect.provideService(McpSchema.McpServerClient, client),
244
+ );
245
+ expect(result.structuredContent).toEqual({ requestId, questions });
246
+ }).pipe(
247
+ Effect.provide(
248
+ layerThreadToolkit.pipe(
249
+ Layer.provideMerge(McpHttpServer.layerInProcessMcpServer),
250
+ Layer.provide(NodeCrypto.layer),
251
+ Layer.provide(
252
+ Layer.mock(ThreadManagement.ThreadManagementService)({
253
+ getThreadShell: () => Effect.succeed(shell),
254
+ getProjectThreadRecords: () =>
255
+ Effect.succeed({
256
+ ...projection,
257
+ runtimeRequests: [
258
+ {
259
+ id: requestId,
260
+ nodeId: NodeId.make("root"),
261
+ providerTurnId: null,
262
+ nativeRequestRef: null,
263
+ kind: "user_input",
264
+ status: "pending",
265
+ responseCapability: { type: "message" },
266
+ createdAt: shell.createdAt,
267
+ resolvedAt: null,
268
+ },
269
+ ],
270
+ turnItems: [
271
+ {
272
+ id: TurnItemId.make("previewed-question-item"),
273
+ threadId,
274
+ runId: null,
275
+ nodeId: null,
276
+ providerThreadId: null,
277
+ providerTurnId: null,
278
+ nativeItemRef: null,
279
+ parentItemId: null,
280
+ ordinal: 0,
281
+ status: "running",
282
+ title: null,
283
+ startedAt: shell.createdAt,
284
+ completedAt: null,
285
+ updatedAt: shell.updatedAt,
286
+ type: "user_input_request",
287
+ requestId,
288
+ questions,
289
+ },
290
+ ],
291
+ }),
292
+ }),
293
+ ),
294
+ ),
295
+ ),
296
+ );
297
+});
298
+
299
it("bounds public command rejections and redacts internal dispatch causes", () => {
300
const command = { commandId: CommandId.make("mcp-core-command"), commandType: "thread.settle" };
301
expect(
apps/server/src/mcp/toolkits/thread/tools.ts
+1
@@ -117,6 +117,7 @@ const question = Schema.Struct({
117
label: Schema.String,
118
description: Schema.String,
119
value: Schema.optional(Schema.String),
120
+ preview: Schema.optional(Schema.String),
121
}),
122
),
123
multiSelect: Schema.optional(Schema.Boolean),