Files
PaperClipAI/packages
Harshul Rathodandcommitperclip[bot] 0c456fcca1 fix(adapters): find Windows ACP commands through PATHEXT (#14441)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Local adapters (Claude, Codex, Gemini, Kimi) start an ACP server
command for each agent
> - Each adapter finds a bare ACP command, such as `codex-acp`, on
`PATH`
> - On Windows, that lookup only tries the exact name and ignores
`PATHEXT`
> - So a real install such as `codex-acp.exe` is never found, and the
environment check says the ACP command is not available
> - This pull request makes the lookup try each `PATHEXT` form on
Windows, with the same rule that `adapter-utils` already uses
> - The benefit is that ACP works on Windows with a normal `PATH`
install, and all four adapters use one rule

## Linked Issues or Issue Description

Fixes #14372

Related PRs: #14129 and #13053 fix the `PATHEXT` lookup in the GitHub
launchers (`github-launcher.ts`). #9996 changes how the ACP engine
probes `gemini --version` on Windows. They change different code, so
this PR does not duplicate them.

## What Changed

- `adapter-utils`: add `commandPathCandidates(dir, command, { env,
includeBareName })`. It returns the files to check for a command in one
`PATH` folder. On Windows it returns one file for each `PATHEXT` entry.
With `includeBareName`, it also returns the bare name last. It returns
the name unchanged if the command has an extension or if the platform is
not Windows.
- `adapter-utils`: `resolveCommandPath` now uses
`commandPathCandidates`. Its behavior does not change.
- `claude-local`, `codex-local`, `gemini-local`, `kimi-local`:
`findCommandOnPath` in `acp.ts` now checks the `PATHEXT` forms first,
then the bare name. Before this change, the four copies checked only the
bare name. They still find an extensionless file, so their old results
do not change.
- `gemini-local`, `kimi-local`: these adapters already read `PATH` from
the agent `env` config. They now also read `PATHEXT` from it, and use
the host value when the config does not set it.

## Verification

- `pnpm vitest run packages/adapter-utils/src/server-utils.test.ts -t
commandPathCandidates`: 4 new tests, for Windows `PATHEXT` forms, the
bare-name fallback, a name with an extension, and other platforms.
- `pnpm vitest run packages/adapters/codex-local/src/server/acp.test.ts
-t "finds a Windows codex-acp.exe"`: a new test puts `codex-acp.exe` on
`PATH` and sets the platform to `win32`. It expects the ACP engine to be
available for the bare command `codex-acp`. Without the fix, the test
fails with the error from #14372: `Codex ACP server command is not
available: codex-acp`.
- `gemini-local` and `kimi-local` `acp.test.ts`: a new test in each puts
`gemini.ACP` or `kimi.ACP` on a configured `PATH` and sets `PATHEXT:
".ACP"` in the agent `env` config. It expects the ACP engine to be
available. Without the configured `PATHEXT` support, both tests fail.
- The tests set `process.platform` to `win32`, so they also run on Linux
CI. The fixture file names match the `PATHEXT` case exactly, so the
tests do not depend on a case-insensitive file system.
- I ran the test suites of `adapter-utils` and the four adapters on
Windows, with and without this change. No test fails only with this
change.
- `pnpm --filter <package> typecheck` passes for `adapter-utils` and the
four adapters after each commit. `scripts/check-forbidden-tokens.mjs`
and `scripts/check-module-boundaries.mjs` pass.

## Risks

- Low risk. On macOS and Linux, the lookup does not change: it checks
the same single path.
- On Windows, the lookup now prefers a `PATHEXT` file (for example
`codex-acp.exe` or `codex-acp.cmd`) over an extensionless file in the
same folder. In an npm `.bin` folder, it can now return `codex-acp.cmd`
where it returned the extensionless shell script before. Windows cannot
run that shell script directly, so the old result did not work either.
An extensionless file alone is still found.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- Provider: Anthropic
- Model: Claude Opus 5.5 (`claude-opus-5-5`)
- Tool: Claude Code, with tool use (shell commands, file edits, and test
runs)
- The model found the issue, wrote the change and the tests, and ran the
checks. I reviewed the change and the test results.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: commitperclip[bot] <284812584+commitperclip[bot]@users.noreply.github.com>
2026-12-04 17:49:44 -08:00
..