Skip to content

Skip startup prewarm when websockets are disabled#25868

Merged
jif-oai merged 1 commit into
mainfrom
jif/skip-http-startup-prewarm
Jun 2, 2026
Merged

Skip startup prewarm when websockets are disabled#25868
jif-oai merged 1 commit into
mainfrom
jif/skip-http-startup-prewarm

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • skip startup websocket prewarm setup when the model client has Responses-over-WebSocket disabled
  • avoid making HTTP-only sessions build prewarm prompt/tool state that cannot produce a reusable websocket session

Why

Recent macOS timing flakes were timing out while waiting for first-turn events in HTTP-only core tests. Startup prewarm is only useful for websocket-capable providers, but it was scheduled for every session. For HTTP-only test providers this added unnecessary async startup work before the regular turn could reach the mocked response flow.

Testing

  • bazel test //codex-rs/core:core-all-test --test_filter=suite::auto_review::remote_model_override_uses_catalog_model_for_strict_auto_review --test_output=errors
  • bazel test //codex-rs/core:core-all-test --test_filter=suite::request_permissions_tool::approved_folder_write_request_permissions_unblocks_later_apply_patch --test_output=errors

@jif-oai jif-oai requested a review from a team as a code owner June 2, 2026 14:59

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

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9876ae24f1

ℹ️ 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 +175 to +176
if !self.services.model_client.responses_websocket_enabled() {
return;

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 Preserve regular turns when prewarm is skipped

When responses_websocket_enabled() is false (for HTTP-only providers or after websocket fallback is disabled), this early return leaves startup_prewarm unset. The first regular turn then calls consume_startup_prewarm_for_regular_turn(), receives Unavailable { status: "not_scheduled" }, and RegularTask::run returns None instead of creating a normal HTTP ModelClientSession, so the turn stops after TurnStarted without sending the model request. Either keep scheduling a no-op ready session for this path or make the regular-turn path continue without a prewarmed session when prewarm was intentionally skipped.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think this is already handled: Unavailable does not return from RegularTask::run; only Cancelled does. The Unavailable case maps to None, then run_turn() is still called, and run_turn() creates a fresh normal client session via unwrap_or_else(|| sess.services.model_client.new_session()).

@jif-oai

jif-oai commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

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

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9876ae24f1

ℹ️ 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/session_startup_prewarm.rs
@jif-oai jif-oai merged commit 859dbe2 into main Jun 2, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/skip-http-startup-prewarm branch June 2, 2026 15:27
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 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.

1 participant