Skip to content

fix(opencode): expose Claude thinking levels#72778

Merged
steipete merged 3 commits into
openclaw:mainfrom
haishmg:codex/opencode-anthropic-thinking
Apr 27, 2026
Merged

fix(opencode): expose Claude thinking levels#72778
steipete merged 3 commits into
openclaw:mainfrom
haishmg:codex/opencode-anthropic-thinking

Conversation

@haishmg

@haishmg haishmg commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an OpenCode thinking profile for proxied Claude Opus 4.7 and Opus/Sonnet 4.6 models
  • keep the default thinking ladder for other OpenCode models
  • add regression coverage for /think xhigh, adaptive, and max validation

Fixes #72729.

Tests

  • CI=true OPENCLAW_LOCAL_CHECK=0 npm exec pnpm@10.33.0 -- test extensions/opencode/index.test.ts
  • CI=true OPENCLAW_LOCAL_CHECK=0 npm exec pnpm@10.33.0 -- lint:extensions
  • CI=true OPENCLAW_LOCAL_CHECK=0 npm exec pnpm@10.33.0 -- tsgo:prod
  • git diff --check

@haishmg

haishmg commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@greptile-apps

greptile-apps Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR exposes Anthropic-specific thinking levels (xhigh, adaptive, max) for proxied Claude Opus 4.7, Opus 4.6, and Sonnet 4.6 models on the OpenCode provider, fixing /think command validation failures for those models. The implementation correctly normalises model IDs to lowercase and dispatches to the right thinking-level set.

Confidence Score: 4/5

Safe to merge; only a minor test symmetry gap was found.

All findings are P2 (style/test coverage). The production code logic is clean and consistent with existing patterns.

extensions/opencode/index.test.ts — missing negative assertion for opus-4.6 thinking levels

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/opencode/index.test.ts
Line: 65-73

Comment:
**Missing negative assertion for `claude-opus-4.6`**

The test verifies that `claude-sonnet-4-6` does not contain `xhigh` or `max` levels (line 82–84), but the same assertion is absent for `claude-opus-4.6`. Both models are resolved through the same `ANTHROPIC_ADAPTIVE_MODEL_PREFIXES` branch, so a regression that accidentally added `xhigh`/`max` to that branch would be caught only for the sonnet model. Adding a parallel `sonnet46Profile?.levels.some(...)` check for the opus profile would close the symmetry gap.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(opencode): expose claude thinking le..." | Re-trigger Greptile

Comment thread extensions/opencode/index.test.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@haishmg haishmg force-pushed the codex/opencode-anthropic-thinking branch from 2e297b4 to 57ae744 Compare April 27, 2026 11:20
@haishmg

haishmg commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review latest head, please

@haishmg haishmg force-pushed the codex/opencode-anthropic-thinking branch from 57ae744 to 795a295 Compare April 27, 2026 11:22
@haishmg

haishmg commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the Greptile test symmetry note by adding the Opus 4.6 negative assertion, rebased on latest main, and pushed the latest head. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@haishmg haishmg force-pushed the codex/opencode-anthropic-thinking branch 2 times, most recently from 137c5e5 to b0cf46e Compare April 27, 2026 11:34
@haishmg

haishmg commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the extension test boundary failure from the new Qwen test import and pushed the rebased head. Local guard and focused provider tests pass. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete steipete force-pushed the codex/opencode-anthropic-thinking branch from 09a5867 to 69583d2 Compare April 27, 2026 11:54
@steipete steipete force-pushed the codex/opencode-anthropic-thinking branch 2 times, most recently from d7b39e5 to 4a22422 Compare April 27, 2026 12:13
@haishmg haishmg force-pushed the codex/opencode-anthropic-thinking branch from 4a22422 to 84e1dd9 Compare April 27, 2026 12:18
@steipete steipete force-pushed the codex/opencode-anthropic-thinking branch from 84e1dd9 to eb365a2 Compare April 27, 2026 12:18
@steipete steipete force-pushed the codex/opencode-anthropic-thinking branch from eb365a2 to 6b0fb5c Compare April 27, 2026 12:28
@steipete steipete force-pushed the codex/opencode-anthropic-thinking branch from 6b0fb5c to bd7bd2b Compare April 27, 2026 12:32
@haishmg haishmg force-pushed the codex/opencode-anthropic-thinking branch from bd7bd2b to 022a2b9 Compare April 27, 2026 12:41
@haishmg

haishmg commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on latest main and added the generated config schema/docs hash sync required by the OpenCode thinking profile schema change. Focused local checks pass: config:schema:check, config:docs:check, schema.base.generated.test.ts, and extensions/opencode/index.test.ts. @codex review

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Apr 27, 2026
@steipete steipete force-pushed the codex/opencode-anthropic-thinking branch from 022a2b9 to 37f7933 Compare April 27, 2026 12:45
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Apr 27, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@steipete steipete force-pushed the codex/opencode-anthropic-thinking branch from 37f7933 to a9dee06 Compare April 27, 2026 12:59
@steipete steipete merged commit f75d882 into openclaw:main Apr 27, 2026
65 checks passed
@haishmg

haishmg commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

Latest head a9dee06 is green in CI now: 57 passing checks, no pending/failing checks. The fast/support failure was resolved by keeping the speech provider registry mock test out of unit-fast; local fast/support shard also passes. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* fix(opencode): expose claude thinking levels

* test(opencode): cover adaptive claude thinking bounds

* docs(changelog): credit opencode thinking contributor

---------

Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* fix(opencode): expose claude thinking levels

* test(opencode): cover adaptive claude thinking bounds

* docs(changelog): credit opencode thinking contributor

---------

Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
* fix(opencode): expose claude thinking levels

* test(opencode): cover adaptive claude thinking bounds

* docs(changelog): credit opencode thinking contributor

---------

Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* fix(opencode): expose claude thinking levels

* test(opencode): cover adaptive claude thinking bounds

* docs(changelog): credit opencode thinking contributor

---------

Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
* fix(opencode): expose claude thinking levels

* test(opencode): cover adaptive claude thinking bounds

* docs(changelog): credit opencode thinking contributor

---------

Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* fix(opencode): expose claude thinking levels

* test(opencode): cover adaptive claude thinking bounds

* docs(changelog): credit opencode thinking contributor

---------

Co-authored-by: haishmg <4529977+haishmg@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: opencode/claude-opus-4-7 rejects /think xhigh|adaptive|max despite docs declaring Opus 4.7 supports them

2 participants