Skip to content

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

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
youngchangjo:fix/commandcode-reasoning-efforts-and-slug-decode
Aug 18, 2026
Merged

fix(commandcode): share reasoning-facts table and fix GLM slug decoding for API-key preset#1800
lidge-jun merged 1 commit into
lidge-jun:devfrom
youngchangjo:fix/commandcode-reasoning-efforts-and-slug-decode

Conversation

@youngchangjo

@youngchangjo youngchangjo commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main changes: shared reasoning data and corrected GLM slug decoding for the Command Code API-key preset.
✨ 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

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • 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.

This PR stays in draft until every box above is ticked.

@github-actions
github-actions Bot marked this pull request as draft August 15, 2026 23:44
@Wibias

Wibias commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

@youngchangjo please retarget this pr on the dev branch.

@lidge-jun
lidge-jun changed the base branch from main to dev August 18, 2026 07:04
@lidge-jun

Copy link
Copy Markdown
Owner

Retargeted base from main to dev per branch policy: main only moves by maintainer promotion, and this head (011b11d) is not part of a release train. The 4-file commandcode reasoning/slug fix still applies on dev (modelReasoningEfforts absent, GLM keys still glm-5.3). Needs a rebase before review.

@github-actions github-actions Bot changed the title [WRONG BRANCH] fix(commandcode): share reasoning-facts table and fix GLM slug decoding for API-key preset fix(commandcode): share reasoning-facts table and fix GLM slug decoding for API-key preset Aug 18, 2026
lidge-jun added a commit that referenced this pull request Aug 18, 2026
fix(commandcode): share reasoning-facts table and fix GLM slug decode (lands #1800)
@lidge-jun

Copy link
Copy Markdown
Owner

Landed via #2015 — your commits merged onto current dev with the one slug-codec test conflict resolved additively (both suites kept; 89/0 + tsc clean). Thanks for the fix: the commandcode API-key preset now shares the reasoning-facts table and GLM slugs decode with canonical casing. Closing this original since the work is on dev.

@lidge-jun
lidge-jun merged commit 9f9f691 into lidge-jun:dev Aug 18, 2026
9 of 11 checks passed
bonelag pushed a commit to bonelag/megaproxy that referenced this pull request Aug 18, 2026
Close the five regressions that turned dev-head CI red at aaf0469:

- core.ts: scope the lidge-jun#1851 transient-5xx retry to the direct Google adapter.
  The generic openai-chat path returned to reset-only retry, so combo
  failover hops on the first 5xx again instead of burning three
  same-target attempts per hop (6 combo e2e failures, 2 sidecar-auth
  timeouts).
- commandcode-provider.test.ts: lidge-jun#1800 surfaces the curated effort table;
  the sibling test still expected [] (its hyphenated twin was updated).
- bridge-raw-reasoning-hidden.test.ts: lidge-jun#2007 routes visible raw
  reasoning through the expandable summary channel; two tests still
  asserted the retired content-channel shape.
- codex-app-server-processes.test.ts + cli-restore-back.test.ts: lidge-jun#1931
  intentionally refreshes the ocx-side catalog/cache during explicit
  sync while Codex integration is OFF; the source-inspection and
  message assertions now track that contract (Codex config mtime is
  still asserted untouched).
- gui models-empty-provider test: lidge-jun#1991 renamed the dialog button to
  "Custom windows"; the test still clicked "Context windows".

Plus the WP-V stabilization audit plan doc for the campaign unit.
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.

3 participants