Skip to content

Commit c646b77

Browse files
committed
fix(server): scan Claude project dirs like the CLI resolves them
1 parent 8461c79 commit c646b77

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9122,13 +9122,19 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
91229122
const configuredDir = adapterOptions.environment.CLAUDE_CONFIG_DIR?.trim() ?? "";
91239123
const projectsDir = path.join(
91249124
configuredDir.length > 0
9125-
? path.resolve(configuredDir)
9125+
? path.resolve(session.cwd, configuredDir)
91269126
: path.join(yield* HostProcess.HomeDirectory, ".claude"),
91279127
"projects",
91289128
);
9129+
// Empty only when every copy of the id is empty; any message means
9130+
// the CLI may still resume it.
9131+
let found = false;
91299132
for (const project of yield* fileSystem.readDirectory(projectsDir)) {
91309133
const transcriptPath = path.join(projectsDir, project, `${nativeThreadId}.jsonl`);
9131-
if (!(yield* fileSystem.exists(transcriptPath))) {
9134+
// Stray files beside the project dirs fail with ENOTDIR.
9135+
if (
9136+
!(yield* fileSystem.exists(transcriptPath).pipe(Effect.orElseSucceed(() => false)))
9137+
) {
91329138
continue;
91339139
}
91349140
const conversationLine = yield* fileSystem
@@ -9139,9 +9145,12 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
91399145
Stream.filter(isClaudeConversationLine),
91409146
Stream.runHead,
91419147
);
9142-
return Option.isNone(conversationLine);
9148+
if (Option.isSome(conversationLine)) {
9149+
return false;
9150+
}
9151+
found = true;
91439152
}
9144-
return false;
9153+
return found;
91459154
},
91469155
);
91479156

0 commit comments

Comments
 (0)