Fixes an intermittent failure of "replays a subagent from its own transcript file", and with it a broader leak: the unit suite was running the real Claude CLI hundreds of times per run. ## Cause The agent runs `claude auth status --json` in the background, without awaiting it, on every `initialize` and prompt. The scenario suite stubs it (`CLAUDE_CODE_EXECUTABLE=/usr/bin/false`), but other files didn't. Logging the probe's executable over one `vitest run` showed about 670 runs of the real CLI: | File | Real CLI runs | |---|---| | `acp-agent.test.ts` | 375 | | `create-session-options.test.ts` | 14 | | `incomplete-tools.test.ts` | 12 | | `session-titles.test.ts` | 8 | | `file-change-audit-integration.test.ts` | 5 | Each run uses the machine's own Claude config, unless a test points `CLAUDE_CONFIG_DIR` elsewhere. That flaky test points `CLAUDE_CONFIG_DIR` at a temp dir. The CLI it started then wrote `.claude.json`, `.claude.json.lock` and `backups/` into that dir about a second later, after the test body had finished. Under full-suite load, that overlapped the `rm` in the test's `finally`, which failed with `ENOTEMPTY`. Its assertions always passed. ## Change `vitest.config.ts` sets `CLAUDE_CODE_EXECUTABLE=/usr/bin/false` in `test.env`: - It's the override `claudeCliPath()` already honors, and the value the scenario suite already uses, so production code doesn't change. - `test.env` is the base environment, so it survives the `vi.unstubAllEnvs()` that three files call. - Runs that exercise the real CLI keep it: with `RUN_INTEGRATION_TESTS` (`npm run test:integration`) or `RUN_LIVE_CAPABILITY_AUDIT=true`, the variable is left unset. Tests that mock `execFile` or set their own executable are unaffected. ## Evidence - After the change, the same logging shows 0 runs of the real CLI: 688 probes run `/usr/bin/false`, and 108 hit files that already mock `execFile`. - The flaky test's temp dir now holds only the test's own `projects/` after the test, with no `.claude.json`. - Before the change, it failed in about 2 of 6 full runs on my machine. After, 8 of 8 full runs passed. - A full run takes about 4.8 s instead of 8.4 s. - The variable is `/usr/bin/false` in a default run and unset with either opt-in flag. - `npm run build`, `npm run check`, `npm run test:run`.
ACP adapter for the Claude Agent SDK
Use Claude Agent SDK from ACP-compatible clients!
This tool implements an ACP agent by using the official Claude Agent SDK, supporting:
- Context @-mentions
- Images
- Tool calls (with permission requests)
- Compact file changes through the negotiated AIR diff patch extension
- Following
- Edit review
- TODO lists
- Nested subagent transcripts
- Interactive (and background) terminals
- Custom Slash commands
- Client MCP servers
- Session-scoped long-running goals for AIR through the goal extension under
_meta.jetbrains.air.goal - Structured errors, recovery, and warnings through the opt-in session failure extension
- Concrete model and effort defaults through the opt-in recommended config value extension
- Tool permission presentation, editable choices, and durable effects through the permission extension
- One fact per field in every tool call report, as the ACP tool call contract defines
- All AIR extensions, capabilities, and
_metakeys: AIR extensions
Learn more about the Agent Client Protocol.
To try changes that have landed on main but are not released yet, install from the
preview channel — every push to main publishes one. See
docs/RELEASES.md.
npm install @agentclientprotocol/claude-agent-acp@preview
Subagent sessions
Subagents are exposed only after bilateral capability negotiation. Until the released ACP SDKs
preserve the draft clientCapabilities.subagents field, a supporting client may advertise
nativeSubagentSessions in _meta.jetbrains.air.capabilities; the adapter mirrors the capability
in its initialize response. The canonical field remains supported and takes precedence once it is
available. Without either client signal, Agent/Task lifecycle keeps its legacy ordinary ACP
tool-call representation and child interactions stay on the root session. Clients that use the
historical _meta["subagent-transcript"] capability or forwardSubagentText session option retain
the flattened child transcript behavior. See AIR extensions.
Contribution Policy
This project does not require a Contributor License Agreement (CLA). Instead, contributions are accepted under the following terms:
By contributing to this project, you agree that your contributions will be licensed under the Apache License, Version 2.0. You affirm that you have the legal right to submit your work, that you are not including code you do not have rights to, and that you understand contributions are made without requiring a Contributor License Agreement (CLA).