Skip to content

fix(openai): honor provider thinking profiles - #84902

Closed
NianJiuZst wants to merge 2 commits into
openclaw:mainfrom
NianJiuZst:codex/fix-subagent-thinking-capabilities
Closed

NianJiuZst wants to merge 2 commits into
openclaw:mainfrom
NianJiuZst:codex/fix-subagent-thinking-capabilities

Conversation

@NianJiuZst

@NianJiuZst NianJiuZst commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #84880.

OpenAI/Codex GPT-5 thinking validation was still able to collapse to off-only when the model catalog contained a stale reasoning: false row. That made sessions_spawn(...thinking: "high") reject supported models such as openai/gpt-5.4 and openai-codex/gpt-5.5, even though the OpenAI provider policy advertises non-off reasoning levels.

This patch makes provider thinking profiles explicitly authoritative only when the provider opts in via overridesCatalogReasoning. The shared resolver consults that provider profile before honoring catalog reasoning: false, while preserving off-only catalog behavior for non-authoritative providers and non-reasoning OpenAI rows such as gpt-5-chat-latest / gpt-5.3-chat-latest.

Follow-up review feedback is addressed by including the base gpt-5.3 family in the authoritative OpenAI reasoning classifier while keeping explicit non-reasoning chat-latest rows off-only.

It also updates the public provider thinking profile type, SDK docs, and API baseline so plugin authors have the contract documented.

Verification

  • git diff --check
  • node scripts/run-vitest.mjs src/auto-reply/thinking.test.ts extensions/openai/openai-provider.test.ts --reporter=dot
    • 2 files, 61 tests passed
  • node scripts/run-vitest.mjs src/auto-reply/thinking.test.ts src/agents/openclaw-tools.subagents.sessions-spawn.model.test.ts src/gateway/sessions-patch.test.ts src/auto-reply/reply/directive-handling.model.test.ts --reporter=dot
    • 6 files, 231 tests passed
  • PNPM_CONFIG_PM_ON_FAIL=ignore PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false pnpm plugin-sdk:api:check
  • Local registry-backed runtime policy probe with OpenAI plugin registration and stale catalog metadata:
openai/gpt-5.3 high: supported | levels=off, minimal, low, medium, high
openai/gpt-5.4 high: supported | levels=off, minimal, low, medium, high, xhigh
openai-codex/gpt-5.5 xhigh: supported | levels=off, minimal, low, medium, high, xhigh
openai/gpt-5.3-chat-latest high: rejected | levels=off

Real behavior proof

Behavior addressed: sessions_spawn / /think shared thinking validation no longer lets stale OpenAI/Codex catalog reasoning: false metadata force supported GPT-5 reasoning models to off only.

Real environment tested: local Codex worktree on macOS using the repo Vitest wrapper, SDK API baseline check, and a local registry-backed runtime policy probe that registers the bundled OpenAI plugin and calls the shared thinking resolver with stale catalog metadata.

Exact steps or command run after this patch: node scripts/run-vitest.mjs src/auto-reply/thinking.test.ts src/agents/openclaw-tools.subagents.sessions-spawn.model.test.ts src/gateway/sessions-patch.test.ts src/auto-reply/reply/directive-handling.model.test.ts --reporter=dot, plus the local registry-backed OpenAI thinking policy probe shown above.

Evidence after fix: regression coverage now proves openai/gpt-5.3 and openai/gpt-5.4 accept high, openai-codex/gpt-5.5 accepts high/xhigh, and non-reasoning OpenAI chat-latest rows stay off-only under stale catalog metadata.

Observed result after fix: the acceptance suite passed with 6 files and 231 tests, the focused OpenAI/thinking suite passed with 2 files and 61 tests, the SDK API baseline check passed, and the runtime policy probe printed supported non-off levels for openai/gpt-5.3, openai/gpt-5.4, and openai-codex/gpt-5.5 while rejecting openai/gpt-5.3-chat-latest as off-only.

What was not tested: no live OpenAI/Codex OAuth subagent run was executed. A broad Testbox/Crabbox changed gate was attempted earlier but blocked because the local Crabbox binary failed basic availability/sanity checks.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: openai size: S triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels May 21, 2026
@NianJiuZst
NianJiuZst marked this pull request as ready for review May 21, 2026 09:26
@clawsweeper

clawsweeper Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close: the branch is no longer a good landing candidate because current main already has the canonical provider-profile override contract, and the linked OpenAI/Codex bug was later verified as an incomplete user-config metadata issue rather than stale bundled catalog metadata.

Canonical path: Keep current main's preserveWhenCatalogReasoningFalse contract and handle any remaining OpenAI/Codex failures through config-merge-specific work, not this stale parallel flag.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Keep current main's preserveWhenCatalogReasoningFalse contract and handle any remaining OpenAI/Codex failures through config-merge-specific work, not this stale parallel flag.

