From d4aacfe416f59c565df8445e4226861843ca118d Mon Sep 17 00:00:00 2001 From: gavrielc Date: Mon, 13 Apr 2026 10:25:40 +0300 Subject: [PATCH] fix(v2): clear per-group agent-runner src before copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fs.cpSync never removes files that disappeared from the source, so renamed or deleted files linger in data/v2-sessions//agent-runner-src/. The container's entrypoint runs tsc over the whole mounted src via tsconfig's `include: ["src/**/*"]`, so a single stale file fails the compile and the container exits 2. Latent since the dir was introduced — surfaced when the provider interface refactor made a leftover index-v2.ts stop typechecking. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/container-runner.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/container-runner.ts b/src/container-runner.ts index 794f2a3..34e9096 100644 --- a/src/container-runner.ts +++ b/src/container-runner.ts @@ -216,11 +216,14 @@ function buildMounts(agentGroup: AgentGroup, session: Session): VolumeMount[] { } mounts.push({ hostPath: claudeDir, containerPath: '/home/node/.claude', readonly: false }); - // Agent-runner source (per agent group, recompiled on container startup) + // Agent-runner source (per agent group, recompiled on container startup). + // Clear the destination before copying so files deleted or renamed + // upstream don't linger — tsc picks them up via `include: ["src/**/*"]` + // and a single stale file will fail the compile. const agentRunnerSrc = path.join(projectRoot, 'container', 'agent-runner', 'src'); const groupRunnerDir = path.join(DATA_DIR, 'v2-sessions', agentGroup.id, 'agent-runner-src'); if (fs.existsSync(agentRunnerSrc)) { - // Always copy — source files may have changed beyond just the index + fs.rmSync(groupRunnerDir, { recursive: true, force: true }); fs.cpSync(agentRunnerSrc, groupRunnerDir, { recursive: true }); } mounts.push({ hostPath: groupRunnerDir, containerPath: '/app/src', readonly: false });