fix(v2): clear per-group agent-runner src before copy

fs.cpSync never removes files that disappeared from the source, so
renamed or deleted files linger in data/v2-sessions/<group>/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) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-04-13 10:25:40 +03:00
parent b63dd186df
commit d4aacfe416

View File

@@ -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 });