Skip to content

fix(think-mode): skip gpt-5-nano high upgrade on unsupported Zen model#2383

Closed
cyberprophet wants to merge 2 commits intocode-yeongyu:devfrom
cyberprophet:fix/think-mode-gpt5-nano-korean-keyword
Closed

fix(think-mode): skip gpt-5-nano high upgrade on unsupported Zen model#2383
cyberprophet wants to merge 2 commits intocode-yeongyu:devfrom
cyberprophet:fix/think-mode-gpt5-nano-korean-keyword

Conversation

@cyberprophet
Copy link

@cyberprophet cyberprophet commented Mar 8, 2026

Summary

Fixes Model not found: opencode/gpt-5-nano-high with the minimum production change needed.

Closes #2382

Why this is the smallest safe fix

The failure is not in multilingual think-mode detection itself. The actual incompatibility is narrower:

  • think-mode intentionally upgrades supported models to their -high variant
  • gpt-5-nano was included in HIGH_VARIANT_MAP
  • OpenCode Zen does not provide opencode/gpt-5-nano-high
  • the request therefore fails at model lookup with Model not found

Because of that, this PR leaves detector.ts unchanged and only removes the unsupported upgrade path.

Production change

File: src/hooks/think-mode/switcher.ts

Removed the single unsupported mapping:

"gpt-5-nano": "gpt-5-nano-high",

That means:

  • capable models such as Claude Sonnet / Opus still upgrade to -high
  • gpt-5-nano no longer upgrades to a model ID that Zen cannot resolve
  • existing multilingual trigger behavior is preserved

Stability / risk profile

This is intentionally a minimal-scope fix:

  • 1 production file changed: src/hooks/think-mode/switcher.ts
  • No detector behavior change: src/hooks/think-mode/detector.ts is untouched in the final PR
  • No hook contract change: createThinkModeHook() API stays the same
  • No fallback/routing change: model-fallback behavior is unchanged
  • Failure mode removed, not redirected: unsupported upgrade is skipped instead of introducing a new code path

Tests

Regression coverage was added to prove both safety and behavior preservation:

src/hooks/think-mode/switcher.test.ts

  • getHighVariant("gpt-5-nano") returns null
  • getHighVariant("opencode/gpt-5-nano") returns null

src/hooks/think-mode/index.test.ts

Using the same Korean trigger sentence that surfaced the bug:

"너와 인공지능 엔진에게 이미지와 참조 자료를 어떻게 전달할지 고민하고 있었는데"

  • gpt-5-nano does not upgrade
  • claude-sonnet-4-6 still does upgrade to claude-sonnet-4-6-high

This directly verifies that the fix is narrow:

  • unsupported Nano upgrade is removed
  • existing Sonnet think-mode behavior is preserved on identical trigger text

Verification

bun test src/hooks/think-mode/

Result:

  • 30 pass
  • 0 fail

Review note

cubic identified a valid test weakness in the first draft: the original regression test used gpt-5-nano alone, which was not sufficient to prove keyword-trigger behavior on a model that can actually upgrade. This PR now includes a paired Sonnet regression on the same Korean sentence to preserve that coverage while keeping the production fix minimal.

…Korean keyword matching

Two independent bugs caused 'Model not found: opencode/gpt-5-nano-high':

1. gpt-5-nano was mapped to gpt-5-nano-high in HIGH_VARIANT_MAP, but this
   variant does not exist on the OpenCode Zen provider. gpt-5-nano is a
   lightweight nano model with no reasoning/high-effort variant.

2. The Korean word '고민' (to worry/ponder) was listed as a think-mode
   trigger keyword. It is a common conversational word that fires think mode
   on everyday sentences like '어떻게 할지 고민하고 있었는데' (I was wondering
   how to...). Replaced with explicit reasoning-request forms only:
   '생각해줘', '깊이 생각', '신중하게 검토'.

Fixes: code-yeongyu#2382
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 4 files

Confidence score: 4/5

  • This PR looks safe to merge with minimal risk: the reported issue is in a test (src/hooks/think-mode/index.test.ts) rather than production logic.
  • The most significant concern is that the '고민' regression test uses gpt-5-nano, which is not in HIGH_VARIANT_MAP, so the test cannot validate the intended model-upgrade path and may miss keyword-detection regressions.
  • Given severity 5/10 (with high confidence), this is a meaningful quality gap but not an immediate runtime breakage signal.
  • Pay close attention to src/hooks/think-mode/index.test.ts - the current model choice weakens regression coverage for keyword detection behavior.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/hooks/think-mode/index.test.ts">

<violation number="1" location="src/hooks/think-mode/index.test.ts:171">
P2: The regression test for '고민' uses an incapable model (gpt-5-nano), making it ineffective at catching keyword detection regressions. Since gpt-5-nano is not in HIGH_VARIANT_MAP, the model will never be upgraded regardless of keyword detection results. If the keyword detector were to regress and start detecting '고민', this test would pass silently. Change the modelID to a capable model like 'claude-opus-4-6' to properly isolate and test keyword detection behavior.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Preserve existing multilingual think-mode detection, including Korean trigger words like "고민", while limiting the fix to the actual incompatibility: gpt-5-nano has no supported high variant on the OpenCode Zen provider.

This keeps existing Sonnet/Opus high-variant behavior intact on the same trigger text and prevents Model not found: opencode/gpt-5-nano-high.

Refs: code-yeongyu#2382
@cyberprophet cyberprophet changed the title fix(think-mode): remove gpt-5-nano from HIGH_VARIANT_MAP and tighten Korean keyword matching fix(think-mode): skip gpt-5-nano high upgrade on unsupported Zen model Mar 8, 2026
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Minimal fix removing a broken model mapping that caused crashes. Comprehensive regression tests confirm the specific fix and preserve existing behavior for other models.

@acamq
Copy link
Collaborator

acamq commented Mar 9, 2026

Closing, fixed by #2390 . Thank you for your contributions!

@acamq acamq closed this Mar 9, 2026
@cyberprophet cyberprophet deleted the fix/think-mode-gpt5-nano-korean-keyword branch March 9, 2026 02:56
@cyberprophet
Copy link
Author

Closing, fixed by #2390 . Thank you for your contributions!

It looks like my fix was incorporated into #2390.
Would it be possible to add me as a co-author on the commit?

Thanks!

@cyberprophet
Copy link
Author

Closing, fixed by #2390 . Thank you for your contributions!

@code-yeongyu
Thanks to your work, I’ve started exploring vibe coding even though I used to feel quite skeptical about it. After trying it myself, I’m convinced that the combination of opencode and oh-my-opencode is one of the best setups for vibe coding.

I really appreciate the effort you’ve put into this project, and I’m looking forward to seeing how it continues to evolve. Wishing you all the best with your future work!

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.

[Bug]: Think mode activates on conversational keywords (e.g. '고민') and upgrades gpt-5-nano to gpt-5-nano-high — a non-existent model on Zen

2 participants