Compare commits

...
Author SHA1 Message Date
Cursor Agent b9268a3495 fix: draft thread effectiveCwd fallback to project cwd and remove redundant ensureGitWorkspace
- buildLocalDraftThread now accepts projectCwd and falls back to it
  when no worktreePath is set, matching server-side projection logic
- Remove single-use ensureGitWorkspace helper and its redundant call
  in statusDetails (execute already guards via assertWorkspaceDirectory)
2026-03-29 07:53:15 +00:00
3 changed files with 11 additions and 22 deletions

No files matched your search

-19
View File
@@ -673,20 +673,6 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: {
}),
);
const ensureGitWorkspace = (operation: string, cwd: string, args: readonly string[] = []) =>
assertWorkspaceDirectory(cwd, operation).pipe(
Effect.mapError(
(error) =>
new GitCommandError({
operation,
command: quoteGitCommand(args),
cwd,
detail: error.message,
cause: error,
}),
),
);
const runGit = (
operation: string,
cwd: string,
@@ -1073,11 +1059,6 @@ export const makeGitCore = Effect.fn("makeGitCore")(function* (options?: {
});
const statusDetails: GitCoreShape["statusDetails"] = Effect.fn("statusDetails")(function* (cwd) {
yield* ensureGitWorkspace("GitCore.statusDetails", cwd, [
"status",
"--porcelain=2",
"--branch",
]);
yield* refreshStatusUpstreamIfStale(cwd).pipe(Effect.ignoreCause({ log: true }));
const [statusStdout, unstagedNumstatStdout, stagedNumstatStdout] = yield* Effect.all(
+3 -2
View File
@@ -19,6 +19,7 @@ export function buildLocalDraftThread(
draftThread: DraftThreadState,
fallbackModelSelection: ModelSelection,
error: string | null,
projectCwd: string | null,
): Thread {
return {
id: threadId,
@@ -37,8 +38,8 @@ export function buildLocalDraftThread(
lastVisitedAt: draftThread.createdAt,
branch: draftThread.branch,
worktreePath: draftThread.worktreePath,
effectiveCwd: draftThread.worktreePath ?? null,
effectiveCwdSource: draftThread.worktreePath ? "worktree" : null,
effectiveCwd: draftThread.worktreePath ?? projectCwd,
effectiveCwdSource: draftThread.worktreePath ? "worktree" : projectCwd ? "project" : null,
effectiveCwdState: "available",
turnDiffSummaries: [],
activities: [],
+8 -1
View File
@@ -486,9 +486,16 @@ export default function ChatView({ threadId }: ChatViewProps) {
model: DEFAULT_MODEL_BY_PROVIDER.codex,
},
localDraftError,
fallbackDraftProject?.cwd ?? null,
)
: undefined,
[draftThread, fallbackDraftProject?.defaultModelSelection, localDraftError, threadId],
[
draftThread,
fallbackDraftProject?.defaultModelSelection,
fallbackDraftProject?.cwd,
localDraftError,
threadId,
],
);
const activeThread = serverThread ?? localDraftThread;
const runtimeMode =