Skip to content

Commit 4af8b11

Browse files
konardclaude
andcommitted
fix(core): run state sync before docker compose up to prevent broken bind mounts
autoSyncState does git-reset-hard which replaces directory inodes on disk. When it ran after docker compose up, the bind mount for .orch/auth/codex (mounted as /home/dev/.codex) pointed to a deleted inode, leaving the container with an empty CODEX_HOME directory. This caused codex inside the container to fail with: "Error loading configuration: No such file or directory" Moving autoSyncState before runDockerUpIfNeeded ensures bind mount source directories are stable before the container starts. Fixes #158 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ec93a48 commit 4af8b11

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/lib/src/usecases/actions/create-project.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,14 @@ const runCreateProject = (
263263
const hasAgent = finalConfig.agentMode !== undefined
264264
const waitForAgent = hasAgent && (finalConfig.agentAuto ?? false)
265265

266+
// CHANGE: run state sync before docker compose up
267+
// WHY: autoSyncState does git-reset-hard which replaces directory inodes;
268+
// running it after docker-up invalidates bind mounts (e.g. .orch/auth/codex → /home/dev/.codex)
269+
// causing "Error loading configuration: No such file or directory" inside the container.
270+
// REF: issue-158
271+
// INVARIANT: bind mount source directories must be stable before container start
272+
yield* _(autoSyncState(`chore(state): update ${formatStateSyncLabel(projectConfig.repoUrl)}`))
273+
266274
yield* _(
267275
runDockerUpIfNeeded(resolvedOutDir, projectConfig, {
268276
runUp: command.runUp,
@@ -278,7 +286,6 @@ const runCreateProject = (
278286

279287
yield* _(maybeCleanupAfterAgent(waitForAgent, resolvedOutDir))
280288

281-
yield* _(autoSyncState(`chore(state): update ${formatStateSyncLabel(projectConfig.repoUrl)}`))
282289
yield* _(maybeOpenSsh(command, hasAgent, waitForAgent, projectConfig))
283290
}).pipe(Effect.asVoid)
284291

0 commit comments

Comments
 (0)