Skip to content

feat(worktree): repo-local random worktrees and default repo session worktrees#19

Open
galz10 wants to merge 2 commits intomainfrom
codex/workspace-local-random-worktrees
Open

feat(worktree): repo-local random worktrees and default repo session worktrees#19
galz10 wants to merge 2 commits intomainfrom
codex/workspace-local-random-worktrees

Conversation

@galz10
Copy link
Copy Markdown
Owner

@galz10 galz10 commented Mar 31, 2026

Summary

  • Store newly created worktrees under each repo at <repo>/.idx0/worktrees/ instead of app support.
  • Use random worktree directory names (wt-<token>) with collision-safe suffixing.
  • Default repo-backed session creation to always create a worktree, with an opt-out settings toggle.
  • Keep repo status clean by idempotently adding .idx0/ to local git exclude.

Details

  • WorktreeService now creates worktree paths inside repo-local .idx0/worktrees and resolves .git directory or .git file (gitdir:) when updating local exclude.
  • SessionService.createSession now auto-creates worktrees for repo-backed sessions when defaultCreateWorktreeForRepoSessions is enabled (default true), while still allowing explicit attach/create flows.
  • New Session UI reflects enforced behavior by disabling the worktree toggle when the setting is enabled for a git repo and shows guidance to disable in Settings.
  • Session settings copy was updated to match the new behavior.
  • Integration and unit tests were expanded for random path generation, collision handling, .idx0/ exclude idempotence, and default session behavior.

Related Issues

  • Related to workspace-local random worktree rollout.

How to Validate

  1. Run focused tests:
    • xcodebuild -project idx0.xcodeproj -scheme idx0 -destination 'platform=macOS' test -only-testing:idx0Tests/WorktreePathGenerationTests -only-testing:idx0Tests/SessionServiceIntegrationTests
  2. In app Settings > Sessions, keep "Create Worktree By Default" enabled.
  3. Create a session with a git repo folder and verify session is worktree-backed under <repo>/.idx0/worktrees/wt-*.
  4. In that repo, run git status --short and verify .idx0/ is not shown as untracked.
  5. Disable "Create Worktree By Default" and create another repo session; verify non-worktree branch mode is available and session can be created without a worktree.

Pre-Merge Checklist

  • lint-docs check is green
  • tests check is green
  • maintainability result reviewed (phase 1 report-only)
  • Added/updated tests (if needed)
  • Updated relevant documentation and README (if needed)
  • Noted breaking changes (if any)
  • Tested on macOS

@galz10 galz10 force-pushed the codex/workspace-local-random-worktrees branch from a54a5a4 to 4ead238 Compare March 31, 2026 03:36
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