Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

feat(agent): drive Claude Code over ACP with a Claude subscription#13

Draft
sontek wants to merge 2 commits into
obot-platform:mainfrom
sontek:feat/claude-code-acp-backend
Draft

feat(agent): drive Claude Code over ACP with a Claude subscription#13
sontek wants to merge 2 commits into
obot-platform:mainfrom
sontek:feat/claude-code-acp-backend

Conversation

@sontek

@sontek sontek commented Jun 7, 2026

Copy link
Copy Markdown

Add an opt-in agent backend that runs the official Claude Code CLI over ACP, so prompts execute on the user's Claude subscription instead of the built-in API-key agent. Enable it with DISCOBOT_AGENT_BACKEND=claude-code-acp; the server forwards that flag and the subscription token into the sandbox, and the CLI authenticates itself. Discobot never holds the subscription token at the API layer, which keeps this on the sanctioned first-party path rather than a third-party app reusing a subscription.

Discobot already had an ACP client and Claude Code ships an ACP server, so the wiring itself was small. Getting real turns to complete also meant closing a few gaps in the existing ACP adapter: a bounded startup so a stalled handshake falls back instead of hanging, the empty (not null) mcpServers value that strict ACP servers require, and translating ACP's start and stop signals into the shapes the UI stream schema expects.

A second commit adds an optional SANDBOX_DNS setting to point sandbox containers at specific resolvers. It's needed on hosts whose DNS runs on a loopback address the sandbox VM can't reach.

sontek added 2 commits June 7, 2026 12:40
Add an opt-in agent backend that routes prompts through the official
Claude Code CLI via its ACP server adapter, so prompts run on a user's
Claude subscription instead of the built-in API-key agent. Select it
with DISCOBOT_AGENT_BACKEND=claude-code-acp; the server passes that flag
and CLAUDE_CODE_OAUTH_TOKEN into the sandbox so the CLI authenticates
itself.

Also close three gaps in the ACP adapter that blocked real turns:
- spawn the CLI with a bounded handshake timeout and surface its stderr,
  so a stalled start falls back to the default agent instead of wedging
  agent-api startup
- send session/new with an empty mcpServers array; strict ACP servers
  reject a null value
- carry a messageId on the start chunk and map the ACP stop reason onto
  Discobot's finishReason enum, which the UI stream schema validates
  strictly (an unmapped value showed an error block and hung the turn)
Add a SANDBOX_DNS setting that sets the DNS servers on sandbox
containers. Needed when the host resolver isn't reachable from the
sandbox VM's network (for example a host running DNS on a loopback
address that the VM gateway can't forward to), where the container
otherwise can't resolve any names.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant