Real-coder layer: OpenCode via ACP — full rebuild + auto-wire#168
Merged
seamus-brady merged 1 commit intomainfrom Apr 26, 2026
Merged
Real-coder layer: OpenCode via ACP — full rebuild + auto-wire#168seamus-brady merged 1 commit intomainfrom
seamus-brady merged 1 commit intomainfrom
Conversation
Replaces the unfinished REST-based coder integration with an ACP-driven (Agent Client Protocol over JSON-RPC stdio) layer talking to a sandboxed OpenCode 1.14.25 container. The cog/PM gets dispatch_coder as an async tool; agent_coder collapses to a thin specialist (frame → dispatch → inspect → land); CBR ingest captures the actual OpenCode tool titles per session. Layers: - coder/acp.gleam: JSON-RPC over stdio (open / initialize / session_new / session_prompt(_async) / session_cancel / close), pure decoders pinned against probed shapes - coder/manager.gleam: OTP actor — warm container pool, per-dispatch driver, three-stage kill chain (ACP cancel → handle close → manager teardown), per-task budget enforcement, hourly cost cap, janitor TTL - coder/ingest.gleam: completed dispatch → CbrCase (CodePattern, tools_used = ACP tool titles seen during the session) + raw JSON archive in .springdrift/memory/coder/sessions/ - tools/coder_dispatch.gleam: dispatch_coder (async via OTP worker — cog stays free), cancel_coder_session, list_coder_sessions; budget clamp-and-report against operator ceilings - tools/coder.gleam: project_status / project_read / project_grep host-side tools (verification scaffolding removed; OpenCode runs its own tests in-container) - agents/coder.gleam: single-mode specialist using Group A planner tools + project_* + dispatch_coder + builtin - agent/cognitive*.gleam: PendingCoderDispatch + CoderDispatchComplete ride the existing WaitingForAgents accumulator; multiple parallel dispatches fold into one rethink Auto-wire (zero-touch fresh install): - AppConfig defaults: image=springdrift-coder:1.14.25, provider_id=anthropic, model_id=claude-sonnet-4-6 - project_root falls back to cwd at runtime - Image auto-builds from Containerfile.coder on first boot if missing - Operator only needs ANTHROPIC_API_KEY in .env Removed: - coder/client.gleam (REST wrapper) - coder/supervisor.gleam (per-task slot lifecycle) - http_probe_get FFI - run_tests/run_build/run_format tools (host-side scaffolding) - coder_start_session/send/end_session tools (replaced by dispatch_coder) - ProjectCommands type + default_project_commands - Three-mode coder agent branching (sandbox-only / no-sandbox legacy) - manager.acquire/send/end_session compat shims Tests: 2077 passing, build clean, format clean. e2e_test.gleam gated by SPRINGDRIFT_CODER_E2E=1; scripts/e2e-coder.sh sources .env for all e2e config. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dispatch_coderis the cog/PM tool: one OpenCode session per call, async via OTP worker so the cog stays responsive — mid-flightcancel_coder_sessionis reachable.agent_codercollapses to a thin specialist (frame → dispatch → inspect → land), only registered when[coder]is fully configured.[coder]defaults are populated (image=springdrift-coder:1.14.25, provider=anthropic, model=claude-sonnet-4-6);project_rootfalls back to cwd; the application auto-buildsContainerfile.coderon first boot if the image is missing. Operator only needsANTHROPIC_API_KEYin.env.What's in the box
coder/acp.gleam— JSON-RPC over stdio bindings; pure decoders pinned against probed shapescoder/manager.gleam— OTP actor with warm container pool, per-dispatch driver, three-stage kill chain, per-task budget enforcement, hourly cost cap, janitor TTLcoder/ingest.gleam— completed dispatch → CbrCase (CodePattern,tools_used= ACP tool titles seen during the session) + raw JSON archive in.springdrift/memory/coder/sessions/tools/coder_dispatch.gleam— async-via-workerdispatch_coder+ synccancel_coder_session/list_coder_sessions; budget clamp-and-report against operator ceilingsagent/cognitive*.gleam—PendingCoderDispatch+CoderDispatchCompleteride the existingWaitingForAgentsaccumulator; multiple parallel dispatches fold into one rethinkRemoved
coder/client.gleamREST wrapper,coder/supervisor.gleamper-task slot lifecycle,http_probe_getFFIrun_tests/run_build/run_formathost-side scaffolding toolscoder_start_session/coder_send/coder_end_sessiontools, replaced bydispatch_coderProjectCommandstype +default_project_commandsmanager.acquire/manager.send/manager.end_sessiondeprecated compat shimsTest plan
gleam buildcleangleam formatcleangleam test— 2126 passing (gained 49 from rebase on top of Fix three agent-tool dispatch bugs of the same family #163–Sub-agent truncation guard with embedded partial output #166)cognitive/agents.gleamresolved — kept both Fix three agent-tool dispatch bugs of the same family #163'sbuiltin_callspartition and the newcoder_sync_callspartitiongleam runsmoke — confirm boot on the live agentscripts/e2e-coder.sh— real OpenCode container round-trip, costs a couple of cents, gated bySPRINGDRIFT_CODER_E2E=1ANTHROPIC_API_KEYonly in.env,gleam run, confirm image auto-builds anddispatch_coderis on the cog tool surface🤖 Generated with Claude Code