Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a Claude session gone on resume starts fresh instead of failing every send #37610

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/37610/headmerged by juliusmarminge View on GitHub

Showing 6 changed files with 137 additions and 3 deletions (loading 3).

x
0 of 6 viewed, 6 left
44 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -14087,6 +14087,50 @@
+ it.effect("resumes in a fresh session after Claude Code reports its conversation gone", () =>
+ Effect.gen(function* () {
+ const harness = yield* openAdapterWhoseFirstQueryEndsBeforeItsFirstFrame(
+ "claude-query-conversation-missing",
+ Stream.fail(
+ new ClaudeAdapterV2.ClaudeAgentSdkQueryRunnerError({
+ method: "fromAsyncIterable",
+ cause: new ClaudeAdapterV2.ClaudeConversationNotFoundError({
+ cause: new Error("Claude Code process exited with code 1"),
+ }),
+ }),
+ ),
+ );
+ const turnInput = harness.turnInput("a", 1);
+ const started = yield* harness.runtime.startTurn(turnInput).pipe(Effect.exit);
+ assert.isTrue(Exit.isFailure(started));
+ if (Exit.isFailure(started)) {
+ assert.include(
+ makeProviderFailure({ cause: started.cause, class: "transport_error" }).message,
+ "could not find this conversation",
+ );
+ // A failed resume is what sends the next turn to a fresh native session.
+ const resumed = yield* harness.runtime
+ .resumeThread({
+ providerThread: turnInput.providerThread,