Skip to content

feat(effort): Add model-level reasoning effort routing - #1780

Merged
kevincodex1 merged 9 commits into
Twigpine:mainfrom
jatmn:effort
Jun 25, 2026
Merged

kevincodex1 merged 9 commits into
Twigpine:mainfrom
jatmn:effort

Conversation

@jatmn

@jatmn jatmn commented Jun 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds model-level reasoning control metadata so /effort can be enabled per model instead of being gated only by provider-wide assumptions.
  • Centralizes reasoning/effort resolution in src/utils/effort.ts, including backward-compatible compatibility handling for existing DeepSeek and Z.AI OpenAI-shim behavior.
  • Fixes OpenAI-compatible Responses API reasoning shape so /responses requests send nested reasoning: { effort, summary: 'auto' } while Chat Completions keeps reasoning_effort.
  • Documents the new reasoning metadata rules and provider/gateway follow-up process without changing any provider catalogs in this PR.
  • Stabilizes the effort tests by injecting resolver context instead of mocking process-global provider/integration modules.

Fixes #1778.
Closes #1638.

Impact

  • user-facing impact: /effort remains backward compatible for existing supported models, and the resolver can now support gateway/provider models once their per-model reasoning metadata is added in follow-up PRs.
  • developer/maintainer impact: provider and gateway catalogs get a single documented metadata surface for reasoning support; legacy DeepSeek/Z.AI compatibility behavior is routed through the same effort planner so it can be removed after catalogs are audited and updated.

Related issues and PR coordination

Testing

  • bun install
  • bun run build
  • bun run smoke
  • bun run check
  • bun run typecheck
  • bun run typecheck:type-tests
  • bun run test:provider
  • bun run test:provider-recommendation
  • bun run integrations:check
  • python -m pytest -q python/tests
  • bun run security:pr-scan -- --base upstream/main --head HEAD
  • focused tests: bun test --feature=UNATTENDED_RETRY src/utils/effort.codex.test.ts
  • focused tests: bun test --feature=UNATTENDED_RETRY src/services/api/client.test.ts
  • focused tests: bun test --feature=UNATTENDED_RETRY src/services/api/openaiShim.test.ts
  • focused tests: bun test src/utils/effort.codex.test.ts

Review Risk Note

  • Risk surface: provider routing and OpenAI-shim outbound request shaping. The review findings around provider override route isolation and Z.AI-compatible metadata effort serialization were blocking until fixed because they could silently send the wrong request shape or inherit unrelated route config.
  • Resolution: fixed in follow-up commits f4aef70 and 2fb5ba6, with focused regression coverage for route preference isolation, compat metadata planning, and high-only Z.AI metadata effort serialization.

Notes

  • provider/model path tested: OpenAI/Codex GPT effort routing, OpenAI-compatible /responses reasoning payloads, DeepSeek-compatible shim planning, Z.AI/GLM shim planning, and descriptor-backed gateway routing behavior in tests.
  • screenshots attached (if UI changed): N/A, no UI or terminal presentation changes.
  • follow-up work or known limitations: provider and gateway catalogs are intentionally not updated in this PR. Follow-up PRs should audit each provider/gateway/model and add reasoning metadata only where the upstream API behavior is verified.

Summary by CodeRabbit

  • New Features

    • Added documentation and examples for configuring reasoning controls and /effort metadata across mixed catalogs, vendors, and gateways.
    • Exposed reasoning control metadata at the model/catalog level and improved routing behavior with optional base-URL route preference.
  • Bug Fixes

    • Updated OpenAI-compatible request shaping to serialize reasoning effort only in supported formats (including correct /responses payload structure) and omit incompatible legacy fields.
  • Tests

    • Expanded coverage for effort clamping, reasoning wire-format handling, provider overrides, and base-URL route preference behavior.

jatmn added 5 commits June 24, 2026 12:48
Introduce per-model reasoning control metadata on catalog entries and model descriptors so /effort support can be expanded without provider-wide inference.

