Commit Graph

3 Commits

Author SHA1 Message Date
Benjamin Carlsson
798833fe97 Add managed worktree creation (#42196)
## What changed

- Add `WorktreeManager::create` to create detached, Desktop-compatible worktrees from `HEAD` or an explicit base while preserving the source working-directory path.
- Isolate worktree Git operations from inherited repository selectors, hooks, filesystem monitors, and configured content filters.
- Validate the destination working directory and roll back incomplete worktrees and empty allocation buckets on failure.

## Testing

- Cover layout, base selection, annotated tags, nested working directories, Git environment isolation, filter suppression, source checkout preservation, unsafe symlinks, and creation rollback.

GitOrigin-RevId: bf172c3ff4268dab603d00a1d547485fcd0de368
2026-09-02 03:46:24 +00:00
Benjamin Carlsson
23cedf4802 Add thread ownership metadata for managed worktrees (#40716)
## What changed

- Add `WorktreeManager` APIs to bind a managed linked worktree to a thread and read its owner.
- Store the versioned `codex-thread.json` record in Git metadata with atomic, no-clobber writes, making repeat bindings idempotent while rejecting conflicting owners.
- Validate the managed worktree layout and reject primary, nested, and unmanaged checkouts before accessing ownership metadata.
- Run Git metadata queries with repository-selecting environment variables removed and hooks, filesystem monitoring, attributes, and LFS smudging disabled.

## Testing

- Add integration coverage for rejecting primary and unmanaged worktrees and for writing and reading the expected ownership schema.

GitOrigin-RevId: afec9a0ab711fe4017074bcec5807d860e9c88d0
2026-08-25 21:44:43 +00:00
Benjamin Carlsson
f832b2fe7b Add worktree settings parser (#40624)
## What changed

- Add the `codex-worktree` crate for resolving managed worktree settings from
  the existing `[desktop]` configuration.
- Default the worktree root to `$CODEX_HOME/worktrees`, automatic cleanup to
  enabled, and retained worktrees to 15.
- Validate configured roots, cleanup flags, and retention counts before
  exposing the effective settings.

## Testing

- Cover defaults, configured values, and invalid root and retention settings.

GitOrigin-RevId: 1b279c62ef41e3c8eb540ce9beaf0f6cd96d903f
2026-08-25 15:10:27 +00:00