Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): imported Claude sessions resume on their first turn #23219

Mergedjuliusmarmingemerged 9 commits intomain fromrefs/pull/23219/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 130 additions and 51 deletions.

x
0 of 2 viewed, 2 left
72 additions and 8 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsModified
View file
@@ -2715,22 +2715,40 @@
describe("ClaudeAdapterV2 native session identity", () => {
- const openTurnWithOrdinal = (providerTurnOrdinal: number, nativeThreadHasTurns?: boolean) =>
+ const openTurnWithOrdinal = (
+ providerTurnOrdinal: number,
+ nativeThreadHasTurns?: boolean,
+ importedNativeThreadId?: string,
+ ) =>
Effect.scoped(
Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const idAllocator = yield* IdAllocator.IdAllocatorV2;
+ const path = yield* Path.Path;
const attachmentsDir = yield* fileSystem.makeTempDirectoryScoped({
prefix: "t3-claude-v2-session-identity-",
+ if (importedNativeThreadId !== undefined) {
+ // An unreadable copy in another project must not hide the readable one.
+ yield* fileSystem.makeDirectory(
+ path.join(attachmentsDir, "projects", "-other", `${importedNativeThreadId}.jsonl`),
+ { recursive: true },
+ );
+ const projectDir = path.join(attachmentsDir, "projects", "-workspace");
+ yield* fileSystem.makeDirectory(projectDir, { recursive: true });
+ yield* fileSystem.writeFileString(
+ path.join(projectDir, `${importedNativeThreadId}.jsonl`),
+ `{"type":"user","message":{"role":"user","content":"hello"},"sessionId":"${importedNativeThreadId}"}\n`,
+ );