Skip to content

Commit 9868f5e

Browse files
fix(server): an unreadable Claude transcript copy no longer hides a readable one
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 214d46d commit 9868f5e

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,11 @@ describe("ClaudeAdapterV2 native session identity", () => {
27292729
prefix: "t3-claude-v2-session-identity-",
27302730
});
27312731
if (importedNativeThreadId !== undefined) {
2732+
// An unreadable copy in another project must not hide the readable one.
2733+
yield* fileSystem.makeDirectory(
2734+
path.join(attachmentsDir, "projects", "-other", `${importedNativeThreadId}.jsonl`),
2735+
{ recursive: true },
2736+
);
27322737
const projectDir = path.join(attachmentsDir, "projects", "-workspace");
27332738
yield* fileSystem.makeDirectory(projectDir, { recursive: true });
27342739
yield* fileSystem.writeFileString(

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11194,6 +11194,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
1119411194
);
1119511195
// Any message in any transcript copy means Claude may still resume it.
1119611196
let found = false;
11197+
let unreadable = false;
1119711198
for (const project of yield* fileSystem.readDirectory(projectsDir)) {
1119811199
const transcriptPath = path.join(projectsDir, project, `${nativeThreadId}.jsonl`);
1119911200
// Stray files beside the project dirs fail with ENOTDIR.
@@ -11209,13 +11210,18 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
1120911210
Stream.splitLines,
1121011211
Stream.filter(isClaudeConversationLine),
1121111212
Stream.runHead,
11213+
Effect.option,
1121211214
);
11213-
if (Option.isSome(conversationLine)) {
11215+
if (Option.isNone(conversationLine)) {
11216+
unreadable = true;
11217+
continue;
11218+
}
11219+
if (Option.isSome(conversationLine.value)) {
1121411220
return "conversation" as const;
1121511221
}
1121611222
found = true;
1121711223
}
11218-
return found ? ("empty" as const) : ("missing" as const);
11224+
return found && !unreadable ? ("empty" as const) : ("missing" as const);
1121911225
});
1122011226

1122111227
const runtime: ProviderAdapter.ProviderAdapterV2SessionRuntime = {

0 commit comments

Comments
 (0)