Skip to content

[Bug]: Images from failed Claude starts are lost when the conversation recovers in a fresh session #38240

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Start a conversation with Claude.
  2. Send an image while background work prevents Claude from accepting the next request.
  3. Send a follow-up after the request fails to start.
  4. Continue the conversation when Claude cannot resume its previous session and T3 recovers the conversation in a fresh session.

Expected behavior

The next accepted request carries the image that Claude never received, together with the missed text requests.

Actual behavior

The recovered session receives the missed text requests without the image attached to them.

Impact

Major degradation or frequent failure. People whose image request fails before Claude accepts it lose that image whenever the subsequent turn recovers into a fresh session.

Version or commit

main at a99faf5a62. The cause is at apps/server/src/orchestration-v2/ProviderTurnStartService.ts:1497.

Environment

Linux x64, the repository's own tests.

Logs or stack traces

AssertionError: expected [] to deeply equal
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts b/apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts
index 7aa0a1a263..1a49275d9f 100644
--- a/apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts
+++ b/apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts
@@ -1971,9 +1971,16 @@ describe("orchestration v2 provider switching", () => {
       new ClaudeBackgroundWorkBlocksQueryReplacementError(),
       true,
     ],
-  ] as const)("keeps the native session after turns refused for %s", ([, refusalCause, inject]) =>
+    [
+      "background work followed by a lost native session",
+      new ClaudeBackgroundWorkBlocksQueryReplacementError(),
+      false,
+      true,
+    ],
+  ] as const)("retains missed images after %s", ([, refusalCause, inject, loseSession]) =>
     Effect.gen(function* () {
       const cwd = yield* checkpointWorkspace("refused-start-keeps-native");
+      const failResumeOnce = yield* Ref.make(false);
       const capturedTurns = yield* Ref.make<ReadonlyArray<CapturedTurn>>([]);
       const injectedHistory = yield* Ref.make<ReadonlyArray<unknown>>([]);
       const refuseStarts = yield* Ref.make(0);
@@ -1988,6 +1995,7 @@ describe("orchestration v2 provider switching", () => {
           capturedTurns,
           refuseStarts,
           refusalCause,
+          failResumeOnce,
           nativeThreadGeneration: generation,
           ...(inject === true ? { injectedHistory } : {}),
         }),
@@ -2045,12 +2053,15 @@ describe("orchestration v2 provider switching", () => {
         yield* Ref.set(refuseStarts, 2);
         assert.equal(yield* run(2), "failed");
         assert.equal(yield* run(3), "failed");
+        yield* Ref.set(failResumeOnce, loseSession === true);
         assert.equal(yield* run(4), "completed");
 
         const turns = yield* Ref.get(capturedTurns);
         assert.equal(turns.length, 2);
-        assert.equal(yield* Ref.get(generation), 1);
-        assert.equal(turns[1]?.nativeThreadId, turns[0]?.nativeThreadId);
+        assert.equal(yield* Ref.get(generation), loseSession === true ? 2 : 1);
+        if (loseSession !== true) {
+          assert.equal(turns[1]?.nativeThreadId, turns[0]?.nativeThreadId);
+        }
         const delivered = `${turns[1]?.text}${JSON.stringify(yield* Ref.get(injectedHistory))}`;
         assert.include(delivered, "Request 2");
         assert.include(delivered, "Request 3");
cd apps/server && pnpm exec vp test run src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts -t 'retains missed images after'

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions