@devries-cameron20 / t3code Mirror · read-only / commits / 245a1ead92
Fork 0

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, 07:15 UTC

fix(client): resume no longer sends a blank message to older servers (#38917)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Omar Espinosa committed Nov 18, 2026 at 23:44 UTC 245a1ead9224e67ed835df575aeb901912e85d72
2 files changed +90 -1
packages/client-runtime/src/operations/commands.test.ts
+80
@@ -306,6 +306,86 @@ describe("V2 environment commands", () => {
306 }).pipe(Effect.provide(layerTestRandom)),
307 );
308
309 + it.effect(
310 + "sends fallback text only on empty manual continuations for servers without native resume",
311 + () =>
312 + Effect.gen(function* () {
313 + const commands: OrchestrationV2Command[] = [];
314 + const supervisor = yield* makeSupervisor({ commands, projects: [] });
315 + const resumedRunId = RunId.make("run-interrupted");
316 +
317 + yield* startThreadTurn({
318 + commandId: CommandId.make("command-resume-empty"),
319 + threadId: v2ThreadId,
320 + manualContinuationOfRunId: resumedRunId,
321 + message: {
322 + messageId: MessageId.make("message-resume-empty"),
323 + role: "user",
324 + text: "",
325 + attachments: [],
326 + },
327 + runtimeMode: "full-access",
328 + interactionMode: "default",
329 + dispatchMode: "start",
330 + }).pipe(Effect.provideService(EnvironmentSupervisor.EnvironmentSupervisor, supervisor));
331 +
332 + yield* startThreadTurn({
333 + commandId: CommandId.make("command-resume-text"),
334 + threadId: v2ThreadId,
335 + manualContinuationOfRunId: resumedRunId,
336 + message: {
337 + messageId: MessageId.make("message-resume-text"),
338 + role: "user",
339 + text: "Keep going",
340 + attachments: [],
341 + },
342 + runtimeMode: "full-access",
343 + interactionMode: "default",
344 + dispatchMode: "start",
345 + }).pipe(Effect.provideService(EnvironmentSupervisor.EnvironmentSupervisor, supervisor));
346 +
347 + yield* startThreadTurn({
348 + commandId: CommandId.make("command-start-empty"),
349 + threadId: v2ThreadId,
350 + message: {
351 + messageId: MessageId.make("message-start-empty"),
352 + role: "user",
353 + text: "",
354 + attachments: [],
355 + },
356 + runtimeMode: "full-access",
357 + interactionMode: "default",
358 + dispatchMode: "start",
359 + }).pipe(Effect.provideService(EnvironmentSupervisor.EnvironmentSupervisor, supervisor));
360 +
361 + expect(commands).toEqual([
362 + expect.objectContaining({
363 + type: "message.dispatch",
364 + commandId: "command-resume-empty",
365 + threadId: v2ThreadId,
366 + manualContinuationOfRunId: resumedRunId,
367 + text: "Continue where you left off.",
368 + dispatchMode: { type: "start_immediately" },
369 + }),
370 + expect.objectContaining({
371 + type: "message.dispatch",
372 + commandId: "command-resume-text",
373 + threadId: v2ThreadId,
374 + manualContinuationOfRunId: resumedRunId,
375 + text: "Keep going",
376 + dispatchMode: { type: "start_immediately" },
377 + }),
378 + expect.objectContaining({
379 + type: "message.dispatch",
380 + commandId: "command-start-empty",
381 + threadId: v2ThreadId,
382 + text: "",
383 + dispatchMode: { type: "start_immediately" },
384 + }),
385 + ]);
386 + }).pipe(Effect.provide(layerTestRandom)),
387 + );
388 +
389 // A dead socket reaches the caller as a protocol error, or as an interrupt when
390 // the supervisor closes the session before the protocol reports the error.
391 it.effect.each([
packages/client-runtime/src/operations/commands.ts
+10 -1
@@ -748,6 +748,10 @@ export const setThreadInteractionMode = Effect.fn("EnvironmentCommands.setThread
748 },
749 );
750
751 +// Servers without native resume dispatch command.text verbatim; newer ones clear
752 +// it when manualContinuationOfRunId is set.
753 +const MANUAL_CONTINUATION_FALLBACK_TEXT = "Continue where you left off.";
754 +
755 export const startThreadTurn = Effect.fn("EnvironmentCommands.startThreadTurn")(function* (
756 input: StartThreadTurnInput,
757 ) {
@@ -825,7 +829,12 @@ export const startThreadTurn = Effect.fn("EnvironmentCommands.startThreadTurn")(
829 ...(input.manualContinuationOfRunId === undefined
830 ? {}
831 : { manualContinuationOfRunId: input.manualContinuationOfRunId }),
828 - text: input.message.text,
832 + text:
833 + input.manualContinuationOfRunId !== undefined &&
834 + input.message.text.trim().length === 0 &&
835 + attachments.length === 0
836 + ? MANUAL_CONTINUATION_FALLBACK_TEXT
837 + : input.message.text,
838 ...(context ? { context } : {}),
839 ...(input.message.idleCompaction === undefined
840 ? {}