Skip to content

fix(shell): run autoSyncState before docker compose up (#158)#165

Merged
skulidropek merged 1 commit intomainfrom
issue-158
Mar 18, 2026
Merged

fix(shell): run autoSyncState before docker compose up (#158)#165
skulidropek merged 1 commit intomainfrom
issue-158

Conversation

@skulidropek
Copy link
Contributor

Summary

  • Moves autoSyncState() before runDockerUpIfNeeded() in runCreateProject (create-project.ts)
  • Adds test file create-project-state-sync-order.test.ts with 1 new test

Problem

codex fails to start inside Docker containers with "Error loading configuration: No such file or directory (os error 2)":

  1. docker compose up starts with bind-mount: .orch/auth/codex/home/dev/.codex
  2. autoSyncState() runs after Docker is up — calls git reset --hard on the host
  3. git reset --hard deletes and recreates .orch/auth/codex → new inode
  4. Docker bind-mount retains the old inode (now points to deleted directory)
  5. Inside container: /home/dev/.codex is empty → codex cannot find config.toml

Fix

Reorder: sync state first, then start Docker — ensures .orch/auth/codex inode is stable when docker compose up mounts it.

Invariant: ∀p: synced(p) ∧ stable_inode(.orch/auth/codex, p) → valid_mount(docker_up(p))

Test plan

  • New test create-project-state-sync-order.test.ts verifies ∀p: stateSyncProbeIndex(p) < dockerComposeUpIndex(p) — git rev-parse (autoSyncState probe) appears before docker compose up in recorded command sequence
  • All 82 existing tests pass
  • Typecheck clean
  • Lint clean (0 errors)

Closes #158

🤖 Generated with Claude Code

…unt inode invalidation

- Moves autoSyncState() call before runDockerUpIfNeeded() in runCreateProject
- Prevents git reset --hard from recreating .orch/auth/codex while Docker bind-mount is active
- Adds test verifying ∀p: stateSyncProbeIndex(p) < dockerComposeUpIndex(p)

Fixes #158

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@skulidropek skulidropek merged commit 02c2381 into main Mar 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Исправить:

1 participant