[Meta] Hexagonal: AgentDispatchPort migration #513

Open
opened 2026-04-28 09:24:03 +00:00 by claude-desktop · 0 comments
Collaborator

Tracking

Lift the agentic stack (agent-runner + container lifecycle + MCP wiring) behind a single domain port — AgentDispatchPort — mirroring the maturity already reached by ForgePort (Phase 2).

After this milestone, flow-runner / foreman / webhook handlers never see SDK messages, container IDs, or MCP server specs — only dispatch(type, request) → { taskId, worker }.

Why now

Forge layer fully hexagonalised. Agentic layer is the remaining gap. Audit findings (2026-04-28):

  • ClaudeAgentPort exists but agent-runner.ts:715–780 still calls SDK direct
  • SDKMessage import leak at agent-runner.ts:24, PR-extract regex at :679
  • Host-mode vs container-mode branch at agent-runner.ts:543–548
  • mcp-config.ts dual-mounts forgejo-mcp + forge-mcp without a port
  • Session key <type>:<repo>:<issue> does not bind forge → cross-forge collision risk
  • foreman.ts builds SDK options directly

Scope

# Issue Order
#514 AgentDispatchPort domain interface (types-only) 1
#515 ContainerLifecyclePort + DockerContainerLifecycle adapter 2
#516 McpRegistryPort + DefaultMcpRegistry adapter 2
#517 Finish ClaudeAgentPort migration — kill SDK leaks 3
#518 DefaultAgentDispatch orchestrator 4
#519 Migrate flows / foreman / webhook callsites 5
#520 Bind forge into session key independent
#521 Per-call token override in dispatch independent

Out of scope

  • ComfyUI-style graph editor changes (M21)
  • Forge layer changes — already complete
  • New agent types or instances

References

  • docs/agents-architecture.md
  • docs/foreman.md
  • docs/containers.md
  • Audit summary 2026-04-28 (this conversation)
## Tracking Lift the agentic stack (agent-runner + container lifecycle + MCP wiring) behind a single domain port — `AgentDispatchPort` — mirroring the maturity already reached by `ForgePort` (Phase 2). After this milestone, flow-runner / foreman / webhook handlers never see SDK messages, container IDs, or MCP server specs — only `dispatch(type, request) → { taskId, worker }`. ## Why now Forge layer fully hexagonalised. Agentic layer is the remaining gap. Audit findings (2026-04-28): - `ClaudeAgentPort` exists but `agent-runner.ts:715–780` still calls SDK direct - `SDKMessage` import leak at `agent-runner.ts:24`, PR-extract regex at `:679` - Host-mode vs container-mode branch at `agent-runner.ts:543–548` - `mcp-config.ts` dual-mounts forgejo-mcp + forge-mcp without a port - Session key `<type>:<repo>:<issue>` does not bind forge → cross-forge collision risk - `foreman.ts` builds SDK options directly ## Scope | # | Issue | Order | |---|-------|-------| | #514 | AgentDispatchPort domain interface (types-only) | 1 | | #515 | ContainerLifecyclePort + DockerContainerLifecycle adapter | 2 | | #516 | McpRegistryPort + DefaultMcpRegistry adapter | 2 | | #517 | Finish ClaudeAgentPort migration — kill SDK leaks | 3 | | #518 | DefaultAgentDispatch orchestrator | 4 | | #519 | Migrate flows / foreman / webhook callsites | 5 | | #520 | Bind forge into session key | independent | | #521 | Per-call token override in dispatch | independent | ## Out of scope - ComfyUI-style graph editor changes (M21) - Forge layer changes — already complete - New agent types or instances ## References - `docs/agents-architecture.md` - `docs/foreman.md` - `docs/containers.md` - Audit summary 2026-04-28 (this conversation)
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#513
No description provided.