Skip to content

[WRONG BRANCH] fix(commandcode): share reasoning-facts table and fix GLM slug decoding for API-key preset - #1800

Draft
youngchangjo wants to merge 1 commit into
lidge-jun:mainfrom
youngchangjo:fix/commandcode-reasoning-efforts-and-slug-decode
Draft

[WRONG BRANCH] fix(commandcode): share reasoning-facts table and fix GLM slug decoding for API-key preset#1800
youngchangjo wants to merge 1 commit into
lidge-jun:mainfrom
youngchangjo:fix/commandcode-reasoning-efforts-and-slug-decode

Conversation

@youngchangjo

@youngchangjo youngchangjo commented Aug 15, 2026

Copy link
Copy Markdown

Problem

The commandcode (API-key) registry entry was missing the official model-profile reasoning-facts table that the OAuth command-code entry carries. Two user-visible failures followed:

  1. No reasoning picker + content.type 400 — the Codex catalog advertised supported_reasoning_levels: [] for every API-key model (deepseek-v4-flash/pro, GLM-5.x), so clients forced effort none and requests failed with:
    Provider error 400: messages.content.type is invalid, allowed values: ['text']
    
  2. unsupported_model 400 — the router's known-ids decode source (knownModelIdsForProvider unions registry modelReasoningEfforts keys) missed the native slash ids, so Codex-facing slugs like commandcode/deepseek-deepseek-v4-pro were forwarded upstream verbatim (instead of deepseek/deepseek-v4-pro) and rejected intermittently (only when the live-models cache was cold):
    Provider error 400: Model "deepseek-deepseek-v4-pro" is not supported on this endpoint.
    

Fix

  • src/providers/registry.ts: add modelReasoningEfforts: COMMAND_CODE_MODEL_REASONING_EFFORTS to the commandcode (API-key) entry — same shared table the OAuth command-code entry uses. This both restores the reasoning picker and feeds the router's known-ids decode source.
  • src/providers/command-code-efforts.ts:
    • Fix GLM table keys to the exact upstream ids (zai-org/GLM-5.3, not zai-org/glm-5.3) so the exact-match known-ids decode works.
    • Make commandCodeReasoningEfforts / refreshCommandCodeReasoningEfforts lookups case-insensitive.
    • Add GLM-5, GLM-5.1, GLM-5.2-Fast (verified high/max from their official profile pages).

Verification

  • New regression tests: API-key preset shares the OAuth reasoning-facts table; commandcode/deepseek-deepseek-v4-pro and commandcode/zai-org-GLM-5.3 decode back to native slash ids.
  • bun test tests/slug-codec.test.ts tests/command-code-provider.test.ts tests/routing-compatibility.test.ts tests/provider-registry-parity.test.ts — all pass.
  • Live verification against the real Command Code provider API after applying the same change locally:
    • Catalog now advertises deepseek-* [high, max, ultra], zai-org-GLM-5.3 [low, high, max, ultra].
    • commandcode/deepseek-deepseek-v4-pro and commandcode/zai-org-GLM-5.3 requests (incl. reasoning_effort) return 200 with reasoning tokens.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features

    • Added support for GLM-5, GLM-5.1, GLM-5.2-Fast, and GLM-5.3 models.
    • Added official reasoning-effort support for Command Code models.
    • Improved support for namespaced models, including IDs containing slashes.
  • Bug Fixes

    • Model IDs are now matched case-insensitively for more reliable lookups.
    • Corrected canonical model ID casing and alias decoding.

…ng for API-key preset

The `commandcode` (API-key) registry entry was missing the official
model-profile reasoning-facts table that the OAuth `command-code` entry
carries. Two symptoms followed:

1. The Codex catalog advertised no reasoning levels for API-key models
   (deepseek-v4-flash/pro, GLM-5.x), so clients forced effort none and
   requests failed with 400 'messages.content.type is invalid'.
2. The router's known-ids decode source missed the native slash ids, so
   Codex-facing slugs like `commandcode/deepseek-deepseek-v4-pro` were
   forwarded upstream verbatim and rejected with 400 'unsupported_model'.

Also fix the GLM table keys to match the exact upstream ids
(`zai-org/GLM-5.3` not `zai-org/glm-5.3`) and make the effort lookup
case-insensitive, and add GLM-5 / 5.1 / 5.2-Fast (verified high/max from
their official profiles).
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 15, 2026
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 62293da3-986f-43d6-9e53-6fa9816ad92c

📥 Commits

Reviewing files that changed from the base of the PR and between 2a1604e and 011b11d.

📒 Files selected for processing (4)
  • src/providers/command-code-efforts.ts
  • src/providers/registry.ts
  • tests/command-code-provider.test.ts
  • tests/slug-codec.test.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change aligns Command Code GLM model identifiers with upstream casing, adds new GLM profiles, makes profile lookups case-insensitive, shares reasoning metadata with the API-key provider, and adds registry and alias regression coverage.

Changes

Command Code model support

Layer / File(s) Summary
Model profiles and case-insensitive lookup
src/providers/command-code-efforts.ts
Adds GLM-5, GLM-5.1, and GLM-5.2-Fast profiles. Updates GLM identifiers to upstream casing. Reasoning-effort and profile lookups now match configured model IDs case-insensitively.
Registry wiring and regression coverage
src/providers/registry.ts, tests/command-code-provider.test.ts, tests/slug-codec.test.ts
The API-key provider now uses shared Command Code reasoning metadata. Tests cover canonical model IDs, registry parity, native slash-containing IDs, and routed alias decoding.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 011b1

The change restores reasoning options and correct model-id decoding for the API-key provider, with regression coverage and passing verification; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested reviewers: ingwannu, wibias

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the shared reasoning-effort table and GLM slug-decoding fix for the API-key preset.
Linked Issues check ✅ Passed The changes satisfy the provider routing, reasoning-effort mapping, model synchronization, and regression coverage objectives in [#39].
Out of Scope Changes check ✅ Passed All changed files support the stated Command Code reasoning-table, model-casing, slug-decoding, and regression-test objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot changed the title fix(commandcode): share reasoning-facts table and fix GLM slug decoding for API-key preset [WRONG BRANCH] fix(commandcode): share reasoning-facts table and fix GLM slug decoding for API-key preset Aug 15, 2026
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • wrong target branch (main); retarget to dev.

What to do

  • Retarget this PR to dev — all contributions go to dev.
  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ⬜ I pushed my PR to the latest dev commit.
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.
@youngchangjo Tick the boxes once your local CI is green, your branch is on the latest dev commit, and every correct Codex and CodeRabbit finding is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 15, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant