Skip to content

Revert "[codex] Harden overflow auto-compaction recovery"#22170

Merged
aibrahim-oai merged 1 commit into
mainfrom
revert-22141-dev/auto-compact-context-overflow
May 11, 2026
Merged

Revert "[codex] Harden overflow auto-compaction recovery"#22170
aibrahim-oai merged 1 commit into
mainfrom
revert-22141-dev/auto-compact-context-overflow

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

Reverts #22141

@aibrahim-oai aibrahim-oai requested a review from a team as a code owner May 11, 2026 16:19
@aibrahim-oai aibrahim-oai enabled auto-merge (squash) May 11, 2026 16:20
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2804e5060f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 1075 to +1077
Err(CodexErr::ContextWindowExceeded) => {
sess.set_total_tokens_full(&turn_context).await;
if retries >= max_retries {
return Err(CodexErr::ContextWindowExceeded);
}
retries += 1;
let reset_client_session = match run_auto_compact(
&sess,
&turn_context,
client_session,
InitialContextInjection::BeforeLastUserMessage,
CompactionReason::ContextLimit,
CompactionPhase::MidTurn,
)
.await
{
Ok(reset_client_session) => reset_client_session,
Err(_) => return Err(CodexErr::TurnAborted),
};
if reset_client_session {
client_session.reset_websocket_session();
}
continue;
return Err(CodexErr::ContextWindowExceeded);
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.

P1 Badge Restore overflow compaction before returning context errors

Returning immediately on ContextWindowExceeded prevents the overflow recovery path from running. If the provider rejects a sampling request for input size before the pre/post token thresholds trigger, long threads now surface an error instead of compacting and retrying, so the next user turn remains stuck over the context window.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai disabled auto-merge May 11, 2026 16:33
@aibrahim-oai aibrahim-oai merged commit 69f3183 into main May 11, 2026
25 of 26 checks passed
@aibrahim-oai aibrahim-oai deleted the revert-22141-dev/auto-compact-context-overflow branch May 11, 2026 16:33
@github-actions github-actions Bot locked and limited conversation to collaborators May 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants