← Back to Pull requests

feat(runtime): offer Command Code GO thinking levels #5484

Closed
unknown closed this pull request without merging on Sep 18, 2026 11:24 UTC
View on GitHub
unknown unknown commented on Sep 18, 2026 10:44 UTC
Author

Problem

Command Code GO is the only Command Code plan without Provider API access, so it rides the CLI's /alpha/generate transport. That transport accepts reasoning_effort, and the commandcode-cli branch in model-factory.ts already maps a level onto it — but the level never arrives: the thinking-level switcher does not appear for commandcode-go (or plain commandcode).

The cause is a metadata miss, not a wire gap. Command Code exposes no reasoning metadata:

  • GET /provider/v1/models (public, no key) returns 70 models with only id, object, created, owned_by, name, context_length, supported_endpoints.

  • GET /provider/v1/models/<id> is 404 — not a registered route.

  • models.dev has no Command Code provider, so model-metadata.generated.ts has zero commandcode entries.
  • So lookupModelMetadata('commandcode-go', id) returns {}, thinkingOptionsForModel returns undefined, thinkingVariantsForModel returns [], and the UI hides the switcher by convention. That leaves the model-factory.ts mapping as dead code.

    Change

    Add a static per-model table in model-metadata.ts (COMMAND_CODE_MODEL_METADATA), wired to both commandcode and commandcode-go. The levels are ported from Mars-Sea/dsh-commandcode-provider's KNOWN_EFFORTS (MIT), which was re-verified against command-code@1.53.0's bundled model table (dist/cli.mjs, the provider effort map). Because models.dev has no entry for the provider, lookupModelMetadata returns the static override directly, so the full chain lights up with no change to the relay gating.

    Two rules from the reference are preserved and documented in the source:

  • Models that reason automatically with a depth Command Code chooses (Tencent Hy3/Hy4 without levels, GLM-5/5.1/5.2-Fast, and the previews the reference keeps in KNOWN_THINKING_MODELS) carry no selectable effort. They stay out of the table, so no selector is offered for them — matching the CLI, which omits reasoning_effort for them.

  • Only the Provider-API effort table is authoritative here; OAuth (anthropic/openai) levels are not mixed in.
  • Also drop the max -> high downgrade in the commandcode-cli branch of model-factory.ts. max is a real CLI effort word (claude-fable-5-1, moonshotai/Kimi-K3, gpt-5.6-*, ...), and the reference forwards the level verbatim; the downgrade silently sent a weaker request than the user chose.

    Tests

  • packages/core/src/__tests__/model-metadata.test.ts: the table serves both providers; every declared effort is a known ThinkingLevel; a model with no declared level stays uncovered.

  • packages/runtime/src/__tests__/model-factory-thinking.test.ts: selectable efforts surface; automatic-reasoning models expose nothing; an unknown model exposes and sends nothing; the chosen level — including max — is forwarded verbatim.
  • Caveat

    The ported table was verified against command-code@1.53.0; this branch pins command-code@1.54.0, and the CLI bundle was not re-read for 1.54.0. The header comment records the source and version so a future re-sync can re-read the pinned bundle. A wrong effort word is refused by the wire or ignored by the model, so it fails loudly rather than mis-billing.

    Diff: 404 lines (+303 / -101) across 5 files Reviewer: M4n5ter Review duration: 40m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 404 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.359
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5484"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.8% (MEDIUM) · Higher = larger blast radius
    44.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.7% · Safe to merge
    17.7%
    Repository