Resolve /effort through explicit model metadata first, preserve legacy allowlist behavior, and treat supportsReasoning-only entries as capability metadata that does not mutate requests.

Guard OpenAI shim effort serialization with the model-level wire support check and add focused tests for capability-only, explicit metadata, opt-out, and toggle-mode cases.

Document the reasoning metadata contract and provider follow-up workflow.
Centralize OpenAI shim reasoning request planning so DeepSeek-compatible and Z.AI-compatible controls flow through the effort resolver instead of provider-specific shim helpers.

Add compatibility metadata handling for DeepSeek and Z.AI routes while keeping supportsReasoning-only catalog entries non-controllable until exact wire formats are verified.

Respect route removeBodyFields after compatibility serialization and make provider override support checks use the resolved override route/base URL instead of ambient provider metadata.

Document temporary compatibility rules and add regression coverage for Atlas DeepSeek, Z.AI levels, Groq stripping, providerOverride OpenAI effort, providerOverride Groq stripping, and non-generic metadata opt-out.

Verified: bun test --feature=UNATTENDED_RETRY src/utils/effort.codex.test.ts; bun test --feature=UNATTENDED_RETRY src/services/api/client.test.ts; bun test --feature=UNATTENDED_RETRY src/services/api/openaiShim.test.ts; node .\\node_modules\\typescript\\bin\\tsc --noEmit; bun run build; git diff --check.
Send reasoning effort on OpenAI-compatible Responses requests using the nested reasoning object expected by the endpoint instead of flat reasoning_effort/reasoning_summary fields.

Keep chat_completions behavior unchanged so OpenAI-compatible chat endpoints still receive top-level reasoning_effort.

Add a regression test covering the Responses request body shape and verifying the flat fields are omitted.

Validation: bun test --feature=UNATTENDED_RETRY src/services/api/openaiShim.test.ts; node .\\node_modules\\typescript\\bin\\tsc --noEmit; git diff --check.
Make the new reasoning-effort guide discoverable from the integrations overview and reading order.

Update model, gateway, and vendor onboarding docs to explain that supportsReasoning is descriptive only and does not enable /effort request mutation without verified per-model reasoning metadata.

Clarify that gateway and vendor catalogs must annotate reasoning controls per exact route/model rather than provider-wide.

Validation: git diff --check.
Add an optional reasoning control context so effort tests can inject provider, catalog, model descriptor, and shim metadata without mocking process-global integration/provider modules.

Update effort.codex tests to use the injected context and restore only the remaining local mocks, preventing mock leakage into later full-suite provider tests.

Validation: bun run check; bun run test:provider; bun run test:provider-recommendation; bun run typecheck:type-tests; bun run integrations:check; python -m pytest -q python/tests; bun run security:pr-scan -- --base upstream/main --head HEAD.
@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds reasoning metadata docs and descriptor fields, makes effort resolution context-aware across catalog and compatibility routes, and updates OpenAI shim/client request shaping plus tests to serialize or omit reasoning fields by model and route support.

Changes

Reasoning controls

Layer / File(s) Summary
Metadata contract
src/integrations/descriptors.ts, docs/integrations/reasoning-effort.md, docs/integrations/overview.md, docs/integrations/how-to/add-*.md
Adds reasoning metadata fields and docs that describe where to place them across catalog, model, and gateway guidance.
Context-aware resolution
src/utils/effort.ts, src/utils/effort.codex.test.ts
Introduces context-aware reasoning-control helpers and test coverage for catalog metadata, compatibility routes, and non-controllable metadata cases.
OpenAI shim serialization
src/integrations/runtimeMetadata.ts, src/integrations/runtimeMetadata.test.ts, src/services/api/openaiShim.ts, src/services/api/openaiShim.test.ts
Adds preferBaseUrlRoute handling and serializes reasoning fields through a request plan for OpenAI-compatible payloads, with /responses and Groq coverage.
Provider-override gating
src/services/api/client.ts, src/services/api/client.test.ts
Gates reasoning_effort in getAnthropicClient() by model and shim support under providerOverride, with OpenAI and Groq/DeepSeek tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Gitlawb/openclaude#1505: Both PRs change the “reasoning/effort” pipeline in src/utils/effort.ts and shim request shaping.
  • Gitlawb/openclaude#1689: Both PRs modify OpenAI shim reasoning/thinking handling, including Z.AI-compatible request shaping and tests.

Suggested labels

new: provider/gateway

Suggested reviewers

  • kevincodex1
🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.87% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, scoped, and accurately summarizes the model-level reasoning effort routing changes.
Description check ✅ Passed The description covers summary, impact, testing, and notes, with the required reasoning metadata and follow-up context mostly complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed PASS: The PR touches provider routing and outbound request shaping, and the description explicitly calls out those risks and notes they were blocking until fixed.
No Hidden Policy Change ✅ Passed Policy-affecting changes are explicit and tested; I found no hidden telemetry/permission/trust changes beyond the documented reasoning and route-preference behavior.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@jatmn jatmn self-assigned this Jun 24, 2026
@jatmn jatmn changed the title Add model-level reasoning effort routing feat(effort): Add model-level reasoning effort routing Jun 24, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/integrations/reasoning-effort.md`:
- Around line 11-24: Update the reasoning metadata example so
`ReasoningControlMetadata.levels` is shown as a subset array rather than a fixed
ordered tuple; use the `reasoning` block in the documentation to reflect that
`levels` can contain any valid `ReasoningEffortLevel[]` subset, not necessarily
all five values. Keep the example aligned with the current
`ReasoningControlMetadata`/`ReasoningEffortLevel` behavior so contributors
understand they may provide partial lists like `['high', 'xhigh']`.
- Around line 29-38: The “unknown models do not receive new reasoning request
fields” wording is too broad and conflicts with the compatibility behavior in
the effort resolver. Update the docs to reflect that src/utils/effort.ts still
applies heuristic compatibility shaping for certain uncatalogued routes/models
(for example DeepSeek- and Z.AI-compatible paths) even without explicit
reasoning metadata, while truly unknown models remain unchanged. Keep the
wording narrowly scoped to the resolver behavior and mention the preserved
compat path so readers do not assume all uncatalogued models are untouched.

In `@src/integrations/runtimeMetadata.ts`:
- Around line 241-247: The route selection in runtimeMetadata should not fall
back to the ambient activeRouteId when preferBaseUrlRoute is true and
resolveRouteIdFromBaseUrl returns nothing. Update the routeId logic so a
base-URL-preferred override either uses the resolved base URL route or stays
isolated from ambient provider settings, and verify the behavior around
resolveRouteIdFromBaseUrl, preferBaseUrlRoute, and activeRouteId so descriptor
values like endpointPath, removeBodyFields, and auth headers do not leak in.

In `@src/utils/effort.ts`:
- Around line 123-130: The metadata path in metadataWireFormatSupportsEffort()
is too strict and blocks /effort for compat catalogs by making
resolveMetadataReasoningControl() return non-controllable before
resolveModelReasoningControl() can reach the legacy/compat fallback. Update the
effort resolution flow so metadata with deepseek_compatible or zai_compatible is
treated as effort-capable, or otherwise keep those wire formats out of the
metadata contract until supported; make sure the behavior in
resolveMetadataReasoningControl() and resolveModelReasoningControl() matches the
intended precedence for compat-capable entries.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ab307ef5-f287-4f4c-91b4-5db4eaf92642

📥 Commits

Reviewing files that changed from the base of the PR and between 28bbec4 and 4621145.

📒 Files selected for processing (13)
  • docs/integrations/how-to/add-gateway.md
  • docs/integrations/how-to/add-model.md
  • docs/integrations/how-to/add-vendor.md
  • docs/integrations/overview.md
  • docs/integrations/reasoning-effort.md
  • src/integrations/descriptors.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/client.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • docs/integrations/reasoning-effort.md
  • docs/integrations/how-to/add-vendor.md
  • docs/integrations/how-to/add-gateway.md
  • src/integrations/runtimeMetadata.ts
  • docs/integrations/how-to/add-model.md
  • src/services/api/client.test.ts
  • docs/integrations/overview.md
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
docs/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update docs when setup, commands, or user-facing behavior changes

Files:

  • docs/integrations/reasoning-effort.md
  • docs/integrations/how-to/add-vendor.md
  • docs/integrations/how-to/add-gateway.md
  • docs/integrations/how-to/add-model.md
  • docs/integrations/overview.md
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • docs/integrations/reasoning-effort.md
  • docs/integrations/how-to/add-vendor.md
  • docs/integrations/how-to/add-gateway.md
  • src/integrations/runtimeMetadata.ts
  • docs/integrations/how-to/add-model.md
  • src/services/api/client.test.ts
  • docs/integrations/overview.md
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • docs/integrations/reasoning-effort.md
  • docs/integrations/how-to/add-vendor.md
  • docs/integrations/how-to/add-gateway.md
  • src/integrations/runtimeMetadata.ts
  • docs/integrations/how-to/add-model.md
  • src/services/api/client.test.ts
  • docs/integrations/overview.md
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • docs/integrations/reasoning-effort.md
  • docs/integrations/how-to/add-vendor.md
  • docs/integrations/how-to/add-gateway.md
  • docs/integrations/how-to/add-model.md
  • docs/integrations/overview.md
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/integrations/runtimeMetadata.ts
  • src/services/api/client.test.ts
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/integrations/runtimeMetadata.ts
  • src/services/api/client.test.ts
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
src/integrations/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Check existing provider implementations before adding a new pattern

Files:

  • src/integrations/runtimeMetadata.ts
  • src/integrations/descriptors.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/integrations/runtimeMetadata.ts
  • src/services/api/client.test.ts
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/integrations/runtimeMetadata.ts
  • src/services/api/client.test.ts
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/runtimeMetadata.ts
  • src/services/api/client.test.ts
  • src/integrations/descriptors.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
{src/commands/**/*.ts,src/services/**/*.ts,src/entrypoints/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use chalk for terminal color in CLI code

Files:

  • src/services/api/client.test.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/services/api/client.test.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/client.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/services/api/client.test.ts
  • src/services/api/openaiShim.test.ts
  • src/utils/effort.codex.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/services/api/client.test.ts
  • src/services/api/openaiShim.test.ts
  • src/utils/effort.codex.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/services/api/client.test.ts
  • src/services/api/openaiShim.test.ts
  • src/utils/effort.codex.test.ts
🪛 LanguageTool
docs/integrations/overview.md

[style] ~47-~47: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ssary.mdfor the shared vocabulary. 3. Readdocs/integrations/reasoning-effort.md`...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🔇 Additional comments (4)
src/services/api/openaiShim.ts (1)

