Skip to content

Bug/1726#1737

Open
Rehan959 wants to merge 2 commits intopingdotgg:mainfrom
Rehan959:bug/1726
Open

Bug/1726#1737
Rehan959 wants to merge 2 commits intopingdotgg:mainfrom
Rehan959:bug/1726

Conversation

@Rehan959
Copy link
Copy Markdown

@Rehan959 Rehan959 commented Apr 4, 2026

What Changed

Added workspace path validation in ProviderCommandReactor.ts that checks if the project directory exists before attempting to start a provider session. When the path doesn't exist, returns a clear error message instead of the misleading "Claude Code native binary not found" error.

Why

Bug #1726: When users rename a project directory via terminal/file explorer and then try to send a message to Claude, the error message was misleading:

  • Before: "Claude Code native binary not found at claude. Please ensure Claude Code is installed..."
  • After: "Project workspace path '/path/to/project' no longer exists. The project directory may have been moved or deleted. Please recreate the project or select a different project."
    Root cause: The database stores the original workspace path, and when the directory is renamed externally, the stale path is passed to the Claude SDK which fails with a confusing error about the binary not being found.

Checklist

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

Note

Low Risk
Low risk: adds a preflight filesystem existence check before session start and a test to lock the behavior in. Main risk is edge cases around filesystem stat errors/permissions affecting turn start.

Overview
Improves error handling when starting a turn for projects whose workspace directory was moved/deleted. ProviderCommandReactor now validates the resolved workspace cwd exists before starting a provider session, and returns a ProviderAdapterRequestError with a clear, actionable message when it doesn’t.

Adds a regression test asserting that a missing workspaceRoot fails with the new message and does not call startSession/sendTurn.

Reviewed by Cursor Bugbot for commit b949ec7. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Return a clear error when a project workspace path does not exist before starting a provider session

Before starting or resuming a provider session in ProviderCommandReactor, a precondition check now stats the resolved workspace path using FileSystem. If the path is missing or the stat fails, the reactor returns a ProviderAdapterRequestError with a message indicating the path no longer exists, and the session start is skipped.

  • Adds a test case in ProviderCommandReactor.test.ts verifying the error message contains 'no longer exists' and that startSession is not called.
  • Behavioral Change: requests targeting a deleted workspace path now fail immediately with a structured error instead of propagating a lower-level filesystem error from within the provider adapter.
📊 Macroscope summarized b949ec7. 2 files reviewed, 3 issues evaluated, 1 issue filtered, 1 comment posted

🗂️ Filtered Issues

apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts — 0 comments posted, 1 evaluated, 1 filtered
  • line 1705: The path existence check logic at line 276 is incorrect. The condition pathExists.success === Option.none() will never match the case where the path doesn't exist. When fs.stat fails with NotFound, the code returns Effect.succeed(false), meaning pathExists.success will be Some(false), not None. Comparing Some(false) === Option.none() will always be false (reference inequality). The check should verify the actual boolean value, e.g., Option.isNone(pathExists.success) || !pathExists.success.value or using the appropriate Result accessor to check if the value is false. [ Cross-file consolidated ]

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 4, 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: 92aadf1a-1185-422c-8fc8-62ef95c3f31f

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

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 size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 4, 2026
),
Effect.result,
);
if (Result.isFailure(pathExists) || pathExists.success === Option.none()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical Layers/ProviderCommandReactor.ts:270

When the workspace path does not exist, Effect.succeed(false) creates a Result.Success(false), but the condition pathExists.success === Option.none() never matches because false is not Option.none(). The missing-path error is therefore never raised. Consider checking Result.isSuccess(pathExists) && !pathExists.value to detect the non-existent path case.

Also found in 1 other location(s)

apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts:1705

The path existence check logic at line 276 is incorrect. The condition pathExists.success === Option.none() will never match the case where the path doesn't exist. When fs.stat fails with NotFound, the code returns Effect.succeed(false), meaning pathExists.success will be Some(false), not None. Comparing Some(false) === Option.none() will always be false (reference inequality). The check should verify the actual boolean value, e.g., Option.isNone(pathExists.success) || !pathExists.success.value or using the appropriate Result accessor to check if the value is false.

🤖 Copy this AI Prompt to have your agent fix this:
In file apps/server/src/orchestration/Layers/ProviderCommandReactor.ts around line 270:

When the workspace path does not exist, `Effect.succeed(false)` creates a `Result.Success(false)`, but the condition `pathExists.success === Option.none()` never matches because `false` is not `Option.none()`. The missing-path error is therefore never raised. Consider checking `Result.isSuccess(pathExists) && !pathExists.value` to detect the non-existent path case.

Evidence trail:
1. apps/server/src/orchestration/Layers/ProviderCommandReactor.ts lines 262-277 (viewed at REVIEWED_COMMIT) - shows the pathExists logic and the condition check
2. package.json shows effect version 4.0.0-beta.43
3. Effect v4 Result.ts source (https://github.com/Effect-TS/effect-smol/blob/main/packages/effect/src/Result.ts) - confirms `Success` interface has `readonly success: A` (direct value, not Option-wrapped)
4. The condition `pathExists.success === Option.none()` at line 270 compares boolean to Option object, which never matches

Also found in 1 other location(s):
- apps/server/src/orchestration/Layers/ProviderCommandReactor.test.ts:1705 -- The path existence check logic at line 276 is incorrect. The condition `pathExists.success === Option.none()` will never match the case where the path doesn't exist. When `fs.stat` fails with `NotFound`, the code returns `Effect.succeed(false)`, meaning `pathExists.success` will be `Some(false)`, not `None`. Comparing `Some(false) === Option.none()` will always be `false` (reference inequality). The check should verify the actual boolean value, e.g., `Option.isNone(pathExists.success) || !pathExists.success.value` or using the appropriate `Result` accessor to check if the value is `false`.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b949ec7. Configure here.

),
Effect.result,
);
if (Result.isFailure(pathExists) || pathExists.success === Option.none()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path validation never triggers due to wrong comparison

High Severity

The condition pathExists.success === Option.none() always evaluates to false, completely defeating the workspace path validation. After Effect.result, pathExists.success is a boolean (true or false), not an Option. Comparing a boolean to Option.none() via === can never match. When a path doesn't exist, the catchTag produces Effect.succeed(false), so pathExists.success is false — but the check never catches it, and the stale path is still passed to the provider, reproducing the exact bug this PR intended to fix.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b949ec7. Configure here.

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 4, 2026

Approvability

Verdict: Needs human review

1 blocking correctness issue found. Multiple reviewers have identified a critical bug in the implementation: the path existence check never triggers because it compares a boolean to an Option, which always fails. The fix as written does not work and requires correction before merge.

You can customize Macroscope's approvability policy. Learn more.

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant