Skip to content

[codex] Clean staging on init install race#207

Merged
yibeichan merged 2 commits into
mainfrom
codex/issue-52-init-rename-cleanup
Jun 11, 2026
Merged

[codex] Clean staging on init install race#207
yibeichan merged 2 commits into
mainfrom
codex/issue-52-init-rename-cleanup

Conversation

@yibeichan

Copy link
Copy Markdown
Owner

Summary

  • add a shared final install helper for completed init staging trees
  • clean up staging if the final target rmdir/rename fails
  • apply the helper to standalone, spoke, and hub init flows
  • add regression coverage for target-populated-after-precheck races in all three flows

Root cause

The init flows cleaned staging during build failures, but the final rmdir/rename install step was outside that error handling. If the target became non-empty after the early empty-directory guard, target.rmdir() raised and left the completed staging directory behind.

Validation

  • cd cli && uv run --with pytest --with . python -m pytest tests/test_init_standalone.py tests/test_sync.py tests/test_hub.py
  • cd cli && uv run --with pytest --with . python -m pytest tests/

Closes #52

@yibeichan yibeichan marked this pull request as ready for review June 11, 2026 21:11
@yibeichan yibeichan merged commit bab9de4 into main Jun 11, 2026
5 checks passed
@yibeichan yibeichan deleted the codex/issue-52-init-rename-cleanup branch June 11, 2026 23:07
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.

init flow: race window between entry-empty check and post-build rename in init_spoke / init_standalone / init_hub

1 participant