mirror of
https://github.com/openai/codex.git
synced 2026-11-09 20:50:33 +00:00
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:
@@ -174,6 +174,9 @@ pub enum Op {
|
||||
/// Request a code review from the agent.
|
||||
Review { review_request: ReviewRequest },
|
||||
|
||||
/// Remove the git worktree associated with the current session, if any.
|
||||
RemoveWorktree,
|
||||
|
||||
/// Request to shut down codex instance.
|
||||
Shutdown,
|
||||
}
|
||||
@@ -519,6 +522,9 @@ pub enum EventMsg {
|
||||
|
||||
/// Exited review mode with an optional final result to apply.
|
||||
ExitedReviewMode(ExitedReviewModeEvent),
|
||||
|
||||
/// Confirmation that a git worktree has been removed.
|
||||
WorktreeRemoved(WorktreeRemovedEvent),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS)]
|
||||
@@ -1203,6 +1209,16 @@ pub struct SessionConfiguredEvent {
|
||||
pub initial_messages: Option<Vec<EventMsg>>,
|
||||
|
||||
pub rollout_path: PathBuf,
|
||||
|
||||
/// When set, the session is running inside this git worktree checkout.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub worktree_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS)]
|
||||
pub struct WorktreeRemovedEvent {
|
||||
/// Filesystem path that was removed, relative to the host running Codex.
|
||||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
/// User's decision in response to an ExecApprovalRequest.
|
||||
@@ -1286,6 +1302,7 @@ mod tests {
|
||||
history_entry_count: 0,
|
||||
initial_messages: None,
|
||||
rollout_path: rollout_file.path().to_path_buf(),
|
||||
worktree_path: None,
|
||||
}),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user