Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions codex-rs/analytics/src/facts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl TurnCodexErrorFact {
#[serde(rename_all = "snake_case")]
pub enum CodexErrKind {
TurnAborted,
RolloutBudgetExceeded,
SessionBudgetExceeded,
Stream,
ContextWindowExceeded,
ThreadNotFound,
Expand Down Expand Up @@ -196,7 +196,7 @@ impl From<&CodexErr> for CodexErrKind {
fn from(error: &CodexErr) -> Self {
match error {
CodexErr::TurnAborted => CodexErrKind::TurnAborted,
CodexErr::RolloutBudgetExceeded => CodexErrKind::RolloutBudgetExceeded,
CodexErr::SessionBudgetExceeded => CodexErrKind::SessionBudgetExceeded,
CodexErr::Stream(..) => CodexErrKind::Stream,
CodexErr::ContextWindowExceeded => CodexErrKind::ContextWindowExceeded,
CodexErr::ThreadNotFound(_) => CodexErrKind::ThreadNotFound,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions codex-rs/app-server-protocol/src/protocol/v2/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum NonSteerableTurnKind {
#[ts(export_to = "v2/")]
pub enum CodexErrorInfo {
ContextWindowExceeded,
RolloutBudgetExceeded,
SessionBudgetExceeded,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the v2 error code spelling

For app-server v2 clients that already switch on the documented codexErrorInfo string, this changes the server-emitted value from rolloutBudgetExceeded to sessionBudgetExceeded; those clients will miss the budget-exhaustion classification even though the rest of the error/turn payload shape is unchanged. If this is meant to be a Rust naming cleanup, keep the old wire spelling with a targeted serde rename (or otherwise version the API change) so existing app-server consumers continue to classify this error.

AGENTS.md reference: AGENTS.md:L103-L111

Useful? React with 👍 / 👎.

UsageLimitExceeded,
ServerOverloaded,
CyberPolicy,
Expand Down Expand Up @@ -116,7 +116,7 @@ impl From<CoreCodexErrorInfo> for CodexErrorInfo {
fn from(value: CoreCodexErrorInfo) -> Self {
match value {
CoreCodexErrorInfo::ContextWindowExceeded => CodexErrorInfo::ContextWindowExceeded,
CoreCodexErrorInfo::RolloutBudgetExceeded => CodexErrorInfo::RolloutBudgetExceeded,
CoreCodexErrorInfo::SessionBudgetExceeded => CodexErrorInfo::SessionBudgetExceeded,
CoreCodexErrorInfo::UsageLimitExceeded => CodexErrorInfo::UsageLimitExceeded,
CoreCodexErrorInfo::ServerOverloaded => CodexErrorInfo::ServerOverloaded,
CoreCodexErrorInfo::CyberPolicy => CodexErrorInfo::CyberPolicy,
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/app-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ There are additional item-specific events:
`codexErrorInfo` maps to the `CodexErrorInfo` enum. Common values:

- `ContextWindowExceeded`
- `RolloutBudgetExceeded`
- `SessionBudgetExceeded`
- `UsageLimitExceeded`
- `HttpConnectionFailed { httpStatusCode? }`: upstream HTTP failures including 4xx/5xx
- `ResponseStreamConnectionFailed { httpStatusCode? }`: failure to connect to the response SSE stream
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/core/src/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async fn run_compact_task_inner_impl(
Err(err @ (CodexErr::Interrupted | CodexErr::TurnAborted)) => {
return Err(err);
}
Err(e @ CodexErr::RolloutBudgetExceeded) => {
Err(e @ CodexErr::SessionBudgetExceeded) => {
sess.track_turn_codex_error(turn_context.as_ref(), &e);
let event = EventMsg::Error(e.to_error_event(/*message_prefix*/ None));
sess.send_event(&turn_context, event).await;
Expand Down
2 changes: 1 addition & 1 deletion codex-rs/core/src/session/rollout_budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Session {
.rollout_budget()
.record_usage(usage)
{
return Err(CodexErr::RolloutBudgetExceeded);
return Err(CodexErr::SessionBudgetExceeded);
}
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/core/tests/suite/rollout_budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async fn exhausted_budget_fails_current_and_later_turns() -> Result<()> {
matches!(
event,
EventMsg::Error(error)
if error.codex_error_info == Some(CodexErrorInfo::RolloutBudgetExceeded)
if error.codex_error_info == Some(CodexErrorInfo::SessionBudgetExceeded)
)
})
.await;
Expand Down Expand Up @@ -315,7 +315,7 @@ async fn compaction_budget_exhaustion_fails_without_retry(remote_v2: bool) -> Re
matches!(
event,
EventMsg::Error(error)
if error.codex_error_info == Some(CodexErrorInfo::RolloutBudgetExceeded)
if error.codex_error_info == Some(CodexErrorInfo::SessionBudgetExceeded)
)
})
.await;
Expand Down
6 changes: 3 additions & 3 deletions codex-rs/protocol/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub enum CodexErr {
TurnAborted,

#[error("shared rollout token budget exhausted")]
RolloutBudgetExceeded,
SessionBudgetExceeded,

/// Returned by ResponsesClient when the SSE stream disconnects or errors out **after** the HTTP
/// handshake has succeeded but **before** it finished emitting `response.completed`.
Expand Down Expand Up @@ -176,7 +176,7 @@ impl CodexErr {
pub fn is_retryable(&self) -> bool {
match self {
CodexErr::TurnAborted
| CodexErr::RolloutBudgetExceeded
| CodexErr::SessionBudgetExceeded
| CodexErr::Interrupted
| CodexErr::EnvVar(_)
| CodexErr::Fatal(_)
Expand Down Expand Up @@ -224,7 +224,7 @@ impl CodexErr {
pub fn to_codex_protocol_error(&self) -> CodexErrorInfo {
match self {
CodexErr::ContextWindowExceeded => CodexErrorInfo::ContextWindowExceeded,
CodexErr::RolloutBudgetExceeded => CodexErrorInfo::RolloutBudgetExceeded,
CodexErr::SessionBudgetExceeded => CodexErrorInfo::SessionBudgetExceeded,
CodexErr::UsageLimitReached(_)
| CodexErr::QuotaExceeded
| CodexErr::UsageNotIncluded => CodexErrorInfo::UsageLimitExceeded,
Expand Down
4 changes: 2 additions & 2 deletions codex-rs/protocol/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,7 @@ pub enum NonSteerableTurnKind {
#[ts(rename_all = "snake_case")]
pub enum CodexErrorInfo {
ContextWindowExceeded,
RolloutBudgetExceeded,
SessionBudgetExceeded,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept legacy rollout budget error names

When resuming or reading a rollout written before this rename, the persisted ErrorEvent still contains "codex_error_info":"rollout_budget_exceeded"; after this enum variant rename there is no serde(alias = "rollout_budget_exceeded"), so RolloutRecorder::load_rollout_items fails to deserialize that JSONL line and skips it. In the budget-exhaustion path an Error event is followed by TurnComplete, so dropping only the error makes the rebuilt thread history look completed instead of failed and hides the original budget error; keep the new serialized name, but accept the old one for rollout compatibility.

AGENTS.md reference: AGENTS.md:L103-L111

Useful? React with 👍 / 👎.

UsageLimitExceeded,
ServerOverloaded,
CyberPolicy,
Expand Down Expand Up @@ -1728,7 +1728,7 @@ impl CodexErrorInfo {
match self {
Self::ThreadRollbackFailed | Self::ActiveTurnNotSteerable { .. } => false,
Self::ContextWindowExceeded
| Self::RolloutBudgetExceeded
| Self::SessionBudgetExceeded
| Self::UsageLimitExceeded
| Self::ServerOverloaded
| Self::CyberPolicy
Expand Down
Loading