Pass initial history as an optional to codex delegate (#5950)

This will give us more freedom on controlling the delegation. i.e we can
fork our history and run `compact`.
This commit is contained in:
Ahmed Ibrahim
2025-10-30 07:22:42 -07:00
committed by GitHub
parent aa76003e28
commit 5fcc380bd9
2 changed files with 5 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ pub(crate) async fn run_codex_conversation_interactive(
parent_session: Arc<Session>,
parent_ctx: Arc<TurnContext>,
cancel_token: CancellationToken,
initial_history: Option<InitialHistory>,
) -> Result<Codex, CodexErr> {
let (tx_sub, rx_sub) = async_channel::bounded(SUBMISSION_CHANNEL_CAPACITY);
let (tx_ops, rx_ops) = async_channel::bounded(SUBMISSION_CHANNEL_CAPACITY);
@@ -43,7 +44,7 @@ pub(crate) async fn run_codex_conversation_interactive(
let CodexSpawnOk { codex, .. } = Codex::spawn(
config,
auth_manager,
InitialHistory::New,
initial_history.unwrap_or(InitialHistory::New),
SessionSource::SubAgent(SubAgentSource::Review),
)
.await?;
@@ -93,6 +94,7 @@ pub(crate) async fn run_codex_conversation_one_shot(
parent_session: Arc<Session>,
parent_ctx: Arc<TurnContext>,
cancel_token: CancellationToken,
initial_history: Option<InitialHistory>,
) -> Result<Codex, CodexErr> {
// Use a child token so we can stop the delegate after completion without
// requiring the caller to cancel the parent token.
@@ -103,6 +105,7 @@ pub(crate) async fn run_codex_conversation_one_shot(
parent_session,
parent_ctx,
child_cancel.clone(),
initial_history,
)
.await?;

View File

@@ -90,6 +90,7 @@ async fn start_review_conversation(
session.clone_session(),
ctx.clone(),
cancellation_token,
None,
)
.await)
.ok()