mirror of
https://github.com/openai/codex.git
synced 2026-11-06 16:32:29 +00:00
[codex] stylistic changes (#29068)
## Summary - express remote compaction result handling as an exhaustive match - preserve the special `TurnAborted` path without emitting a generic compaction error - rely on the standard `test_codex` provider setup in the compaction budget test Follow-up to review feedback on #28707. ## Testing - `just test -p codex-core compaction_budget_exhaustion_aborts_without_error_or_retry` - `just fmt`
This commit is contained in:
1 parent
e0ac5d3c15
commit
802c98cab4
2 files changed
+13
-18
No files matched your search
@@ -165,18 +165,18 @@ async fn run_remote_compact_task_inner(
|
|||||||
attempt
|
attempt
|
||||||
.track(sess.as_ref(), status, codex_error, analytics_details)
|
.track(sess.as_ref(), status, codex_error, analytics_details)
|
||||||
.await;
|
.await;
|
||||||
if matches!(&result, Err(CodexErr::TurnAborted)) {
|
match result {
|
||||||
return result;
|
Ok(()) => Ok(()),
|
||||||
|
Err(err @ CodexErr::TurnAborted) => Err(err),
|
||||||
|
Err(err) => {
|
||||||
|
sess.track_turn_codex_error(turn_context, &err);
|
||||||
|
let event = EventMsg::Error(
|
||||||
|
err.to_error_event(Some("Error running remote compact task".to_string())),
|
||||||
|
);
|
||||||
|
sess.send_event(turn_context, event).await;
|
||||||
|
Err(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if let Err(err) = result {
|
|
||||||
sess.track_turn_codex_error(turn_context, &err);
|
|
||||||
let event = EventMsg::Error(
|
|
||||||
err.to_error_event(Some("Error running remote compact task".to_string())),
|
|
||||||
);
|
|
||||||
sess.send_event(turn_context, event).await;
|
|
||||||
return Err(err);
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run_remote_compact_task_inner_impl(
|
async fn run_remote_compact_task_inner_impl(
|
||||||
|
|||||||
@@ -284,15 +284,8 @@ async fn compaction_budget_exhaustion_aborts_without_error_or_retry(remote_v2: b
|
|||||||
])
|
])
|
||||||
};
|
};
|
||||||
let responses = mount_sse_sequence(&server, vec![compact_response]).await;
|
let responses = mount_sse_sequence(&server, vec![compact_response]).await;
|
||||||
let mut model_provider = built_in_model_providers(/*openai_base_url*/ None)["openai"].clone();
|
|
||||||
model_provider.base_url = Some(format!("{}/v1", server.uri()));
|
|
||||||
model_provider.supports_websockets = false;
|
|
||||||
if !remote_v2 {
|
|
||||||
model_provider.name = "OpenAI-compatible test provider".to_string();
|
|
||||||
}
|
|
||||||
let test = test_codex()
|
let test = test_codex()
|
||||||
.with_config(move |config| {
|
.with_config(move |config| {
|
||||||
config.model_provider = model_provider;
|
|
||||||
config.rollout_budget = Some(RolloutBudgetConfig {
|
config.rollout_budget = Some(RolloutBudgetConfig {
|
||||||
limit_tokens: 10,
|
limit_tokens: 10,
|
||||||
reminder_at_remaining_tokens: vec![5],
|
reminder_at_remaining_tokens: vec![5],
|
||||||
@@ -303,6 +296,8 @@ async fn compaction_budget_exhaustion_aborts_without_error_or_retry(remote_v2: b
|
|||||||
.features
|
.features
|
||||||
.enable(Feature::RemoteCompactionV2)
|
.enable(Feature::RemoteCompactionV2)
|
||||||
.expect("test config should allow remote compaction v2");
|
.expect("test config should allow remote compaction v2");
|
||||||
|
} else {
|
||||||
|
config.model_provider.name = "OpenAI-compatible test provider".to_string();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build(&server)
|
.build(&server)
|
||||||
|
|||||||
Reference in new issue
Block a user