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

View File

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