Compare commits

...

2 Commits

Author SHA1 Message Date
Ben Brandt
eb4c16f10a fix: keep built-in web-fetch and claude-code-guide agents out of the Agent picker (#1672)
Fixes #1670.

## Problem

The Agent picker is meant to show only when the user has custom agents.
It showed with none, listing `web-fetch` as if it were one.

`supportedAgents()` returns Claude Code's built-in subagents together
with the custom ones, and `AgentInfo` does not say which is which, so
the adapter filters the built-ins by name (`BUILTIN_AGENT_NAMES`).
Claude Code lists two built-ins that the set did not name:

- `web-fetch`: listed where Claude Code's staged rollout turns it on, or
with `CLAUDE_CODE_WEB_FETCH_AGENT=1`.
- `claude-code-guide`: listed where the adapter's environment already
sets `CLAUDE_CODE_ENTRYPOINT`. The SDK sets `sdk-ts` only when the
variable is unset, and Claude Code leaves the agent out for that value.

The roster integration test (`src/tests/agent-discovery.test.ts`) exists
to catch this drift. It did not, because neither agent is in the roster
of an account outside the rollout that runs the test from a plain shell.

## Change

- Add `web-fetch` and `claude-code-guide` to `BUILTIN_AGENT_NAMES`. This
covers v1 and v2: both build the picker from the same set.
- The roster test sets `CLAUDE_CODE_WEB_FETCH_AGENT=1` and its own
`CLAUDE_CODE_ENTRYPOINT`, so the roster it compares against no longer
depends on the account or on the shell.

## Why the list is still hard-coded

The issue asks to derive the built-ins from the SDK. The only SDK
surface that separates them is `getContextUsage().agents`, which lists
the agents that are not built in. Session setup deliberately does not
wait for `getContextUsage` (see `readContextWindow` and the "does not
wait for getContextUsage during session creation" tests), so the picker
cannot be built from it without putting that request back on the
`session/new` and `session/load` path. A built-in behind a future
rollout can therefore still leak until it is added to the set and to the
test.

## Testing

- With CLI 2.1.328 and `CLAUDE_CODE_WEB_FETCH_AGENT=1`,
`supportedAgents()` reports `web-fetch` with no custom agents
configured, as in the issue. With a preset `CLAUDE_CODE_ENTRYPOINT` it
reports `claude-code-guide`.
- Both the roster test and the `discoverCustomAgents` unit test fail on
the old set and pass with the new one.
- `npm run build`, `npm run check`, and the whole suite against the real
CLI (`RUN_INTEGRATION_TESTS=true`): 4406 passed, 9 skipped.
2026-11-19 16:22:29 +01:00
acp-release-bot[bot]
9f1ca6eb9c chore(main): release 0.109.0 (#1665)
🤖 I have created a release *beep* *boop*
---


##
[0.109.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.1...v0.109.0)
(2026-11-19)


### Features

* announce session cursors on v2 and fork at a cursor
([#1658](https://github.com/agentclientprotocol/claude-agent-acp/issues/1658))
([5075d2e](5075d2e0df))
* insert one message per idempotencyKey on v2 session/prompt
([#1657](https://github.com/agentclientprotocol/claude-agent-acp/issues/1657))
([1c0792e](1c0792ea8c))
* order config options as model, effort, fast, ultracode, mode, agent
([#1666](https://github.com/agentclientprotocol/claude-agent-acp/issues/1666))
([f31da7f](f31da7f9f5))
* report Fast mode in the speed config option category
([#1659](https://github.com/agentclientprotocol/claude-agent-acp/issues/1659))
([8990c24](8990c2441d))
* send the predicted next prompt as prompt_suggestions_update
([#1660](https://github.com/agentclientprotocol/claude-agent-acp/issues/1660))
([f20ed1d](f20ed1d96a))


### Bug Fixes

* send a session's settings to Claude Code over stdin
([#1669](https://github.com/agentclientprotocol/claude-agent-acp/issues/1669))
([a768a9f](a768a9f50c))
* update to @anthropic-ai/claude-agent-sdk 0.3.328
([#1668](https://github.com/agentclientprotocol/claude-agent-acp/issues/1668))
([6e30711](6e307116d4))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
2026-11-19 14:31:59 +01:00
7 changed files with 48 additions and 4 deletions

View File

@@ -1,3 +1,3 @@
{
".": "0.108.1"
".": "0.109.0"
}

View File

@@ -1,5 +1,22 @@
# Changelog
## [0.109.0](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.1...v0.109.0) (2026-11-19)
### Features
* announce session cursors on v2 and fork at a cursor ([#1658](https://github.com/agentclientprotocol/claude-agent-acp/issues/1658)) ([5075d2e](https://github.com/agentclientprotocol/claude-agent-acp/commit/5075d2e0dffed68c4c1417d67c1c1e3ed43e6549))
* insert one message per idempotencyKey on v2 session/prompt ([#1657](https://github.com/agentclientprotocol/claude-agent-acp/issues/1657)) ([1c0792e](https://github.com/agentclientprotocol/claude-agent-acp/commit/1c0792ea8cbdfb96ac2afb1f675e4309446d0e5c))
* order config options as model, effort, fast, ultracode, mode, agent ([#1666](https://github.com/agentclientprotocol/claude-agent-acp/issues/1666)) ([f31da7f](https://github.com/agentclientprotocol/claude-agent-acp/commit/f31da7f9f5264eb2b57fbda577ac35141eb530c8))
* report Fast mode in the speed config option category ([#1659](https://github.com/agentclientprotocol/claude-agent-acp/issues/1659)) ([8990c24](https://github.com/agentclientprotocol/claude-agent-acp/commit/8990c2441d3d45cb4781cd81316b3ffbafee85ee))
* send the predicted next prompt as prompt_suggestions_update ([#1660](https://github.com/agentclientprotocol/claude-agent-acp/issues/1660)) ([f20ed1d](https://github.com/agentclientprotocol/claude-agent-acp/commit/f20ed1d96ac786af36b6bee3b4d5925a85b6d7ae))
### Bug Fixes
* send a session's settings to Claude Code over stdin ([#1669](https://github.com/agentclientprotocol/claude-agent-acp/issues/1669)) ([a768a9f](https://github.com/agentclientprotocol/claude-agent-acp/commit/a768a9f50c65b66b9f2d5806909a1db643fe3b6e))
* update to @anthropic-ai/claude-agent-sdk 0.3.328 ([#1668](https://github.com/agentclientprotocol/claude-agent-acp/issues/1668)) ([6e30711](https://github.com/agentclientprotocol/claude-agent-acp/commit/6e307116d461af22fb5d42eb4b8fbdb3643c6d6c))
## [0.108.1](https://github.com/agentclientprotocol/claude-agent-acp/compare/v0.108.0...v0.108.1) (2026-11-18)

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@agentclientprotocol/claude-agent-acp",
"version": "0.108.1",
"version": "0.109.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@agentclientprotocol/claude-agent-acp",
"version": "0.108.1",
"version": "0.109.0",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "2.8.0",

View File

@@ -3,7 +3,7 @@
"publishConfig": {
"access": "public"
},
"version": "0.108.1",
"version": "0.109.0",
"description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
"main": "dist/lib.js",
"types": "dist/lib.d.ts",

View File

@@ -44,12 +44,25 @@ import {
// personas, so we filter them out and only surface the Agent picker when the
// user (or a plugin/project) has configured custom agents. Update this set if
// the SDK's built-in roster changes.
//
// The set is matched by name because `AgentInfo` does not say where an agent
// comes from. `getContextUsage().agents` lists only the agents that are not
// built in, but session setup does not wait for that request (see
// `readContextWindow`).
//
// Claude Code does not list two of them in every session: `web-fetch` only
// where its staged rollout or `CLAUDE_CODE_WEB_FETCH_AGENT=1` turns it on, and
// `claude-code-guide` only where the adapter's environment sets
// `CLAUDE_CODE_ENTRYPOINT` (the SDK sets `sdk-ts` when it is unset, and Claude
// Code leaves the agent out for that value).
export const BUILTIN_AGENT_NAMES = new Set([
"claude",
"claude-code-guide",
"general-purpose",
"Explore",
"Plan",
"statusline-setup",
"web-fetch",
]);
// Value of the synthetic "Default" entry in the agent picker, which maps to the

View File

@@ -11,6 +11,13 @@ import { discoverCustomAgents, BUILTIN_AGENT_NAMES } from "../session-config-opt
// silently if the SDK changes its default roster: a newly added built-in would
// leak into the ACP "Agent" picker as if the user had configured it. This
// integration test runs the real SDK so the set is flagged the moment it does.
//
// Claude Code does not list every built-in in every session (issue #1670):
// `web-fetch` needs its staged rollout or `CLAUDE_CODE_WEB_FETCH_AGENT=1`, and
// `claude-code-guide` an entrypoint other than the SDK's `sdk-ts`. The test
// sets both variables, so the roster does not depend on the account or on the
// shell that runs it. A built-in behind a rollout with no variable set here
// shows up only where that rollout is on.
describe.skipIf(!process.env.RUN_INTEGRATION_TESTS)("agent discovery (SDK)", () => {
it("BUILTIN_AGENT_NAMES exactly covers the SDK's default agent roster", async () => {
const input = new Pushable<SDKUserMessage>();
@@ -24,6 +31,11 @@ describe.skipIf(!process.env.RUN_INTEGRATION_TESTS)("agent discovery (SDK)", ()
// regardless of what the developer has in ~/.claude/agents.
settingSources: [],
includePartialMessages: true,
env: {
...process.env,
CLAUDE_CODE_WEB_FETCH_AGENT: "1",
CLAUDE_CODE_ENTRYPOINT: "agent-roster-test",
},
},
});

View File

@@ -30656,10 +30656,12 @@ describe("agent selection config option", () => {
const q = {
supportedAgents: async () => [
{ name: "claude", description: "catch-all" },
{ name: "claude-code-guide", description: "guide" },
{ name: "Explore", description: "search" },
{ name: "general-purpose", description: "gp" },
{ name: "Plan", description: "architect" },
{ name: "statusline-setup", description: "status" },
{ name: "web-fetch", description: "fetch" },
{ name: "my-reviewer", description: "Reviews code" },
{ name: "my-writer", description: "Writes docs" },
],