Skip to content

Fix a configuration bug with Opus 4.7 adaptive thinking#3286

Merged
mitsuhiko merged 4 commits into
earendil-works:mainfrom
markusylisiurunen:feat/anthropic-opus-4-7-smoke
Apr 16, 2026
Merged

Fix a configuration bug with Opus 4.7 adaptive thinking#3286
mitsuhiko merged 4 commits into
earendil-works:mainfrom
markusylisiurunen:feat/anthropic-opus-4-7-smoke

Conversation

@markusylisiurunen

Copy link
Copy Markdown
Contributor

No description provided.

@markusylisiurunen

Copy link
Copy Markdown
Contributor Author

Could you also re-generate the models list to pick up the AWS Bedrock models? I don't want to do it in this PR as it's noise and unrelated.

@markusylisiurunen markusylisiurunen changed the title Fix a configuration bug with Opus 4.7 Fix a configuration bug with Opus 4.7 adaptive thinking Apr 16, 2026
Comment on lines +451 to +457
case "xhigh":
return modelId.includes("opus-4-6") || modelId.includes("opus-4.6") ? "max" : "high";
return modelId.includes("opus-4-6") ||
modelId.includes("opus-4.6") ||
modelId.includes("opus-4-7") ||
modelId.includes("opus-4.7")
? "max"
: "high";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pi doesn't expose a value in between high and xhigh. I think semantically Pi's xhigh should map to the highest available value which is max here.

@namecallfilter namecallfilter Apr 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pi doesn't expose a value in between high and xhigh. I think semantically Pi's xhigh should map to the highest available value which is max here.

For Opus 4.7, xhigh and max are too distinct, so it should probably support both for more flexibility.
image

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If we have to pick between xhigh and max for the top thinking level available in pi, then I agree that we should choose max. But why not expose both?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm yeah, it's a bit debatable whether Pi's xhigh should map to xhigh or max. Seems like fairly diminishing returns to be honest going from xhigh to max.

@badlogic or @mitsuhiko any thoughts on this?

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.

well at the very least xhigh should not map to max given that graph that was posted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, agree on that given the graph. I'll update.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mitsuhiko Opus 4.7 now maps xhigh -> xhigh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yeah, it's a mess. pi-ai package has a ThinkingLevel for everything must map to. providers keep adding the weirdest shit, with partial support in some models.

maybe we can trick the type system into per model thinking levels #3208 somehow, so streamSimple completions work correctly. it still sucks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What I did in my local fork is map minimal -> low, low -> medium, medium -> high, high -> xhigh, xhigh -> max
Which is pretty terrible but at least you can access all the levels

@mitsuhiko mitsuhiko merged commit d1c6cb1 into earendil-works:main Apr 16, 2026
1 check passed
@64rl0

64rl0 commented Apr 17, 2026

Copy link
Copy Markdown

I looks like commit 6dca0c3 have removed the effort max from Opus 4.7, however it is still the most powerful effort as per docs: https://platform.claude.com/docs/en/build-with-claude/effort#recommended-effort-levels-for-claude-opus-4-7

PSU3D0 added a commit to PSU3D0/pi-mono that referenced this pull request May 13, 2026
Consolidates 62 upstream commits (v0.67.4 -> v0.67.68) into the fork.
Preserves all fork-local work (OAuth cloak, antigravity pool, context
tiers, OSC 8 file hyperlinks, gemini3 sig skip, codex_cli_rs headers,
compaction context hooks, gpt-5.4 models).

Conflict resolutions (4 files):

- packages/ai/src/providers/google-gemini-cli.ts: layered upstream's
  onResponse hook call into our pool-aware retry loop; kept our
  finally-block pool.saveNow() path.

- packages/tui/src/utils.ts: adopted upstream's AnsiCodeTracker OSC 8
  impl wholesale. It's cleaner than our f16dfd5 version (preserves
  hyperlink across SGR reset via separate clear(), emits ST-terminated
  sequences). Dropped our 7d75fee SEGMENT_RESET fix since upstream's
  design never introduced the bug.

- packages/tui/src/components/markdown.ts: kept our resolveHref hook
  and wrapHyperlink helper but gated OSC 8 emission on
  getCapabilities().hyperlinks; switched to upstream's hyperlink()
  helper for consistency. Merges file path linking (ours) with
  terminal capability detection (upstream earendil-works#3248, #30a8a41f).

- packages/tui/test/{markdown,wrap-ansi}.test.ts: updated our OSC 8
  assertions to ST-terminated sequences (\x1b\\) to match new emitter;
  added setCapabilities({hyperlinks:true}) gating where needed;
  afterEach resetCapabilitiesCache to isolate test state.

Dependency upgrades from upstream:
- @anthropic-ai/sdk 0.73.0 -> 0.90.0
- @aws-sdk/client-bedrock-runtime 3.983.0 -> 3.1030.0
- @mistralai/mistralai 1.14.1 -> 2.2.0

Upstream features folded in:
- fix(ai): Opus 4.7 adaptive thinking + xhigh effort (earendil-works#3286)
- feat(ai): thinkingDisplay option (summarized/omitted/raw)
- feat(coding-agent): after_provider_response hook (earendil-works#3128)
- fix(ai): trust requested Codex service tier (earendil-works#3307)
- feat(bedrock): Bearer token auth for Converse API (earendil-works#3125)
- feat(agent,coding-agent): per-tool executionMode override (earendil-works#3345)
- feat(tui): OSC 8 hyperlinks with terminal capability detection
  (earendil-works#3248, #30a8a41f)
- feat(coding-agent,tui): argument-hint frontmatter in prompts (earendil-works#2780)
- Plus ~40 smaller fixes across ai/coding-agent/tui/agent.

Verification:
- packages/tui: 559/559 tests pass
- packages/ai: 144/144 OAuth cloak tests pass; all fork-local suites
  pass (antigravity-pool, context-tiers, gemini3-unsigned-tool-call,
  codex-stream, supports-xhigh, etc.). Remaining test failures (13)
  are pre-existing live-API E2E tests (no credentials in this env).
- packages/agent: 39/39 tests pass.
- packages/coding-agent: 1020/1021 tests pass; 1 flaky bash timeout
  test (passes in isolation), unrelated to merge.
- All four packages build cleanly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants