Skip to content

fix(thinking): let authoritative provider profiles override stale catalog reasoning=false - #85285

Closed
aaajiao wants to merge 2 commits into
openclaw:mainfrom
aaajiao:fix/subagent-thinking-overrides-catalog-reasoning
Closed

aaajiao wants to merge 2 commits into
openclaw:mainfrom
aaajiao:fix/subagent-thinking-overrides-catalog-reasoning

Conversation

@aaajiao

@aaajiao aaajiao commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #84880. Subagent spawns and /think validation reject non-off thinking on canonical openai/* and openai-codex/* GPT-5 reasoning models when a stale catalog entry has reasoning: false. resolveThinkingProfile short-circuits to off-only on reasoning === false before consulting the provider plugin profile, so persisted catalogs that lag behind runtime augmentation force Use one of: off. even for models the provider knows support high/xhigh.

The opt-in profile flag (preserveWhenCatalogReasoningFalse) and the resolveThinkingProfile reordering already landed in upstream PR #85300 for the Gemini 3 cron-thinking fix. This PR builds on that infrastructure: it applies the same flag to the OpenAI extension for the GPT-5 reasoning model set and explicitly excludes non-reasoning chat-latest variants. The classifier is suffix-aware: any *-chat-latest model is catalog-authoritative unless it appears in the explicit OPENAI_REASONING_CHAT_LATEST_MODEL_IDS = ["gpt-5.1-chat-latest", "gpt-5.2-chat-latest"] opt-in list (matches bundled catalog reasoning flags in extensions/openai/openclaw.plugin.json).

Real behavior proof

Behavior or issue addressed: sessions_spawn(model="openai-codex/gpt-5.5", thinking="high"|"xhigh") and sessions_spawn(model="openai/gpt-5.4", thinking="high") are rejected with Thinking level "high" is not supported for openai/gpt-5.5. Use one of: off. even though the canonical OpenAI/Codex catalog lists these models as reasoning-capable — see live v2026.5.20 repro logs in issue #84880. With #85300's resolver reordering in place, this PR flips the relevant OpenAI / OpenAI-Codex profiles to authoritative (via preserveWhenCatalogReasoningFalse: true) so they win over stale persisted catalog reasoning: false rows.

Real environment tested: macOS 25.5.0 (Darwin arm64), Node 24.13.0, pnpm 11.1.0; repository checked out at fix/subagent-thinking-overrides-catalog-reasoning head 890ebf8c rebased on origin/main 77a1b762 (which already contains #85300). Runtime probe drives the patched modules end-to-end through the same resolveOpenAIThinkingProfile / resolveOpenAICodexThinkingProfile entry points that the live Gateway calls on every sessions_spawn validation in src/auto-reply/reply/get-reply-run.ts and src/agents/subagent-spawn.ts.

Exact steps or command run after this patch:

git checkout fix/subagent-thinking-overrides-catalog-reasoning
node --import tsx probe-thinking.mjs

The probe is a small driver script that imports the patched extensions/openai/thinking-policy.ts and calls the classifier for each acceptance scenario from #84880 plus the chat-latest regression guards from the ClawSweeper P1 review, then checks the resolved levels[] and preserveWhenCatalogReasoningFalse flag against expected values.

Evidence after fix: Live terminal output from node --import tsx probe-thinking.mjs after applying the patch — copied verbatim, no redaction needed since the probe data is synthetic:

=== Runtime probe: extensions/openai/thinking-policy.ts ===

PASS | [#84880 §1] openai/gpt-5.4 high
       levels=[off, minimal, low, medium, high, xhigh] preserveWhenCatalogReasoningFalse=true (want true)
PASS | [#84880 §2] openai-codex/gpt-5.5 high
       levels=[off, minimal, low, medium, high, xhigh] preserveWhenCatalogReasoningFalse=true (want true)
PASS | [#84880 §3] openai-codex/gpt-5.5 xhigh
       levels=[off, minimal, low, medium, high, xhigh] preserveWhenCatalogReasoningFalse=true (want true)
PASS | openai/gpt-5.5 minimal/low/medium/high/xhigh
       levels=[off, minimal, low, medium, high, xhigh] preserveWhenCatalogReasoningFalse=true (want true)
PASS | [ClawSweeper P1] openai/chat-latest
       levels=[off, minimal, low, medium, high] preserveWhenCatalogReasoningFalse=false (want false)
PASS | [ClawSweeper P1] openai/gpt-5-chat-latest
       levels=[off, minimal, low, medium, high] preserveWhenCatalogReasoningFalse=false (want false)
PASS | [ClawSweeper P1] openai/gpt-5.3-chat-latest
       levels=[off, minimal, low, medium, high] preserveWhenCatalogReasoningFalse=false (want false)
PASS | openai/gpt-5.1-chat-latest (reasoning catalog row)
       levels=[off, minimal, low, medium, high] preserveWhenCatalogReasoningFalse=true (want true)
PASS | openai/gpt-5.2-chat-latest (reasoning catalog row)
       levels=[off, minimal, low, medium, high, xhigh] preserveWhenCatalogReasoningFalse=true (want true)
PASS | openai/o3-mini
       levels=[off, minimal, low, medium, high] preserveWhenCatalogReasoningFalse=true (want true)
PASS | openai/gpt-5-pro
       levels=[off, minimal, low, medium, high] preserveWhenCatalogReasoningFalse=true (want true)
PASS | openai/gpt-4.1
       levels=[off, minimal, low, medium, high] preserveWhenCatalogReasoningFalse=false (want false)

Summary: 12/12 probes PASS.

Observed result after fix: 12/12 probes pass. For the canonical GPT-5 reasoning model refs the patch flips preserveWhenCatalogReasoningFalse to true and surfaces the full [off, minimal, low, medium, high] level set (plus xhigh on the appropriate models), so a stale catalog row marked reasoning: false no longer triggers the off-only short-circuit. For non-reasoning chat-latest variants (chat-latest, gpt-5-chat-latest, gpt-5.3-chat-latest) and legacy non-reasoning models (gpt-4.1) the classifier returns preserveWhenCatalogReasoningFalse=false, so a stale catalog reasoning: false row still wins and the runtime keeps the off-only path documented by the catalog opt-out.

Cross-check against the bundled extensions/openai/openclaw.plugin.json shows the classifier verdict matches the catalog truth for every chat-latest variant in the bundle:

Model Catalog reasoning Classifier verdict Stale-row override
gpt-5-chat-latest false non-authoritative catalog wins (off-only)
gpt-5.1-chat-latest true authoritative overrides stale false
gpt-5.2-chat-latest true authoritative overrides stale false
gpt-5.3-chat-latest false non-authoritative catalog wins (off-only)
chat-latest false non-authoritative catalog wins (off-only)
gpt-5.5, gpt-5.4, gpt-5-codex, o3-mini, … true authoritative overrides stale false
gpt-4.1, gpt-4o, … false non-authoritative catalog wins (off-only)

What was not tested: A redacted sessions_spawn live run against a custom-built Gateway binary in my deployment — the probe exercises the same classifier and resolver entry points the live Gateway calls, but I did not build and install a custom Gateway binary into my OrbStack VM for this PR. Also out of scope: the Ollama Cloud variant raised by @SplyzerRB in #84880 where the subagent ignores explicit thinking: "off" — that path forwards thinking even when the spawn arg is off and is a separate runtime bug that does not share a code path with the OpenAI/Codex catalog-override issue this PR fixes.

What changes

  • extensions/openai/thinking-policy.ts — suffix-aware classifier for chat-latest variants; flags reasoning model refs as authoritative via isOpenAIReasoningModelId, setting preserveWhenCatalogReasoningFalse on the returned profile.
  • extensions/openai/openai-provider.test.ts — coverage for the four [Bug]: subagent thinking still rejects non-off on v2026.5.19; previous #84706 was closed against unrelated doctor migration #84880 acceptance scenarios, the three ClawSweeper P1 chat-latest regression guards (chat-latest, gpt-5-chat-latest, gpt-5.3-chat-latest stay non-authoritative), and the two explicit reasoning chat-latest opt-ins (gpt-5.1-chat-latest, gpt-5.2-chat-latest).
  • src/auto-reply/thinking.test.ts — resolver-level coverage that authoritative provider profiles override stale catalog reasoning: false, while non-authoritative profiles still defer to the catalog opt-out.
  • docs/tools/thinking.md and docs/plugins/sdk-migration.md — document the opt-in flag.

The opt-in flag itself (preserveWhenCatalogReasoningFalse on ProviderThinkingProfile) and the resolveThinkingProfile reordering are already present in main via upstream PR #85300. This PR no longer touches src/plugins/provider-thinking.types.ts or src/auto-reply/thinking.ts runtime — it consumes the existing flag from the OpenAI extension.

Verification

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: openai size: M triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-22 12:09 UTC / May 22, 2026, 8:09 AM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR marks selected OpenAI/OpenAI-Codex thinking profiles authoritative over stale catalog reasoning: false, adds suffix-aware chat-latest guards, focused tests, and docs for the opt-in flag.

Reproducibility: yes. at source level: current main has the shared override flag, but OpenAI/Codex profiles do not set it, so a stale catalog reasoning: false row still resolves to off-only. The linked issue context also supplies live rejection logs for the same validation family.

PR rating
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Summary: Focused patch with adequate current-head terminal proof and no blocking findings; maintainer review should settle the compatibility/canonical-branch choice.

Rank-up moves:

What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (terminal): Sufficient: the PR body includes current-head terminal output from a runtime probe on 890ebf8c showing 12/12 OpenAI/Codex classifier cases pass, with synthetic data and no private details.

Risk before merge

  • The PR intentionally lets selected OpenAI/OpenAI-Codex provider profiles override persisted catalog reasoning: false; a missed or future model classification could enable non-off thinking where catalog metadata meant to opt out.
  • This PR overlaps fix(openai): honor provider thinking profiles #84902, so landing both would create duplicate docs/tests/policy drift around the same provider-thinking contract.

Maintainer options:

  1. Use this branch as canonical (recommended)
    If maintainers accept the suffix-aware OpenAI classifier, land this PR and close or supersede fix(openai): honor provider thinking profiles #84902 to keep one source of truth.
  2. Derive the override list from catalog truth
    If prefix matching feels too loose for provider-routing compatibility, require a follow-up edit that derives or tests every authoritative OpenAI model id directly against bundled catalog metadata.
  3. Defer to the overlapping PR
    If maintainers prefer fix(openai): honor provider thinking profiles #84902, pause or close this PR after preserving its current-head proof and chat-latest regression guard.

Next step before merge
Human maintainer review should decide the OpenAI classifier and canonical branch; there is no narrow automation repair to queue.

Security
Cleared: Cleared: the diff changes provider policy logic, tests, and docs only, with no dependency, workflow, install, credential, or supply-chain surface changes.

Review details

Best possible solution:

Land one canonical OpenAI/Codex provider-policy fix that consumes the already-merged shared flag, preserves catalog opt-outs for non-reasoning chat-latest rows, and closes the linked runtime issue after merge.

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

Yes at source level: current main has the shared override flag, but OpenAI/Codex profiles do not set it, so a stale catalog reasoning: false row still resolves to off-only. The linked issue context also supplies live rejection logs for the same validation family.

Is this the best way to solve the issue?

Yes: the PR uses the provider-owned flag that already landed on main, keeps non-reasoning chat-latest catalog opt-outs intact, and adds focused coverage. The remaining choice is maintainer canonicalization versus the overlapping open branch, not a code defect in this patch.

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Sufficient: the PR body includes current-head terminal output from a runtime probe on 890ebf8c showing 12/12 OpenAI/Codex classifier cases pass, with synthetic data and no private details.
  • add rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🐚 platinum hermit, patch quality is 🦞 diamond lobster, and Focused patch with adequate current-head terminal proof and no blocking findings; maintainer review should settle the compatibility/canonical-branch choice.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Sufficient: the PR body includes current-head terminal output from a runtime probe on 890ebf8c showing 12/12 OpenAI/Codex classifier cases pass, with synthetic data and no private details.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The linked bug breaks real subagent and /think workflows for OpenAI/Codex GPT-5 reasoning models.
  • merge-risk: 🚨 compatibility: The branch changes how stale persisted catalog reasoning: false rows are interpreted for existing OpenAI/Codex model metadata.
  • merge-risk: 🚨 auth-provider: The affected behavior is provider/model capability routing for OpenAI and OpenAI-Codex thinking validation.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🐚 platinum hermit, patch quality is 🦞 diamond lobster, and Focused patch with adequate current-head terminal proof and no blocking findings; maintainer review should settle the compatibility/canonical-branch choice.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Sufficient: the PR body includes current-head terminal output from a runtime probe on 890ebf8c showing 12/12 OpenAI/Codex classifier cases pass, with synthetic data and no private details.
  • proof: sufficient: Contributor real behavior proof is sufficient. Sufficient: the PR body includes current-head terminal output from a runtime probe on 890ebf8c showing 12/12 OpenAI/Codex classifier cases pass, with synthetic data and no private details.

Acceptance criteria:

  • pnpm check:architecture
  • pnpm tsgo:all
  • pnpm vitest run src/auto-reply/thinking.test.ts extensions/openai/openai-provider.test.ts
  • Optional: redacted sessions_spawn proof for openai/gpt-5.4 high and openai-codex/gpt-5.5 xhigh after merge candidate build

What I checked:

  • Current main resolver contract: Current main consults the provider profile and only lets it bypass catalog reasoning: false when pluginProfile.preserveWhenCatalogReasoningFalse === true; otherwise it falls through to the off-only profile. (src/auto-reply/thinking.ts:169, 3551e9843392)
  • Current main OpenAI gap: Current main's OpenAI thinking profile returns only the level list and never sets preserveWhenCatalogReasoningFalse, so stale OpenAI/Codex catalog rows with reasoning: false still force off-only. (extensions/openai/thinking-policy.ts:35, 3551e9843392)
  • PR provider-policy change: The PR head adds a suffix-aware OpenAI classifier, explicitly opts in gpt-5.1-chat-latest and gpt-5.2-chat-latest, excludes other chat-latest rows, and sets preserveWhenCatalogReasoningFalse on reasoning profiles. (extensions/openai/thinking-policy.ts:35, 890ebf8c89f3)
  • Bundled catalog alignment: The bundled catalog marks gpt-5-chat-latest and gpt-5.3-chat-latest as reasoning: false, while gpt-5.1-chat-latest, gpt-5.2-chat-latest, gpt-5.4, gpt-5.5, and the Codex GPT-5 rows are reasoning-capable. (extensions/openai/openclaw.plugin.json:208, 3551e9843392)
  • Resolver regression coverage: The PR head adds resolver-level tests proving stale catalog reasoning: false no longer blocks OpenAI/Codex GPT-5 reasoning models, while non-authoritative and non-reasoning chat-latest entries remain off-only. (src/auto-reply/thinking.test.ts:163, 890ebf8c89f3)
  • Provider regression coverage: The PR head adds OpenAI provider tests for reasoning models, non-reasoning chat-latest rows, legacy non-reasoning models, and explicit reasoning chat-latest opt-ins. (extensions/openai/openai-provider.test.ts:438, 890ebf8c89f3)

Likely related people:

  • clawsweeper[bot]: Merged commit 77a1b76 added preserveWhenCatalogReasoningFalse and changed the shared resolver path that this PR consumes. (role: recent shared thinking-contract contributor; confidence: high; commits: 77a1b7625d34; files: src/auto-reply/thinking.ts, src/plugins/provider-thinking.types.ts, extensions/google/provider-policy.ts)
  • github-actions[bot]: The shallow current-main history attributes the OpenAI provider and thinking-policy files to commit b59ab5b, so this is a weak routing signal rather than a human owner signal. (role: current OpenAI provider snapshot author in available history; confidence: low; commits: b59ab5b1f008; files: extensions/openai/thinking-policy.ts, extensions/openai/openai-provider.ts, extensions/openai/openai-codex-provider.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 3551e9843392.

@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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 🥚 common Sunspot Test Hopper

Hatched PR egg: 🥚 common Sunspot Test Hopper

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.

Rarity: 🥚 common.
Trait: guards the happy path.
Image traits: location proof lagoon; accessory commit compass; palette seafoam, black, and opal; mood patient; pose pointing at a small proof artifact; shell polished stone shell; lighting tiny status-light glow; background soft code-shaped tiles.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Sunspot Test Hopper in ClawSweeper.

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.

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @clawsweeper — addressed both the P1 classifier bug and the runtime-proof ask. Pushed ccfe389d on top of bdfb40c7.

P1 fix: suffix-aware chat-latest classifier

The previous revision matched gpt-5.3-chat-latest via the gpt-5.3 reasoning prefix — exactly the regression you called out. Restructured the classifier to be suffix-aware:

  • Any *-chat-latest model is catalog-authoritative (no override) unless explicitly opted in.
  • OPENAI_REASONING_CHAT_LATEST_MODEL_IDS = ["gpt-5.1-chat-latest", "gpt-5.2-chat-latest"] is the opt-in list (matches the bundled catalog reasoning flags).
  • Bundled chat-latest, gpt-5-chat-latest, gpt-5.3-chat-latest all stay off-only on stale reasoning: false.

I cross-checked against the bundled catalog (extensions/openai/openclaw.plugin.json):

Model Catalog reasoning Classifier verdict (new)
gpt-5-chat-latest false NOT authoritative ✓
gpt-5.1-chat-latest true authoritative ✓
gpt-5.2-chat-latest true authoritative ✓
gpt-5.3-chat-latest false NOT authoritative ✓ (was buggy before)
chat-latest false NOT authoritative ✓
gpt-5.5, gpt-5.4, gpt-5-codex, o3-mini, etc. true authoritative ✓
gpt-4.1, gpt-4o, etc. false NOT authoritative ✓

New regression-guard tests added in both src/auto-reply/thinking.test.ts and extensions/openai/openai-provider.test.ts.

Runtime probe output (the proof ask)

I ran the patched OpenAI thinking-policy module directly via a Node probe (node --import tsx) with the bundled resolveOpenAIThinkingProfile / resolveOpenAICodexThinkingProfile:

=== Runtime probe: extensions/openai/thinking-policy.ts ===

PASS | [#84880 §1] openai/gpt-5.4 high
       levels=[off, minimal, low, medium, high, xhigh] overridesCatalogReasoning=true (want true)
PASS | [#84880 §2] openai-codex/gpt-5.5 high
       levels=[off, minimal, low, medium, high, xhigh] overridesCatalogReasoning=true (want true)
PASS | [#84880 §3] openai-codex/gpt-5.5 xhigh
       levels=[off, minimal, low, medium, high, xhigh] overridesCatalogReasoning=true (want true)
PASS | openai/gpt-5.5 minimal/low/medium/high/xhigh
       levels=[off, minimal, low, medium, high, xhigh] overridesCatalogReasoning=true (want true)
PASS | [ClawSweeper P1] openai/chat-latest
       levels=[off, minimal, low, medium, high] overridesCatalogReasoning=false (want false)
PASS | [ClawSweeper P1] openai/gpt-5-chat-latest
       levels=[off, minimal, low, medium, high] overridesCatalogReasoning=false (want false)
PASS | [ClawSweeper P1] openai/gpt-5.3-chat-latest
       levels=[off, minimal, low, medium, high] overridesCatalogReasoning=false (want false)
PASS | openai/gpt-5.1-chat-latest (reasoning catalog row)
       levels=[off, minimal, low, medium, high] overridesCatalogReasoning=true (want true)
PASS | openai/gpt-5.2-chat-latest (reasoning catalog row)
       levels=[off, minimal, low, medium, high, xhigh] overridesCatalogReasoning=true (want true)
PASS | openai/o3-mini
       levels=[off, minimal, low, medium, high] overridesCatalogReasoning=true (want true)
PASS | openai/gpt-5-pro
       levels=[off, minimal, low, medium, high] overridesCatalogReasoning=true (want true)
PASS | openai/gpt-4.1
       levels=[off, minimal, low, medium, high] overridesCatalogReasoning=false (want false)

Summary: all 12 probes PASS.

End-to-end resolver behavior (the actual isThinkingLevelSupported / formatThinkingLevels path that get-reply-run.ts:794 and subagent-spawn.ts:1172 call) is exercised in the vitest suite — that is the literal runtime path, not a fake. Highlights from pnpm vitest run src/auto-reply/thinking.test.ts extensions/openai/openai-provider.test.ts --reporter=verbose:

 ✓ thinking.test.ts > listThinkingLevels > lets authoritative provider profiles override stale catalog reasoning=false
 ✓ thinking.test.ts > listThinkingLevels > keeps non-authoritative provider profiles behind catalog reasoning=false
 ✓ thinking.test.ts > listThinkingLevels > treats catalog reasoning=false as an explicit thinking opt-out
 ✓ openai-provider.test.ts > buildOpenAIProvider > flags reasoning model thinking profiles as authoritative over stale catalog reasoning=false

 Test Files  2 passed (2)
      Tests  62 passed (62)

A redacted sessions_spawn live run would require building a custom Gateway binary and replaying against my deployment — happy to do that if maintainers want it, but the runtime probe + vitest suite covers the same code paths (resolveThinkingProfile → isThinkingLevelSupported is the only validation gate between spawn args and the rejection message reported in #84880).

SDK contract decision

Re: the maintainer ask on ProviderThinkingProfile.overridesCatalogReasoning — happy to defer to whatever shape works for the SDK. Two alternatives if the public field feels too load-bearing:

  1. Internal-only: drop the field from ProviderThinkingProfile and instead expose a separate ProviderThinkingPolicy.isAuthoritativeForReasoning?(ctx) hook that providers can opt into without touching the profile shape.
  2. Catalog-side: bake the override into augmentModelCatalog results so persisted stale rows get auto-refreshed during catalog hydration in model-selection.ts — but that's a bigger change and trickier to reason about because catalog hydration only runs when selectedCatalogEntry.reasoning === undefined.

The current shape lines up with PR #84902's direction, so if there's agreement on the contract there I'll converge on it here.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 22, 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:

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

CI run https://github.com/openclaw/openclaw/actions/runs/26278881389 failed check:architecture — but the failure is a pre-existing import cycle on main, not from this PR.

Madge import cycle check: 1 cycle(s).

# cycle 1
  src/plugins/current-plugin-metadata-snapshot.ts
  -> src/plugins/plugin-metadata-snapshot.types.ts
  -> src/plugins/plugin-registry-snapshot.ts

None of those three files are touched by this PR. The cycle was introduced by upstream commit bf64de91 fix(plugins): keep derived metadata snapshots fresh, which added a import type { PluginRegistrySnapshotSource } from "./plugin-registry-snapshot.js" into plugin-metadata-snapshot.types.ts. The existing value flow in plugin-registry-snapshot.ts (line 6: import { getCurrentPluginMetadataSnapshot } from "./current-plugin-metadata-snapshot.js") closes the loop. I verified this by reverting my PR's diff and re-running pnpm check:madge-import-cycles — the cycle still reproduces on plain origin/main.

Pushed 69986fc5 to unblock CI:

  • Extract PluginRegistrySnapshotSource — a plain "provided" | "persisted" | "derived" string literal — to a new leaf module src/plugins/plugin-registry-snapshot.types.ts.
  • plugin-registry-snapshot.ts re-exports it under the same name so no downstream import path changes.
  • plugin-metadata-snapshot.types.ts now imports from the leaf module, breaking the cycle.

Verification on the rebased branch:

$ pnpm check:architecture
Import cycle check: 0 runtime value cycle(s).
Madge import cycle check: 0 cycle(s).
deprecated API usage guard passed
deprecated JSDoc guard passed

$ pnpm vitest run src/plugins/current-plugin-metadata-snapshot.test.ts \
    src/plugins/plugin-metadata-snapshot.memo.test.ts \
    src/auto-reply/thinking.test.ts \
    extensions/openai/openai-provider.test.ts
 Test Files  4 passed (4)
      Tests  97 passed (97)

Happy to split 69986fc5 into a separate PR if maintainers prefer — it's a self-contained 3-line type extraction unrelated to the thinking fix. Just kept it in this PR to keep CI green for review.

Pinging @vincentkoc since the cycle was introduced in bf64de91 (no blame implied — it's a pure-type import that runtime is fine with, just trips madge).

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 22, 2026
@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

CI summary on 69986fc5:

Restructured the ## Real behavior proof section into the schema the policy expects (Behavior or issue addressed, Real environment tested, Exact steps or command run after this patch, Evidence after fix, Observed result after fix, What was not tested) — required by scripts/github/real-behavior-proof-policy.mjs for external PRs. The body now contains the live terminal output from node --import tsx probe-thinking.mjs and the bundled-catalog cross-reference table.

Ready for human review. @clawsweeper re-review triggered by this PR body update; if it doesn't pick up automatically, please re-trigger.

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 22, 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. and removed 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. labels May 22, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 22, 2026
@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main (e2f82d4d) to resolve the conflicts. Upstream just landed 4ee8a2ac fix: break plugin metadata snapshot cycle (cc @steipete) — same root issue my 69986fc5 was addressing, just with a different file layout. Dropped my cycle-fix commit in favor of upstream's; this PR is back to 2 commits scoped to the thinking fix.

c699b41c fix(thinking): let authoritative provider profiles override stale catalog reasoning=false
83d72f62 fix(thinking): suffix-aware chat-latest classifier in OpenAI reasoning policy

Verified post-rebase on 83d72f62:

  • pnpm check:architecture — clean (no cycles)
  • pnpm plugin-sdk:api:check — baseline matches
  • pnpm tsgo:all — clean
  • pnpm vitest run src/auto-reply/thinking.test.ts extensions/openai/openai-provider.test.ts — 62/62 pass

PR is back to mergeable: MERGEABLE. New CI run kicking off now.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 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.

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Post-rebase CI: ✅ 72 pass / 28 skipping / 0 fail. mergeStateStatus: CLEAN, mergeable: MERGEABLE. Ready for human review.

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper hatch

@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Re-review progress:

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper hatch

@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

aaajiao added 2 commits May 22, 2026 13:31
…alog reasoning=false

Subagent spawns and `/think` validation reject non-off thinking on
canonical `openai/*` and `openai-codex/*` GPT-5 reasoning models when
a stale catalog entry has `reasoning: false` (issue #84880).
`resolveThinkingProfile` was short-circuiting to off-only on
`reasoning === false` before consulting the provider plugin profile,
so persisted catalogs that lagged behind the runtime augmentation
forced "Use one of: off." even for models the provider knows support
high/xhigh.

Introduce an `overridesCatalogReasoning?: boolean` flag on
`ProviderThinkingProfile`. When a provider plugin returns a profile
with this flag set, the resolver treats the plugin as the canonical
source for that model and uses its level list ahead of the catalog
opt-out. Providers opt in per model, so non-reasoning models (e.g.
`openai/chat-latest`) still honor catalog `reasoning: false`.

The OpenAI extension opts in for GPT-5 reasoning model refs
(`gpt-5`, `gpt-5.5`, `gpt-5.4`, `gpt-5.3`, `gpt-5.2`, codex variants,
mini/nano/pro, o1/o3/o4 series); chat-latest variants are explicitly
excluded so their off-only behavior is preserved. The shared
`buildOpenAIThinkingProfile` carries the flag, so both `openai` and
`openai-codex` providers benefit.

Tests cover the acceptance criteria from the issue:
- `sessions_spawn(model="openai/gpt-5.4", thinking="high")` accepted
- `sessions_spawn(model="openai-codex/gpt-5.5", thinking="high")` accepted
- `sessions_spawn(model="openai-codex/gpt-5.5", thinking="xhigh")` accepted
- Non-reasoning OpenAI models (chat-latest) still off-only on stale
  catalog `reasoning: false`
- Non-authoritative provider profiles still defer to catalog opt-out
…g policy

ClawSweeper review on PR #85285 flagged that the prior revision matched
`gpt-5.3-chat-latest` via the `gpt-5.3` reasoning prefix, which would
have flipped a bundled catalog `reasoning: false` row to the
authoritative override path. The bundled catalog has two non-reasoning
chat-latest variants (`gpt-5-chat-latest`, `gpt-5.3-chat-latest`) and
two reasoning chat-latest variants (`gpt-5.1-chat-latest`,
`gpt-5.2-chat-latest`), so the rule cannot be "all chat-latest is
non-reasoning."

Restructure the classifier to be suffix-aware: any `*-chat-latest`
model is treated as catalog-authoritative (no override) unless it
appears in the explicit `OPENAI_REASONING_CHAT_LATEST_MODEL_IDS`
opt-in list. This preserves the catalog opt-out for current and
future non-reasoning chat-latest variants while still letting the
two genuine reasoning chat-latest models override stale rows.

Tests now cover:
- gpt-5.3-chat-latest stays off-only on stale catalog reasoning=false
- gpt-5-chat-latest, chat-latest still off-only (preserved behavior)
- gpt-5.1-chat-latest, gpt-5.2-chat-latest get overridesCatalogReasoning=true
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 22, 2026
@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (now at 77a1b762) to resolve conflicts with upstream PR #85300 (Gemini 3 cron thinking).

#85300 introduced the same opt-in profile flag I had added — under the name preserveWhenCatalogReasoningFalse instead of overridesCatalogReasoning — and reordered resolveThinkingProfile the same way. To avoid duplicating semantics, this branch now:

Two-commit branch:

  • 42590854 — apply the (now upstream-named) flag in the OpenAI thinking-policy resolver and tests.
  • 890ebf8c — suffix-aware chat-latest classifier (preserves the ClawSweeper P1 fix).

Local verification on rebased head: pnpm check:architecture clean (0 cycles), pnpm tsgo:all clean, pnpm vitest run src/auto-reply/thinking.test.ts extensions/openai/openai-provider.test.ts → 63/63 pass.

mergeable: MERGEABLE post-push; waiting on CI.

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Post-rebase CI: ✅ 73 pass / 23 skipping / 0 fail (96 total). mergeStateStatus: CLEAN, mergeable: MERGEABLE. Ready for human review.

@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. and removed 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. labels May 22, 2026
@clawsweeper

clawsweeper Bot commented May 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper PR egg hatch requested.

I queued a comment sync for this PR. If the egg is hatchable, ClawSweeper will generate the image once and update the existing review comment.
Action: PR egg hatch queued (workflow sweep.yml, event repository_dispatch).
The ASCII egg stays as the fallback.

@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Proof block rewritten to match the rebased patch:

Verification: pnpm check:architecture clean / pnpm tsgo:all clean / 63/63 vitest pass / 12/12 runtime probes pass.

@clawsweeper

clawsweeper Bot commented May 22, 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. 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. labels May 22, 2026
@aaajiao

aaajiao commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper hatch

@clawsweeper

clawsweeper Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@aaajiao

aaajiao commented May 23, 2026

Copy link
Copy Markdown
Contributor Author

Withdrawing — the actual root cause of #84880 was config-side, not bundled catalog. Closing.

Full analysis in #84880 follow-up comment. Short version:

My user's ~/.openclaw/openclaw.json had incomplete model entries under models.providers.{openai,openai-codex}.models[] that lacked compat, cost, model-level api. mergeProviderModels only propagates input and reasoning from bundled when missing in explicit; all other bundled metadata gets dropped. Removing the incomplete user-config entries fixed the bug — no resolver-level change needed.

The bundled OpenAI plugin catalog in extensions/openai/openclaw.plugin.json correctly has reasoning: true and full compat metadata for these models. So the preserveWhenCatalogReasoningFalse defensive flag this PR proposed adding to the OpenAI extension wouldn't trigger in practice — dead code.

The flag pattern itself is still valid (upstream #85300 introduced it for a real Gemini 3 catalog gap), just not needed for OpenAI today.

Thanks @clawsweeper and reviewers — sorry for the cycle.

@aaajiao

aaajiao commented May 23, 2026

Copy link
Copy Markdown
Contributor Author

Withdrawing — see comment above. Bundled OpenAI catalog is correct; the bug was triggered by user-config strip via mergeProviderModels, fixed by removing incomplete user-config entries (not by this PR's flag).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

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

1 participant