Skip to content

fix: resolve command to full exec path for Windows PATHEXT#272

Merged
carlos-algms merged 1 commit into
carlos-algms:mainfrom
daithyy:fix/windows-enoent
Jul 19, 2026
Merged

fix: resolve command to full exec path for Windows PATHEXT#272
carlos-algms merged 1 commit into
carlos-algms:mainfrom
daithyy:fix/windows-enoent

Conversation

@daithyy

@daithyy daithyy commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

resolves #270

On Windows, uv.spawn() does not automatically apply PATHEXT resolution. This means when the plugin tries to spawn provider commands like claude-agent-acp, it fails on Windows because the actual exectuable is claude-agent-acp.CMD but uv.spawn() does not know to look for the .CMD extension.

Issue

The raw command name from config is being passed directly.

Solution

vim.fn.exepath() function provides a cross-platform command resolver, which includes the extension on Windows.

Risk

Low, vim.fn.exepath() is available in all supported Neovim versions (0.11+). Full paths are accepted by uv.spawn().

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 86bb4464-7454-4332-9572-b0dfcd408d7f

📥 Commits

Reviewing files that changed from the base of the PR and between 78d4572 and c2ea276.

📒 Files selected for processing (1)
  • lua/agentic/acp/acp_transport.lua

📝 Walkthrough

Walkthrough

transport:start resolves config.command to an executable path before spawning and reports missing commands through the error state. uv.spawn uses the resolved path. When spawning fails without a handle, the transport closes its standard I/O pipes, enters the error state, and raises an error containing the spawn pid.

Sequence Diagram(s)

sequenceDiagram
  participant Transport
  participant Neovim
  participant ACPProcess
  Transport->>Neovim: Resolve config.command
  Neovim-->>Transport: Return executable path
  Transport->>ACPProcess: Spawn resolved command
  ACPProcess-->>Transport: Return handle or spawn error
  Transport->>Transport: Close pipes and set error state on failure
Loading

Poem

A bunny checks the command’s trail,
Finds its path beyond the veil.
If spawning stumbles, pipes close tight,
And error states hop into sight. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: resolving spawned commands to full executable paths on Windows.
Description check ✅ Passed The description accurately explains the Windows PATHEXT spawn failure and the exepath-based fix.
Linked Issues check ✅ Passed The PR satisfies #270 by resolving provider commands before spawning so the ACP agent can start on Windows.
Out of Scope Changes check ✅ Passed The added spawn-failure cleanup and logging changes are directly related to the command-resolution fix.
✨ 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.

@daithyy

daithyy commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lua/agentic/acp/acp_transport.lua`:
- Around line 96-100: The error path in acp_transport.lua now leaks the
allocated stdin/stdout/stderr libuv handles when
`vim.fn.exepath(config.command)` returns empty inside the transport startup
logic. Before calling `error(...)` in that branch, make sure the newly created
pipes are explicitly closed/cleaned up and any partial transport state is torn
down, using the existing startup code around `callbacks.on_state_change` and the
handle allocation site in `acp_transport.lua`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0b72ae05-2606-4b46-94d9-5340df8ee438

📥 Commits

Reviewing files that changed from the base of the PR and between 37a53a7 and ea26096.

📒 Files selected for processing (1)
  • lua/agentic/acp/acp_transport.lua

Comment thread lua/agentic/acp/acp_transport.lua Outdated
@daithyy
daithyy force-pushed the fix/windows-enoent branch 2 times, most recently from 940b069 to ac7c1bc Compare June 29, 2026 16:43
@daithyy

daithyy commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@daithyy
daithyy marked this pull request as ready for review June 29, 2026 16:45

@carlos-algms carlos-algms left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

:claude: One change requested — see inline comment on the exepath line.

Comment thread lua/agentic/acp/acp_transport.lua
@daithyy
daithyy force-pushed the fix/windows-enoent branch from ac7c1bc to 92fd78a Compare July 18, 2026 21:16
@daithyy
daithyy requested a review from carlos-algms July 18, 2026 21:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lua/agentic/acp/acp_transport.lua (1)

197-200: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Close pipes on uv.spawn failure to prevent handle leaks.

Although you successfully eliminated the main pipe leak by moving the exepath check up, if uv.spawn fails for other reasons (e.g., EACCES lack of execution permissions), the stdin, stdout, and stderr pipes allocated on lines 89-91 will still leak.

Additionally, since uv.spawn returns the error name as its second return value upon failure, it can be included in the error message for better debugging.

🔧 Proposed fix
-        if not handle then
+        if not handle then
+            stdin:close()
+            stdout:close()
+            stderr:close()
             callbacks.on_state_change("error")
-            error("Failed to spawn ACP agent process")
+            error(string.format("Failed to spawn ACP agent process: %s", tostring(pid)))
         end
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lua/agentic/acp/acp_transport.lua` around lines 197 - 200, Update the
uv.spawn failure branch in the ACP process startup flow to close the allocated
stdin, stdout, and stderr pipes before raising the error. Capture uv.spawn’s
second return value and include it in the failure message, while preserving the
existing on_state_change("error") callback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@lua/agentic/acp/acp_transport.lua`:
- Around line 197-200: Update the uv.spawn failure branch in the ACP process
startup flow to close the allocated stdin, stdout, and stderr pipes before
raising the error. Capture uv.spawn’s second return value and include it in the
failure message, while preserving the existing on_state_change("error")
callback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5b3fe158-8ca1-4597-8051-5aa2cbd6a652

📥 Commits

Reviewing files that changed from the base of the PR and between ac7c1bc and 92fd78a.

📒 Files selected for processing (1)
  • lua/agentic/acp/acp_transport.lua

@daithyy
daithyy force-pushed the fix/windows-enoent branch from 92fd78a to 78d4572 Compare July 18, 2026 21:28

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lua/agentic/acp/acp_transport.lua`:
- Around line 195-209: Move the “Spawned ACP agent process” debug log in the
uv.spawn flow to after the `if not handle` failure guard, so it only logs
successful spawns and never treats the failure message in `pid` as a process ID.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2d646a34-8f2e-4ae8-986e-ec1fcfc97204

📥 Commits

Reviewing files that changed from the base of the PR and between 92fd78a and 78d4572.

📒 Files selected for processing (1)
  • lua/agentic/acp/acp_transport.lua

Comment thread lua/agentic/acp/acp_transport.lua Outdated
@daithyy
daithyy force-pushed the fix/windows-enoent branch from 78d4572 to c2ea276 Compare July 18, 2026 21:32
@carlos-algms
carlos-algms merged commit a25dd58 into carlos-algms:main Jul 19, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENOENT: no such file or directory on setup for Windows

2 participants