Skip to content

fix: show clear error when project directory is missing#1008

Open
chuks-qua wants to merge 10 commits intopingdotgg:mainfrom
chuks-qua:fix/975-missing-project-directory
Open

fix: show clear error when project directory is missing#1008
chuks-qua wants to merge 10 commits intopingdotgg:mainfrom
chuks-qua:fix/975-missing-project-directory

Conversation

@chuks-qua
Copy link
Contributor

@chuks-qua chuks-qua commented Mar 13, 2026

What Changed

When a project folder is deleted or moved, the app now shows a clear "Project directory does not exist" error instead of the misleading "Codex CLI (codex) is not installed or not executable" message. The composer is disabled, sidebar threads show strikethrough styling, and everything auto-recovers when the folder is restored.

Why

Fixes #975. When a project directory no longer exists, spawnSync("codex", ["--version"], { cwd: deletedPath }) fails with ENOENT. The existing code assumed ENOENT always meant the binary was missing, producing a confusing error. Users had no way to understand the actual problem or recover from it.

Key Changes

  • Server: Disambiguate ENOENT in assertSupportedCodexCliVersion by checking existsSync(input.cwd) in the error path (zero cost in happy path)
  • WS endpoint: New projects.checkDirectories method that stats project cwds in parallel via Effect.forEach
  • React hook: useProjectDirectoryCheck checks directories on mount and window focus (debounced 500ms), using shallow-compared cwd selectors to avoid unnecessary re-checks
  • Sidebar: Threads under missing projects show line-through text-destructive/60 strikethrough
  • ChatView: Non-dismissible error banner, disabled composer with helpful placeholder, blocked sending. All auto-clear when directory is restored.

UI Changes

Before

image

After

image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Show clear error and disable chat input when project directory is missing

  • Adds a projects.checkDirectories WebSocket RPC endpoint in wsServer.ts that stats each provided path and returns missing or non-directory cwds.
  • Adds a useProjectDirectoryCheck hook that polls on mount, project changes, and window focus, storing results in a new missingProjectCwds set in the app store.
  • In ChatView.tsx, blocks message sending and shows a non-dismissible ThreadErrorBanner when the active project directory is missing.
  • In Sidebar.tsx, threads with missing project directories are shown with strikethrough and muted destructive color.
  • Improves the CLI version check in codexAppServerManager.ts to distinguish between a missing cwd and a missing CLI binary on ENOENT failures.

Macroscope summarized 29fb16a.

@github-actions github-actions bot added the size:L 100-499 changed lines (additions + deletions). label Mar 13, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d671b71d-f094-4a55-aaa2-070be5f1bc0a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 13, 2026
Resolve merge conflicts in Sidebar.tsx and __root.tsx after
upstream removed newThreadId, preferredTerminalEditor, and
related store selectors.
@chuks-qua chuks-qua marked this pull request as ready for review March 13, 2026 19:21
@chuks-qua
Copy link
Contributor Author

@juliusmarminge could you please authorize the ci, and check review please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] error message 'Codex CLI (codex) is not installed or not executable' when project folder no longer exists or has been moved

1 participant