Skip to content

Commit dd4cafd

Browse files
committed
fix: silent validation and graceful re-prompt on invalid directory
Changes: - Removed validateRepositoryAccess() that was logging errors - Now validates silently using checkWriteAccess + validateRepo directly - When invalid, clears path and re-prompts WITHOUT logging errors This fixes the infinite error log loop. Now when user selects an invalid directory and clicks Run: 1. Validation happens silently 2. Path is cleared 3. Prompt appears cleanly (no error spam) Much cleaner UX!
1 parent 24cf515 commit dd4cafd

File tree

1 file changed

+8
-34
lines changed

1 file changed

+8
-34
lines changed

src/renderer/features/task-detail/stores/taskExecutionStore.ts

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,6 @@ const toClarifyingQuestions = (
6060
}));
6161
};
6262

63-
async function validateRepositoryAccess(
64-
path: string,
65-
addLog: (log: AgentEvent) => void,
66-
): Promise<boolean> {
67-
// Check if directory exists by checking write access
68-
const canWrite = await window.electronAPI?.checkWriteAccess(path);
69-
if (!canWrite) {
70-
addLog({
71-
type: "error",
72-
ts: Date.now(),
73-
message: `Cannot access or write to folder: ${path}`,
74-
});
75-
return false;
76-
}
77-
78-
// Check if it's a valid git repository with actual content
79-
const isRepo = await window.electronAPI?.validateRepo(path);
80-
if (!isRepo) {
81-
addLog({
82-
type: "error",
83-
ts: Date.now(),
84-
message: `Folder is not a valid git repository: ${path}`,
85-
});
86-
return false;
87-
}
88-
89-
return true;
90-
}
91-
9263
export interface TodoItem {
9364
content: string;
9465
status: "pending" | "in_progress" | "completed";
@@ -576,13 +547,16 @@ export const useTaskExecutionStore = create<TaskExecutionStore>()(
576547
}
577548
}
578549

579-
const isValid = await validateRepositoryAccess(
580-
effectiveRepoPath,
581-
(log) => store.addLog(taskId, log),
582-
);
550+
// Quick validation without logging errors (we'll handle it gracefully)
551+
const canWrite =
552+
await window.electronAPI?.checkWriteAccess(effectiveRepoPath);
553+
const isRepo = canWrite
554+
? await window.electronAPI?.validateRepo(effectiveRepoPath)
555+
: false;
583556

584-
if (!isValid) {
557+
if (!canWrite || !isRepo) {
585558
// Repository path is invalid - clear it and show the prompt again
559+
// Don't log errors, just gracefully re-prompt the user
586560
store.setRepoPath(taskId, null);
587561

588562
// Recursively call runTask to trigger the prompt flow

0 commit comments

Comments
 (0)