Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): replace Claude sessions that never saved a message #19637

Mergedmaria-rcksmerged 4 commits intomain fromrefs/pull/19637/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 157 additions and 0 deletions.

x
0 of 2 viewed, 2 left
90 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -1287,6 +1287,96 @@
+describe("ClaudeAdapterV2 resumeThread", () => {
+ it.effect("fails for a transcript without messages so a fresh session replaces it", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const configDir = yield* fileSystem.makeTempDirectoryScoped({
+ prefix: "t3-claude-empty-session-",
+ });
+ const projectDir = path.join(configDir, "projects", "-workspace");
+ yield* fileSystem.makeDirectory(projectDir, { recursive: true });
+ // What a CLI stopped before it saved the first prompt leaves behind.
+ yield* fileSystem.writeFileString(
+ path.join(projectDir, "native-thread-empty.jsonl"),
+ [
+ `{"type":"last-prompt","lastPrompt":"hello","sessionId":"native-thread-empty"}`,
+ `{"type":"atis-latch","atis":"","sessionId":"native-thread-empty"}`,
+ `{"type":"cost-state","sessionId":"native-thread-empty","totalCostUSD":0}`,
+ "",
+ ].join("\n"),
+ );
+ yield* fileSystem.writeFileString(
+ path.join(projectDir, "native-thread-saved.jsonl"),
+ `{"type":"user","message":{"role":"user","content":"hello"},"sessionId":"native-thread-saved"}\n`,
+ );
+ const adapter = yield* ClaudeAdapterV2.makeClaudeAdapterV2({