Skip to content

Background review agents ignore reasoning_config and fall back to medium #18871

@Asunfly

Description

@Asunfly

Summary

Background memory/skill review agents can ignore the active agent.reasoning_effort configuration because _spawn_background_review() creates a fresh AIAgent without passing reasoning_config.

On Codex Responses routes, that fresh review agent falls back to the transport default:

{
  "reasoning": {
    "effort": "medium",
    "summary": "auto"
  }
}

This can produce unexpected medium-effort upstream requests even when the user's main session is configured for a higher effort such as xhigh.

Why this matters

Recent background-review fixes already focus on runtime inheritance:

reasoning_config appears to be another runtime field that should be inherited by background review agents.

Current behavior

A main session configured like this:

agent:
  reasoning_effort: xhigh

can still spawn a background memory/skill review run whose model request uses the Codex transport's default medium reasoning effort, because the review agent is constructed without reasoning_config.

The relevant path is _spawn_background_review() in run_agent.py, where the review agent is instantiated with fields such as:

review_agent = AIAgent(
    model=self.model,
    max_iterations=8,
    quiet_mode=True,
    platform=self.platform,
    provider=self.provider,
    api_mode=...,
    base_url=...,
    api_key=...,
    parent_session_id=self.session_id,
    enabled_toolsets=["memory", "skills"],
)

but no reasoning_config=....

Expected behavior

Background memory/skill review should use the same active reasoning configuration as the parent session unless a review-specific override is configured.

For example, if the parent session has:

agent:
  reasoning_effort: xhigh

the spawned review agent should receive the parsed equivalent of:

reasoning_config={"enabled": True, "effort": "xhigh"}

and should not fall back to a transport-local medium default.

Suggested minimal fix

Pass the parent reasoning config when creating the background review agent:

review_agent = AIAgent(
    ...,
    reasoning_config=self.reasoning_config,
)

It may also be worth preserving related runtime fields in the same clone path, for example service_tier and request_overrides, if those are expected to apply consistently across internal agent forks.

Suggested broader config improvement

Please consider adding a true global reasoning default in config.yaml, for example:

reasoning:
  default_effort: xhigh

or:

runtime:
  reasoning_effort: xhigh

That value could be used by every AIAgent construction path when an explicit reasoning_config is not provided. Subsystem-specific settings could still override it, e.g.:

agent:
  reasoning_effort: xhigh

delegation:
  reasoning_effort: high

auxiliary:
  title_generation:
    extra_body:
      reasoning:
        effort: low

memory:
  review:
    reasoning_effort: low

skills:
  review:
    reasoning_effort: low

This would reduce the risk of new internal agent forks or auxiliary paths silently returning to a transport-local medium default.

Acceptance criteria

  • Background memory/skill review agents inherit the parent reasoning_config by default.
  • A session with agent.reasoning_effort: xhigh does not generate medium-effort background review requests through Codex Responses unless explicitly configured that way.
  • Tests cover _spawn_background_review() cloning reasoning_config into the review AIAgent.
  • Optional: a global reasoning default is available and used by bare AIAgent creation paths when no explicit reasoning config is supplied.

Privacy note

This report intentionally omits local paths, session identifiers, timestamps, upstream request dump IDs, credentials, provider keys, and user-specific configuration values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt buildertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions