Skip to content

[codex] Update reasoning effort - #29899

Merged
shijie-oai merged 1 commit into
mainfrom
shijie/ultra-reasoning-effort-v2
Jun 25, 2026
Merged

[codex] Update reasoning effort#29899
shijie-oai merged 1 commit into
mainfrom
shijie/ultra-reasoning-effort-v2

Conversation

@shijie-oai

@shijie-oai shijie-oai commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Why

Parsing reasoning effort to enable multi agent mode conditionally.

@shijie-oai
shijie-oai marked this pull request as ready for review June 24, 2026 19:39
@shijie-oai
shijie-oai requested a review from a team as a code owner June 24, 2026 19:39
@shijie-oai
shijie-oai marked this pull request as draft June 24, 2026 19:40

@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: 9aacfca13c

ℹ️ 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 +667 to +670
if let Err(err) = super::multi_agents::validate_ultra_reasoning_effort(
turn_context.effective_reasoning_effort(),
&turn_context.config.features,
) {

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 Validate Ultra defaults before committing settings

When a turn switches to a model whose catalog default effort is ultra while features.multi_agent_mode is disabled, SessionConfiguration::apply() does not reject it because the explicit effort is still None; this later effective-effort check returns BadRequest only after state.session_configuration = next.clone() has already committed the model/settings. The rejected update then sticks, so subsequent turns keep selecting the same invalid Ultra default and fail until the user manually changes settings again. Validate the effective effort before storing next, or roll back the state on this error.

Useful? React with 👍 / 👎.

Comment thread codex-rs/app-server/README.md Outdated
Comment thread codex-rs/core/src/session/turn_context.rs
@shijie-oai
shijie-oai force-pushed the shijie/ultra-reasoning-effort-v2 branch from 9aacfca to 51d08c2 Compare June 24, 2026 20:40
@shijie-oai
shijie-oai marked this pull request as ready for review June 24, 2026 20:40

@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: 51d08c2e02

ℹ️ 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/tools/handlers/multi_agents_v2/spawn.rs Outdated
Comment on lines +668 to +671
if let Err(err) = super::multi_agents::validate_ultra_reasoning_effort(
turn_context.effective_reasoning_effort(),
&turn_context.config.features,
) {

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 Validate Ultra before startup prewarm

When a session starts on a model whose explicit or catalog-default effort is ultra while features.multi_agent_mode is disabled and Responses WebSocket prewarm is enabled, the startup prewarm path builds a turn with new_startup_prewarm_turn_with_sub_id() and never reaches this validation before calling prewarm_websocket, so the backend still receives a reasoning.effort: "max" prewarm request even though the first real turn is later rejected. Apply the same Ultra gate before scheduling/issuing startup prewarm, or skip prewarm for invalid effective efforts.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we can prewarm but we should reject if ultra is not support on turn.


fn reasoning_effort_for_request(effort: ReasoningEffortConfig) -> ReasoningEffortConfig {
match effort {
ReasoningEffortConfig::Ultra => ReasoningEffortConfig::Custom("max".to_string()),

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 custom providers' ultra effort

When a non-OpenAI/custom provider or cached model catalog advertises the literal effort string ultra (or a user has model_reasoning_effort = "ultra" for that provider), deserialization now turns it into ReasoningEffort::Ultra and this helper rewrites it to max for every Responses/compact/memory request without checking the provider. Before this change, ultra was just a custom effort and was forwarded unchanged, so these integrations no longer receive the effort value they advertised; gate the aliasing to the Codex/OpenAI models that require max, or preserve the original wire value for custom providers.

AGENTS.md reference: AGENTS.md:L102-L110

Useful? React with 👍 / 👎.

@shijie-oai
shijie-oai force-pushed the shijie/ultra-reasoning-effort-v2 branch 3 times, most recently from 7fbc663 to 5605533 Compare June 24, 2026 22:07
/// Set the initial multi-agent mode for this thread. `none` leaves the
/// multi-agent tools available without injecting mode instructions.
/// Omitted defaults to `explicitRequestOnly`.
#[deprecated(note = "use Ultra reasoning effort for proactive multi-agent behavior")]

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.

i think these rust deprecated tags are causing issues in ci. do we want to deprecate on the rust level or just on the app-server API spec level

@shijie-oai
shijie-oai force-pushed the shijie/ultra-reasoning-effort-v2 branch 2 times, most recently from 646944e to 6f61655 Compare June 24, 2026 23:39
}

#[tokio::test]
async fn model_reasoning_selection_popup_ultra_snapshot() {

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.

this is just to test the reasoning level shows up? is the logic different enough from the other reasoning levels to warrant the test, or do all reasoning levels have this test?

@shijie-oai shijie-oai Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not much - the only diff is that we also gate this by feature.mutli_agent_mode. I can drop this.

@shijie-oai
shijie-oai force-pushed the shijie/ultra-reasoning-effort-v2 branch 2 times, most recently from b6ff83b to b5816e9 Compare June 25, 2026 01:57
@shijie-oai
shijie-oai requested a review from sayan-oai June 25, 2026 02:22
active_permission_profile,
reasoning_effort,
multi_agent_mode,
multi_agent_mode: MultiAgentMode::ExplicitRequestOnly,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

basically all responses that contain muti_agent_mode will return explicit request only. This is not concerning because we are strongly enforcing ultra reasoning effort as the only way to go into mutl_agent_mode.

Comment on lines +44 to +47
let multi_agent_mode = match turn_context.effective_reasoning_effort() {
Some(ReasoningEffort::Ultra) => MultiAgentMode::Proactive,
_ => MultiAgentMode::ExplicitRequestOnly,
};

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.

do we need to first check that the model supports Ultra? or is that guaranteed by this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is granular enough at this point

Comment thread codex-rs/core/src/client.rs Outdated

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.

i think this forwards the effort unchanged, so Ultra stays Ultra? in the normal responses request path we have some logic that maps Ultra -> Max. should we reuse that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good point - it should be mapped to max cause ultra actually is not supported by the backend.

Comment thread codex-rs/tui/src/app_server_session.rs Outdated
Comment on lines +1245 to +1248
preset
.supported_reasoning_efforts
.sort_by_key(|preset| preset.effort == ReasoningEffort::Ultra);
preset

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.

why are we reordering the reasoning effort order from the model/list result? is this leftover from when we were filtering Ultra out by the feature flag?

the app-server guidance says we shouldnt reorder this, and i think we order them correctly from the server anyways

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep from before - addressing it now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed

@shijie-oai
shijie-oai force-pushed the shijie/ultra-reasoning-effort-v2 branch from b5816e9 to 7988f0f Compare June 25, 2026 02:49
@shijie-oai
shijie-oai force-pushed the shijie/ultra-reasoning-effort-v2 branch from 7988f0f to 1b7ec0f Compare June 25, 2026 02:54

@sayan-oai sayan-oai 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.

thanks for cleaning this all up!

final nit-- can you update pr desc to describe final state?

@shijie-oai
shijie-oai merged commit df1199f into main Jun 25, 2026
31 checks passed
@shijie-oai
shijie-oai deleted the shijie/ultra-reasoning-effort-v2 branch June 25, 2026 03:13
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 25, 2026
@shijie-oai shijie-oai changed the title [codex] Add Ultra reasoning effort [codex] Update reasoning effort Jun 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants