8000 feat(acp): ACP client — external agents as first-class agent ids (Track 62) by stpinkie · Pull Request #8 · stpinkie/rhizome · GitHub
[go: up one dir, main page]

Skip to content

feat(acp): ACP client — external agents as first-class agent ids (Track 62) - #8

Merged
stpinkie merged 1 commit into
mainfrom
devin/track-62-acp-client
Sep 15, 2026
Merged

stpinkie merged 1 commit into
mainfrom
devin/track-62-acp-client

Conversation

@stpinkie
Copy link
Copy Markdown
Owner

Summary

  • agents.list[].acp = {command, args, env, cwd} binds an external ACP agent (gemini --acp, claude-code acp, …) as a routable Rhizome agent id — delegate/subagent/spawn/network route/mesh delegation all reach it.
  • pkg/acp.ClientManager lazily spawns the child (plain exec.Command, documented trust posture), handshakes initialize (fs:{read,write} + terminal:false), session/new+session/prompt per delegation, accumulates session/update text; process reuse + respawn on dead conn + services.ACPManager shutdown.
  • acp.Spawner slots between RemoteSpawner and local AgentLoopSpawner — hasLocal keeps ACP ids on-box; installed directly when mesh is off.
  • ExternalAgentRunner seam on the loop closes the ProcessRemoteDispatch bypass — remote peers delegating into ACP ids hit the client, not local inference.
  • fs/* requests served through the workspace sandbox (restrict_to_workspace + allow_*_paths); acp.client.permission_policy = deny (default) | allow-read-only | allow; terminal/* refused; authMethods → clear error.
  • acp_run tool via tools.ACPInvoker — SDK stays inside pkg/acp.

Test plan

  • go test ./pkg/acp — 24 tests: io.Pipe mock over real SDK transport + real-process E2E (test binary re-exec'd as a mock ACP agent through the actual spawn() path)
  • go test ./pkg/agent ./pkg/tools ./pkg/tools/fs ./pkg/gateway ./cmd/rhizome — green
  • golangci-lint run --build-tags goolm,stdjson — 0 issues
  • Live external agent (gemini/claude-code) — config shape documented in docs/guides/acp.md

Generated with Devin

@stpinkie
stpinkie changed the base branch from main to devin/track-61-acp September 15, 2026 05:11
…ck 62)

agents.list[].acp = {command, args, env, cwd} binds an external ACP agent
(gemini --acp, claude-code acp, ...) to a routable Rhizome agent id.

- pkg/acp/client.go: ClientManager lazily spawns the child process
  (exec.Command, trust posture documented), handshakes initialize with
  fs:{readTextFile,writeTextFile} + terminal:false, runs session/new +
  session/prompt per delegation and accumulates session/update text.
  Processes are reused across delegations, respawned on dead connections,
  and terminated via services.ACPManager on gateway shutdown.
- pkg/acp/client_handler.go: acpsdk.Client impl — fs/read_text_file and
  fs/write_text_file served through the workspace sandbox
  (restrict_to_workspace + tools.allow_*_paths via new exported
  toolfs.CompilePatterns, 64KiB read cap); terminal/* refused; external
  session/request_permission answered by acp.client.permission_policy =
  deny (default) | allow-read-only | allow; writeTextFile unadvertised and
  refused under allow-read-only; advertised authMethods -> clear error.
- pkg/acp/spawner.go: Spawner (tools.SubTurnSpawner) sits between
  RemoteSpawner and the local AgentLoopSpawner so ACP-bound ids dispatch
  to the external process while hasLocal keeps them on-box; installed
  directly when mesh is off.
- ExternalAgentRunner seam on AgentLoop (SetExternalAgentRunner):
  ProcessRemoteDispatch bypasses the spawner chain, so remote peers
  delegating into ACP-bound ids resolve to ClientManager.RunRemote there.
- AgentConfig.ACP -> AgentInstance.ACP; manifests advertise ACP-bound ids
  like locals automatically.
- pkg/tools/acp_run.go: acp_run tool (explicit one-off invocation escape
  hatch) via tools.ACPInvoker — SDK stays out of pkg/tools; registered
  only when the gateway installs the invoker.
- Registry resolved lazily (func() *AgentRegistry) in manager + spawner —
  config reload swaps the registry pointer.

Tests: io.Pipe mock agent over the real SDK transport (streaming, stop
reasons, per-policy permission outcomes, fs sandbox allow/deny, process
reuse) plus a real-process E2E via TestHelperProcess re-exec through
spawn(). docs/guides/acp.md gains the client section; design doc synced.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@stpinkie
stpinkie force-pushed the devin/track-62-acp-client branch from e77fd10 to 1a6b36e Compare September 15, 2026 08:18
@stpinkie
stpinkie changed the base branch from devin/track-61-acp to main September 15, 2026 10:03
@stpinkie
stpinkie merged commit 7a393d7 into main Sep 15, 2026
13 checks passed
@stpinkie
stpinkie deleted the devin/track-62-acp-client branch September 15, 2026 10:15
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.

1 participant

0