mirror of
https://github.com/openai/codex.git
synced 2026-10-22 17:58:46 +00:00
Notify lifecycle extensions of compaction usage limits (#49097)
## Why Usage-limit failures during manual or post-turn compaction did not notify turn lifecycle extensions, leaving them unable to react to these errors. ## What changed Emit the turn error lifecycle notification for `UsageLimitExceeded` in both compaction paths. Preserve the completed answer after post-turn compaction fails, and avoid duplicating the error already emitted by manual compaction. GitOrigin-RevId: f31155e5991d762a0779030921aedbd1f818cfbb
This commit is contained in:
@@ -736,6 +736,12 @@ pub(crate) async fn run_turn(
|
||||
) {
|
||||
return Err(err);
|
||||
}
|
||||
let error = err.to_codex_protocol_error();
|
||||
if matches!(error, CodexErrorInfo::UsageLimitExceeded) {
|
||||
// Preserve the completed answer while stopping automatic work.
|
||||
sess.emit_turn_error_lifecycle(turn_context.as_ref(), error)
|
||||
.await;
|
||||
}
|
||||
warn!(error = %err, "Post-turn compaction failed; preserving the completed turn");
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user