mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Add session forking to codex exec (#37367)
## What changed - Add `codex exec fork <SESSION_ID> [PROMPT]` for creating a new thread from an existing session ID or thread name. - Allow creating the fork without starting a turn, or immediately continue it with a prompt and optional images. - Preserve the source thread ID in the emitted session configuration while leaving the source session unchanged. ## Testing - Add CLI parsing coverage and an end-to-end test for promptless and prompted forks, thread naming, copied history, and unsupported promptless options. GitOrigin-RevId: b8f28b238a1526cc486c5beb886a63f68b8e7986
This commit is contained in:
@@ -149,10 +149,34 @@ pub enum Command {
|
||||
/// Resume a previous session by id or pick the most recent with --last.
|
||||
Resume(ResumeArgs),
|
||||
|
||||
/// Fork a previous session by id into a new session.
|
||||
Fork(ForkArgs),
|
||||
|
||||
/// Run a code review against the current repository.
|
||||
Review(ReviewArgs),
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
pub struct ForkArgs {
|
||||
/// Conversation/session id (UUID) or thread name to fork.
|
||||
#[arg(value_name = "SESSION_ID")]
|
||||
pub session_id: String,
|
||||
|
||||
/// Optional image(s) to attach to the prompt sent after forking.
|
||||
#[arg(
|
||||
long = "image",
|
||||
short = 'i',
|
||||
value_name = "FILE",
|
||||
value_delimiter = ',',
|
||||
num_args = 1
|
||||
)]
|
||||
pub images: Vec<PathBuf>,
|
||||
|
||||
/// Optional prompt to send after forking. If `-` is used, read from stdin.
|
||||
#[arg(value_name = "PROMPT", value_hint = clap::ValueHint::Other)]
|
||||
pub prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
struct ResumeArgsRaw {
|
||||
// Note: This is the direct clap shape. We reinterpret the positional when --last is set
|
||||
|
||||
Reference in New Issue
Block a user