SIGN IN SIGN UP

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
B
Benjamin Carlsson committed
23cedf48023879d9666e41d8eee765a9482120c0
Parent: 346c4db
Committed by copyberry <copyberry@app.openai.com> on 8/25/2026, 9:44:43 PM