Do we have a high-confidence way to reproduce the issue?

No for this PR's claimed bundled OpenAI stale-catalog root cause: current bundled OpenAI GPT-5 rows are reasoning:true, and the linked issue was later verified as incomplete user config metadata stripping. The config-merge sharp edge is source-visible, but this branch does not fix that path.

Is this the best way to solve the issue?

No. The branch was a plausible early mitigation, but current main already has the generic opt-in under a different name and later verification showed the OpenAI-specific override is the wrong layer.

Security review:

Security review cleared: No dependency, workflow, install, credential, permission, or supply-chain changes were found in the PR diff.

AGENTS.md: found and applied where relevant.

What I checked:

  • Linked issue root cause was reclassified: The linked runtime issue was closed after follow-up verification found the OpenAI/Codex bundled catalog was correct and the observed failure came from incomplete user config dropping model metadata, not stale bundled catalog reasoning:false.
  • Overlapping OpenAI override PR was withdrawn: The overlapping OpenAI/Codex stale-catalog override PR was closed unmerged after the same root-cause verification, explicitly saying the proposed flag was not needed for OpenAI. URL: fix(thinking): let authoritative provider profiles override stale catalog reasoning=false #85285. (890ebf8c89f3)
  • Current main has the canonical shared flag: Current main already exposes the provider-profile catalog override as preserveWhenCatalogReasoningFalse, not the branch's overridesCatalogReasoning spelling. (src/plugins/provider-thinking.types.ts:68, cae64ee360a8)
  • Current resolver consumes the canonical flag: Current main already consults provider profiles before the generic off-only fallback and only lets them override catalog reasoning:false when preserveWhenCatalogReasoningFalse is true. (src/auto-reply/thinking.ts:217, cae64ee360a8)
  • OpenAI bundled catalog is not the stale-false source for core GPT-5 models: The current bundled OpenAI catalog marks gpt-5.4 and gpt-5.5 as reasoning:true; gpt-5.3-chat-latest is intentionally non-reasoning. (extensions/openai/openclaw.plugin.json:58, cae64ee360a8)
  • Config merge path matches the verified root cause: Current model merge code preserves only selected implicit fields such as input, reasoning, and token limits for explicit model rows, which matches the later root-cause explanation about incomplete user config stripping other metadata. (src/agents/models-config.merge.ts:107, cae64ee360a8)

Likely related people:

  • neeravmakwana: Authored the source PR behind the merged replacement that introduced preserveWhenCatalogReasoningFalse as the canonical provider-profile opt-in. (role: introduced canonical shared override contract; confidence: high; commits: 77a1b7625d34; files: src/auto-reply/thinking.ts, src/plugins/provider-thinking.types.ts, extensions/google/provider-policy.ts)
  • jalehman: Recent merged work carried the current central thinking/profile files on main, so this person is a useful routing candidate for conflicts with current-main shape. (role: recent area contributor; confidence: medium; commits: ef47dd610c87; files: src/auto-reply/thinking.ts, src/plugins/provider-thinking.types.ts, extensions/openai/thinking-policy.ts)
  • aaajiao: Verified and documented that the linked OpenAI/Codex failure was caused by incomplete user config metadata, then withdrew the overlapping OpenAI override PR. (role: related root-cause verifier; confidence: medium; commits: 890ebf8c89f3; files: extensions/openai/thinking-policy.ts, src/auto-reply/thinking.ts, src/agents/models-config.merge.ts)

Codex review notes: model internal, reasoning high; reviewed against cae64ee360a8.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels May 21, 2026
@clawsweeper

clawsweeper Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🥚 Incubating: this PR egg is tucked into the review nest.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@NianJiuZst

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels May 21, 2026
@giodl73-repo giodl73-repo removed the triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. label May 21, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. label May 21, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels May 21, 2026
@clawsweeper clawsweeper Bot removed the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label May 21, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. P1 High-priority user-facing bug, regression, or broken workflow. labels Jun 15, 2026
@openclaw-clownfish

Copy link
Copy Markdown
Contributor

Thanks @NianJiuZst for carrying this provider thinking-profile work forward. I am closing #84902 because the covered path is already on main through the merged maintainer fix in #74273.

Clownfish is keeping the landed fix as the canonical validation path here: #74273 preserves the configured xhigh/thinking compat behavior on main, and the later review on this PR found the remaining OpenAI/Codex reports should be handled through config-merge-specific follow-up rather than this stale parallel flag. Your investigation and source PR remain part of the record and attribution for this cleanup. If a different reproduction still fails on current main, please reply with that path and we can reopen or split it back out.

@openclaw-clownfish openclaw-clownfish Bot added the clownfish Tracked by Clownfish automation label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clownfish Tracked by Clownfish automation docs Improvements or additions to documentation extensions: openai merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: subagent thinking still rejects non-off on v2026.5.19; previous #84706 was closed against unrelated doctor migration

2 participants