## 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