@devries-cameron20 / t3code Mirror · read-only / commits / 245c579807
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(server): Resume that carries a context handoff asks the agent to continue (#38847)

Julius Marminge committed Nov 18, 2026 at 19:22 UTC 245c5798070d2d28b10de9b50ce433e0a41ae04d
2 files changed +18 -4
apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts
+12 -3
@@ -2263,9 +2263,18 @@ effectIt.effect.each([
2263 const resendsOriginal =
2264 "unsentResume" in sideChat &&
2265 (!("acceptedResume" in sideChat) || "restartedResume" in sideChat);
2266 - expect(harness.startTurn.mock.calls.map(([turn]) => turn.message.text)).toEqual([
2267 - withInlineContext(context, resendsOriginal ? "Original request" : ""),
2268 - ]);
2266 + const texts = harness.startTurn.mock.calls.map(([turn]) => turn.message.text);
2267 + expect(texts).toHaveLength(1);
2268 + if (resendsOriginal || context === "") {
2269 + expect(texts[0]).toBe(
2270 + withInlineContext(context, resendsOriginal ? "Original request" : ""),
2271 + );
2272 + } else {
2273 + // A resume that has to carry context still tells the agent to continue.
2274 + const contextPrefix = withInlineContext(context, "");
2275 + expect(texts[0]?.startsWith(contextPrefix)).toBe(true);
2276 + expect(texts[0]?.slice(contextPrefix.length).trim()).not.toBe("");
2277 + }
2278 expect(harness.startTurn.mock.calls[0]?.[0].resume === true).toBe(
2279 context === "" && !resendsOriginal,
2280 );
apps/server/src/orchestration-v2/ProviderTurnStartService.ts
+6 -1
@@ -181,6 +181,8 @@ export const isProviderTurnStartRunStateMissingError = Schema.is(
181 ProviderTurnStartRunStateMissingError,
182 );
183
184 +const RESUME_PROMPT = "Continue where you left off.";
185 +
186 const START_GAVE_UP_MESSAGE =
187 "T3 Code could not start this turn. Send the message again; if it keeps failing, check the server logs.";
188
@@ -1897,7 +1899,6 @@ export const layer: Layer.Layer<
1899 .filter((part) => part !== "")
1900 .join("\n\n");
1901 const { restartContinuationOfRunId: _resumedRunId, ...promptedInput } = turnInput;
1900 - const text = goalCommand ? userText : withInlineContext(context, userText);
1902 const startInput = noteContinuation ? promptedInput : turnInput;
1903 const { resume: _resume, ...contextInput } = startInput;
1904 const { message: resumeMessage, resume: _resumeIntent, ...resumeInput } = startInput;
@@ -1910,6 +1911,10 @@ export const layer: Layer.Layer<
1911 );
1912 // Like pending history, pending images need a prompt; native resume carries none.
1913 const prompted = context !== "" || missedAttachments.length > 0;
1914 + // A resume that must be prompted still needs a request, or the agent has nothing to do.
1915 + const requestText =
1916 + turnInput.resume && prompted && userText === "" ? RESUME_PROMPT : userText;
1917 + const text = goalCommand ? userText : withInlineContext(context, requestText);
1918 const operation =
1919 turnInput.resume && !prompted && session.resumeTurn !== undefined
1920 ? session.resumeTurn({ ...resumeInput, messageId: resumeMessage.messageId })