Skip to content

Add timeout for remote compaction requests#23451

Merged
jif-oai merged 1 commit into
mainfrom
jif/compact-timeout
May 20, 2026
Merged

Add timeout for remote compaction requests#23451
jif-oai merged 1 commit into
mainfrom
jif/compact-timeout

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented May 19, 2026

Why

Remote compaction currently sends a unary POST /responses/compact and waits for the full response before replacing history or emitting the completed ContextCompaction item. Unlike normal /responses streaming requests, this unary compact request had no timeout boundary. If the backend accepts the request and then stalls before returning a body, the existing request retry policy never sees a transport error, so the compact turn can remain stuck after the started item with no completion or actionable error.

That matches the reported hang shape in issues such as #18363, where logs show responses/compact was posted but no corresponding compact completion followed. A bounded request timeout gives the existing retry policy a concrete timeout error to retry instead of letting the user sit indefinitely on automatic context compaction.

What

  • Add a request timeout to legacy /responses/compact calls.
  • Size that timeout from the provider stream idle timeout with a conservative multiplier, so the default compact attempt gets 20 minutes rather than the 5 minute stream idle window.
  • Map API transport timeouts to a request timeout error instead of the child-process timeout message.

Testing

  • Not run (per request; CI will cover).

@jif-oai jif-oai requested a review from a team as a code owner May 19, 2026 08:31
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 19, 2026

@codex review

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: c9572f6ccd

ℹ️ 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 thread codex-rs/core/src/client.rs
@rhan-oai
Copy link
Copy Markdown
Collaborator

thanks!

@jif-oai jif-oai merged commit 18cefba into main May 20, 2026
43 of 47 checks passed
@jif-oai jif-oai deleted the jif/compact-timeout branch May 20, 2026 09:56
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 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