feat(agents): ContainerLifecyclePort + DockerContainerLifecycle adapter #515
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#515
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As
DefaultAgentDispatch, I want a port that owns container pre-flight, env binding, and exec setup, so that agent-runner orchestration is decoupled from Docker specifics and host-mode falls out as a no-op adapter.Acceptance criteria
Port
apps/server/src/domain/ports/container-lifecycle-port.tsexports:ensureReady(agent: AgentInstance): Promise<ContainerHandle>buildExecEnv(agent: AgentInstance, req: AgentDispatchRequest): Record<string, string>buildExecArgs(handle: ContainerHandle, env: Record<string, string>): ExecSpecrelease(handle: ContainerHandle, reason: ReleaseReason): Promise<void>dockerode/child_processtypes leak throughContainerHandleAdapter
apps/server/src/infrastructure/agents/docker-container-lifecycle.tsbuildDockerExecArgs()frominfrastructure/agents/container.tsagent-runner.ts:543–548host-mode branchrelease()covers worktree cleanup paths used todayapps/server/src/infrastructure/agents/host-container-lifecycle.tsreturns a no-op handle (cwd workdir, no exec wrap)Tests
release()is idempotentOut of scope
DefaultAgentDispatch— separate issuedocs/containers.mdReferences
docs/containers.mdapps/server/src/infrastructure/agents/container.tsapps/server/src/infrastructure/agents/agent-runner.ts:513–548