core: add experimental per-session git worktree mode

Introduce WorktreeHandle to create/reuse/remove linked checkouts under <cwd>/codex/<conversation>; add config flag enable_git_worktree (and trust logic for worktrees); plumb protocol: RemoveWorktree, WorktreeRemoved, SessionConfigured.worktree_path; update exec/TUI integration; docs: experimental config section.

# Conflicts:
#	codex-rs/core/src/codex.rs
#	codex-rs/tui/src/chatwidget.rs
This commit is contained in:
Ahmed Ibrahim
2025-09-29 08:58:37 -07:00
parent 2719fdd12a
commit 103265bac6
18 changed files with 528 additions and 2 deletions
+10
View File
@@ -644,6 +644,7 @@ notifications = [ "agent-turn-complete", "approval-requested" ]
| `tui.notifications` | boolean \| array<string> | Enable desktop notifications in the tui (default: false). |
| `hide_agent_reasoning` | boolean | Hide model reasoning events. |
| `show_raw_agent_reasoning` | boolean | Show raw reasoning (when available). |
| `[Experimental] enable_git_worktree` | boolean | Create a linked git worktree per session under `cwd/codex/<conversation_id>` (default: false). |
| `model_reasoning_effort` | `minimal` \| `low` \| `medium` \| `high` | Responses API reasoning effort. |
| `model_reasoning_summary` | `auto` \| `concise` \| `detailed` \| `none` | Reasoning summaries. |
| `model_verbosity` | `low` \| `medium` \| `high` | GPT‑5 text verbosity (Responses API). |
@@ -656,3 +657,12 @@ notifications = [ "agent-turn-complete", "approval-requested" ]
| `responses_originator_header_internal_override` | string | Override `originator` header value. |
| `projects.<path>.trust_level` | string | Mark project/worktree as trusted (only `"trusted"` is recognized). |
| `tools.web_search` | boolean | Enable web search tool (alias: `web_search_request`) (default: false). |
#### Experimental git worktree mode
Enabling `[Experimental] enable_git_worktree` creates a linked checkout at
`<cwd>/codex/<conversation_id>` via `git worktree add --detach HEAD`. The worktree starts in a
detached HEAD state so Codex never clashes with a branch you already have checked out. When you
want to commit, run `git switch -c <branch>` (or attach to an existing branch) inside the worktree
and work as usual. Codex automatically appends `/codex/` to `.git/info/exclude` so these
directories stay out of `git status` without touching your tracked `.gitignore`.