41-41: LGTM!

Also applies to: 2437-2457, 2510-2535, 2617-2621

src/services/api/openaiShim.test.ts (1)

360-400: LGTM!

Also applies to: 6160-6193

src/services/api/client.ts (1)

15-16: LGTM!

Also applies to: 49-49, 335-359

src/services/api/client.test.ts (1)

1335-1443: LGTM!

Comment thread docs/integrations/reasoning-effort.md
Comment thread docs/integrations/reasoning-effort.md Outdated
Comment thread src/integrations/runtimeMetadata.ts Outdated
Comment thread src/utils/effort.ts
@jatmn jatmn added bug Something isn't working enhancement New feature or request labels Jun 24, 2026
Load integration registry before catalog reasoning lookup, isolate provider override route resolution from ambient routes, and carry explicit compat reasoning metadata into the OpenAI shim request planner.

Clarify reasoning metadata documentation and add focused regression coverage for compat metadata and provider override route preference.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/effort.ts`:
- Around line 593-605: The metadata gate in effort resolution is missing the
`high` level, so `reasoningEffort` is dropped for `zai_compatible` entries that
only advertise `levels: ['high']`. Update the
`metadataZaiSupportsReasoningEffort` check in `src/utils/effort.ts` to include
`high`, keeping the existing `options.reasoningControl?.levels.includes(...)`
pattern aligned with the other supported levels. Add a focused regression test
around the effort normalization path (the
`reasoningEffort`/`normalizeZaiReasoningEffort` branch) to verify that a
high-only metadata entry preserves `/effort high`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 83233507-75af-4d7e-82d2-a1865e269306

📥 Commits

Reviewing files that changed from the base of the PR and between 4621145 and f4aef70.

📒 Files selected for processing (6)
  • docs/integrations/reasoning-effort.md
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.codex.test.ts
  • src/utils/effort.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests
  • GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • docs/integrations/reasoning-effort.md
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.ts
docs/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update docs when setup, commands, or user-facing behavior changes

Files:

  • docs/integrations/reasoning-effort.md
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • docs/integrations/reasoning-effort.md
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • docs/integrations/reasoning-effort.md
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.ts
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • docs/integrations/reasoning-effort.md
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
src/integrations/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Check existing provider implementations before adding a new pattern

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/services/api/openaiShim.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/runtimeMetadata.test.ts
  • src/utils/effort.codex.test.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/utils/effort.codex.test.ts
  • src/services/api/openaiShim.ts
  • src/utils/effort.ts
{src/commands/**/*.ts,src/services/**/*.ts,src/entrypoints/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use chalk for terminal color in CLI code

Files:

  • src/services/api/openaiShim.ts

Comment thread src/utils/effort.ts
Include high in the Z.AI-compatible metadata gate so high-only reasoning metadata emits reasoning_effort instead of silently dropping the user-selected effort.

Add regression coverage for a high-only zai_compatible catalog entry flowing through the OpenAI shim request planner.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 24, 2026
Allow unrecognized providerOverride OpenAI-compatible routes to fall back to legacy effort support instead of dropping user-selected effort.

Constrain compat metadata levels to wire-faithful high/xhigh values and clarify reserved reasoning wire formats in docs and descriptors.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 25, 2026
Resolve providerOverride effort against the override model and route context before converting it for the OpenAI shim, so stale persisted effort values respect per-model metadata levels.

Add regression coverage for high-only providerOverride metadata and explicit max filtering in compat metadata levels.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/services/api/client.ts (1)

336-378: 🩺 Stability & Availability | 🟡 Minor

Add CLAUDE_CODE_USE_OPENAI coverage for reasoning_effort

src/services/api/client.ts now gates shim reasoning_effort on modelSupportsWireEffort(model) and clamps via resolveAppliedEffort. Add a src/services/api/client.test.ts case for the env-route path, ideally with an unsupported OpenAI-compatible model, to lock in the new omission behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/services/api/client.ts` around lines 336 - 378, `client.ts` now
suppresses shim `reasoning_effort` when the model does not support wire effort,
but this path is not covered for the `CLAUDE_CODE_USE_OPENAI` env-route flow.
Add a `client.test.ts` case that exercises
`resolveOpenAIShimRuntimeContext`/`resolveAppliedEffort` through an
OpenAI-compatible provider override with an unsupported model, and assert that
`shimReasoningEffort` is omitted instead of being sent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/services/api/client.ts`:
- Around line 336-378: `client.ts` now suppresses shim `reasoning_effort` when
the model does not support wire effort, but this path is not covered for the
`CLAUDE_CODE_USE_OPENAI` env-route flow. Add a `client.test.ts` case that
exercises `resolveOpenAIShimRuntimeContext`/`resolveAppliedEffort` through an
OpenAI-compatible provider override with an unsupported model, and assert that
`shimReasoningEffort` is omitted instead of being sent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9adebdde-4e93-49dd-b2ad-33585806cab0

📥 Commits

Reviewing files that changed from the base of the PR and between 5c6d121 and 78d98f7.

📒 Files selected for processing (3)
  • src/services/api/client.test.ts
  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests
  • GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (13)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
{src/commands/**/*.ts,src/services/**/*.ts,src/entrypoints/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use chalk for terminal color in CLI code

Files:

  • src/services/api/client.ts
  • src/services/api/client.test.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/services/api/client.ts
  • src/services/api/client.test.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/services/api/client.ts
  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/services/api/client.ts
  • src/services/api/client.test.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/utils/effort.codex.test.ts
  • src/services/api/client.test.ts
🔇 Additional comments (2)
src/utils/effort.codex.test.ts (1)

676-746: LGTM!

src/services/api/client.test.ts (1)

1446-1527: 📐 Maintainability & Code Quality

No issue here: globalThis.fetch is restored in the shared afterEach, so the stub stays isolated across tests.

			> Likely an incorrect or invalid review comment.

@jatmn
jatmn marked this pull request as ready for review June 25, 2026 00:57
@jatmn

jatmn commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

@kevincodex1 LGTM

@kevincodex1 kevincodex1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kevincodex1
kevincodex1 merged commit cb689cc into Twigpine:main Jun 25, 2026
4 checks passed
@jatmn
jatmn deleted the effort branch June 25, 2026 03:33
adityachaudhary99 added a commit to adityachaudhary99/openclaude that referenced this pull request Jun 28, 2026
Rebased onto current main so the diff contains only these changes — Twigpine#1780's
model-level effort routing now comes from main rather than being duplicated.

- ultrathink: a `\bultrathink\b` keyword in a prompt injects a high-effort
  reminder, gated behind the isUltrathinkEnabled() rollout flag.
- ultracode: a new session-only EffortLevel that maps to xhigh (or high) on the
  wire and grants a standing multi-agent orchestration permission. First-party
  only, suppressed under a per-agent providerOverride, and gated to
  xhigh-capable models. Honors CLAUDE_CODE_EFFORT_LEVEL precedence across the API
  path, the permission attachment, and the display surfaces; rejected from every
  agent-definition input (markdown/skill/plugin frontmatter, SDK, and JSON).

Closes Twigpine#1551

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
adityachaudhary99 added a commit to adityachaudhary99/openclaude that referenced this pull request Jun 28, 2026
Rebased onto current main so the diff contains only these changes — Twigpine#1780's
model-level effort routing now comes from main rather than being duplicated.

- ultrathink: a `\bultrathink\b` keyword in a prompt injects a high-effort
  reminder, gated behind the isUltrathinkEnabled() rollout flag.
- ultracode: a new session-only EffortLevel that maps to xhigh (or high) on the
  wire and grants a standing multi-agent orchestration permission. First-party
  only, suppressed under a per-agent providerOverride, and gated to
  xhigh-capable models. Honors CLAUDE_CODE_EFFORT_LEVEL precedence across the API
  path, the permission attachment, and the display surfaces; rejected from every
  agent-definition input (markdown/skill/plugin frontmatter, SDK, and JSON).

Closes Twigpine#1551

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
hotmanxp added a commit to hotmanxp/openclaude that referenced this pull request Jul 5, 2026
…ffort protocol

GLM-5.2 (zai's reasoning-capable flagship) accepts a wire vocabulary of
`high` / `max` for the chat-completions `reasoning_effort` field; older
GLM versions reject the field outright. The openai provider's
brand-id alias `zhiniao-glm-5.1` resolves to the same underlying
GLM-5.2 model, so it must use the same wire contract.

Add three helpers to src/utils/effort.ts:

- `supportsZaiReasoningEffort(model)` — whitelist check; true for
  `glm-5.2`, `zai-org/glm-5.2`, and `zhiniao-glm-5.1` (strips the
  `?reasoning=<level>` query suffix before matching).
- `modelLooksZaiCompatible(model)` — broader family check; any
  `glm-*` / `zai-org/glm-*` string.
- `normalizeZaiReasoningEffort(effort)` — collapse OpenCC's full
  effort vocabulary to zai's two-value wire: `low` / `medium` / `high`
  → `high`; `xhigh` / `max` / `ultracode` → `max`.

Wire the helpers into the chat-completions body emission in
src/services/api/openaiShim/openaiClient.ts: when the resolved
model is zai-effort-capable, route `request.reasoning.effort`
through `normalizeZaiReasoningEffort` before writing the body;
otherwise pass through unchanged.

Add co-located tests in src/utils/effort.zai.test.ts covering the
whitelist (positive + negative cases including query-suffix handling),
the family-prefix matcher, and the effort normalizer's full
vocabulary.

Ports the GLM-5.2 portion of upstream cb689cc (Twigpine#1780) while
intentionally dropping the wider reasoning-effort-routing system
(DeepSeek compat, Responses API shape, runtime metadata registry,
descriptor registry, Client.ts wholesale rewrite) — those pieces
require fork-policy rework for removed providers and are deferred
to a follow-up fsync session.
kevincodex1 pushed a commit that referenced this pull request Jul 8, 2026
) (#1630)

* feat: add ultrathink keyword detection and ultracode effort level

Rebased onto current main so the diff contains only these changes — #1780's
model-level effort routing now comes from main rather than being duplicated.

- ultrathink: a `\bultrathink\b` keyword in a prompt injects a high-effort
  reminder, gated behind the isUltrathinkEnabled() rollout flag.
- ultracode: a new session-only EffortLevel that maps to xhigh (or high) on the
  wire and grants a standing multi-agent orchestration permission. First-party
  only, suppressed under a per-agent providerOverride, and gated to
  xhigh-capable models. Honors CLAUDE_CODE_EFFORT_LEVEL precedence across the API
  path, the permission attachment, and the display surfaces; rejected from every
  agent-definition input (markdown/skill/plugin frontmatter, SDK, and JSON).

Closes #1551

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(effort): clamp ultracode display availability

* fix(effort): report effective effort overrides

* test(model): avoid catalog-dependent effort label

* fix(model): resolve current effort against session model

* fix(spinner): resolve effort suffix against session model

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: jatmn <the@jat.mn>
hotmanxp pushed a commit to hotmanxp/openclaude that referenced this pull request Jul 9, 2026
…igpine#1551) (Twigpine#1630)

* feat: add ultrathink keyword detection and ultracode effort level

Rebased onto current main so the diff contains only these changes — Twigpine#1780's
model-level effort routing now comes from main rather than being duplicated.

- ultrathink: a `\bultrathink\b` keyword in a prompt injects a high-effort
  reminder, gated behind the isUltrathinkEnabled() rollout flag.
- ultracode: a new session-only EffortLevel that maps to xhigh (or high) on the
  wire and grants a standing multi-agent orchestration permission. First-party
  only, suppressed under a per-agent providerOverride, and gated to
  xhigh-capable models. Honors CLAUDE_CODE_EFFORT_LEVEL precedence across the API
  path, the permission attachment, and the display surfaces; rejected from every
  agent-definition input (markdown/skill/plugin frontmatter, SDK, and JSON).

Closes Twigpine#1551

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(effort): clamp ultracode display availability

* fix(effort): report effective effort overrides

* test(model): avoid catalog-dependent effort label

* fix(model): resolve current effort against session model

* fix(spinner): resolve effort suffix against session model

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: jatmn <the@jat.mn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make /effort good. Unsupported parameter: 'reasoning_effort'

2 participants