Skip to content

fix: preserve provider route context metadata - #1741

Merged
kevincodex1 merged 5 commits into
Twigpine:mainfrom
jatmn:issue-1732
Jun 22, 2026
Merged

kevincodex1 merged 5 commits into
Twigpine:mainfrom
jatmn:issue-1732

Conversation

@jatmn

@jatmn jatmn commented Jun 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Bug: OpenClaude incorrectly detects the model context window size on some providers #1732 by preserving active provider-profile route metadata during context limit resolution, so OpenAI-compatible gateways do not lose their configured provider/model identity before model limits are looked up.
  • Adds provider-scoped matching for gateway-prefixed model IDs, including composite suffixes such as accounts/fireworks/models/... and fireworks/models/..., so wrapped gateway paths resolve route-specific context/output limits before generic last-segment aliases. The shorter fireworks/models/... form is account-qualified internally before generic fallback matching.
  • Refreshes OpenCode Zen and OpenCode Go model metadata from the current gateway catalogs, regenerates integration artifacts, adds NVIDIA NIM DeepSeek V4 Pro fallback metadata, and adds the Gemini 3.1 Pro router alias.
  • Updates user-facing OpenCode model counts in README.md and docs/advanced-setup.md to match the refreshed catalog.
  • Adds regression coverage for provider-prefixed gateway models, active-profile route preservation, composite provider-path matching, and the user-facing max output token helper path.
  • Scopes OpenCode descriptor defaultModel names through providerModelMap, so OpenCode API model names resolve under OpenCode routes without hijacking generic vendor lookups.\n- Includes two validation hardening fixes found during the full local pass: Windows plugin hook display paths now normalize to forward slashes, and status redaction tests reset HOME/USERPROFILE deterministically.

Impact

  • user-facing impact: gateway and provider-profile users get more accurate context window and max output token detection for currently supported gateway models, especially when the selected model ID is provider-prefixed or routed through an OpenAI-compatible gateway.
  • developer/maintainer impact: OpenCode metadata is data-driven, easier to audit, and covered by provider/context regression tests; generated integration artifacts are in sync.

Testing

  • bun install
  • bun run build
  • bun run smoke
  • bun run check
  • bun run typecheck
  • bun run typecheck:type-tests
  • bun run test:provider
  • bun run test:provider-recommendation
  • bun run integrations:check
  • bun run security:pr-scan -- --base upstream/main
  • git diff --check
  • focused tests: bun test src/integrations/runtimeMetadata.test.ts --max-concurrency=1
  • full suite passed with 4634 pass, 0 fail, 11758 expect() calls.
  • follow-up validation after reviewer fixes: bun test src/utils/context.test.ts src/integrations/runtimeMetadata.test.ts src/integrations/gateways/opencode.test.ts --max-concurrency=1, bun run test:provider, bun run integrations:check, bun run typecheck, git diff --check.

Notes

  • provider/model path tested: OpenAI-compatible gateway/provider-profile context resolution, provider-prefixed OpenGateway/OpenCode-style model IDs, composite OpenRouter-wrapped Fireworks model IDs in both accounts/fireworks/models/... and fireworks/models/... forms, OpenCode Zen, OpenCode Go, NVIDIA NIM DeepSeek V4 Pro fallback metadata, and Gemini 3.1 Pro router alias metadata.
  • screenshots attached (if UI changed): not applicable; no UI, terminal presentation, or VS Code extension behavior was changed.
  • follow-up work or known limitations: none known.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added DeepSeek V4 Pro to the NVIDIA NIM gateway.
  • Improvements

    • Expanded OpenCode Zen model catalog to 48 (from 43).
    • Expanded OpenCode Go model catalog to 20 (from 13).
    • Improved Windows path formatting for hook source display.
  • Bug Fixes

    • Enhanced model discovery and runtime-limit/context resolution for provider-scoped identifiers and active provider profile configuration.
  • Documentation

    • Updated supported model counts in the README and advanced setup guide.

@coderabbitai

coderabbitai Bot commented Jun 21, 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: 5b716980-4c88-451d-bd20-75356484dff4

📥 Commits

Reviewing files that changed from the base of the PR and between 29b225b and cfe308f.

📒 Files selected for processing (2)
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (13)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/integrations/gateways/opencode.test.ts
src/integrations/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Check existing provider implementations before adding a new pattern

Files:

  • src/integrations/gateways/opencode.test.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/gateways/opencode.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/utils/context.test.ts
🔇 Additional comments (2)
src/integrations/gateways/opencode.test.ts (1)

287-292: LGTM!

Also applies to: 327-328, 471-483

src/utils/context.test.ts (1)

23-26: LGTM!

Also applies to: 41-42, 92-103, 501-530


📝 Walkthrough

Walkthrough

Adds DeepSeek V4 Pro to NVIDIA NIM gateway; refactors OpenCode Zen and Go model/gateway definitions into spec-driven generators (expanding catalogs to 48 and 20 models); improves runtime metadata resolution to correctly match provider-prefixed composite model identifiers; threads active provider profile context into context window and max output token lookups.

Changes

Model Catalog Expansion and Spec-Driven Refactor

Layer / File(s) Summary
OpenCode model spec type, generator, and data arrays
src/integrations/models/opencode.ts
Introduces OpenCodeModelSpec and openCodeModel() helper computing classification/capabilities from spec flags; replaces 1000+ lines of hardcoded defineModel calls with zenModels and goModels spec arrays mapped through the generator.
OpenCode Zen and Go gateway catalog refactor
src/integrations/gateways/opencode.ts, src/integrations/gateways/opencode-go.ts
Introduces OpenCodeCatalogSpec/OpenCodeGoCatalogSpec types and catalogEntry() factories; switches catalog.models from inline hardcoded arrays to spec-mapped generation; conditionally injects transportOverrides.openaiShim.endpointPath per model; updates preset descriptions to 48/20 models.
NVIDIA NIM DeepSeek V4 Pro registration
src/integrations/gateways/nvidia-nim.ts
Adds nvidia-deepseek-v4-pro entry (apiName: deepseek-ai/deepseek-v4-pro, modelDescriptorId: deepseek-v4-pro) to the NVIDIA NIM gateway catalog.
Provider-scoped API name segment matching
src/integrations/runtimeMetadata.ts
Adds getProviderScopedModelSegments() extracting sub-path segments and accounts/... variants from composite API names; extends findModelDescriptorForApiName with a segment-based candidate pass and normalized inclusion matching to resolve provider/model identifiers correctly.
Active-profile-provider threading
src/utils/context.ts
Adds getAppliedActiveProfileProvider() helper with two env constants; threads derived activeProfileProvider into resolveActiveRouteIdFromEnv and resolveModelRuntimeLimits at all getContextWindowForModel, getModelMaxOutputTokens, and warnUnknownIntegrationRuntimeLimits call sites.
Tests, catalog assertions, and runtime metadata validation
src/integrations/gateways/opencode.test.ts, src/integrations/runtimeMetadata.test.ts
Updates catalog count assertions (43→48, 13→20); adds model metadata assertions for context window/max output token preservation; adds resolveModelRuntimeLimits tests for provider-profile routing precedence, composite model paths, and NIM/Gemini models; extends Go messages-endpoint auth test with new model IDs.
Context resolution tests and environment setup
src/utils/context.test.ts
Adds provider-profile env vars to environment tracking/cleanup; captures, clears, and restores CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED/CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED_ID; adds new tests validating context window and max output token resolution for google/gemini-3.1-pro and deepseek-ai/deepseek-v4-pro under integration metadata.
Path normalization, test infrastructure, and documentation
src/utils/hooks/hooksSettings.ts, src/utils/statusRedaction.test.ts, README.md, docs/advanced-setup.md
Normalizes Windows backslashes to forward slashes in plugin hook display paths; restores HOME/USERPROFILE environment variables in redactPathForStatus test setup; updates README and docs model count references (43→48, 13→20).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Gitlawb/openclaude#1659: Modifies src/utils/context.ts runtime limit and max-output-token resolution flow, directly overlapping with the getModelMaxOutputTokens/getContextWindowForModel call sites changed here.
  • Gitlawb/openclaude#1717: The main PR's refactor of src/integrations/gateways/opencode-go.ts introduces generator-based transportOverrides.openaiShim injection (including defaultAuthHeader when endpointPath is set), which directly overlaps with that PR's /messages models authentication fix that relies on openaiShim's defaultAuthHeader/endpointPath.

Suggested labels

enhancement, new: provider/gateway

Suggested reviewers

  • kevincodex1
🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Risk Surface Disclosed ⚠️ Warning PR touches provider routing and startup/config-home behavior (activeProfileProvider, CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED flags, provider profile reading), but the review does not call out the... Add explicit risk surface analysis to PR description covering: (1) provider routing changes to resolveActiveRouteIdFromEnv, (2) provider profile environment flag handling, (3) whether these introduce authentication/routing blockers, (4)...
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title 'fix: preserve provider route context metadata' is concise, descriptive, and directly reflects the core change: preserving provider-profile metadata during context limit resolution.
Description check ✅ Passed Description comprehensively covers all template sections: clear summary of what changed and why, detailed impact statements, comprehensive testing evidence, and thorough notes on provider paths tested.
Linked Issues check ✅ Passed All coding requirements from #1732 are met: context window detection is fixed for NVIDIA NIM (DeepSeek V4 Pro), OpenCode Zen/Go (Kimi K2.6, free models), and 9router (Gemini 3.1 Pro) through provider-scoped metadata preservation and matching.
Out of Scope Changes check ✅ Passed All changes are directly scoped to #1732 objectives: metadata fixes for listed providers, integration artifact regeneration, provider-scoped matching implementation, and supporting test coverage with only minor validation fixes (path normalization, environment setup).
No Hidden Policy Change ✅ Passed No hidden policy changes found. PR adds optional, gated environment variables for provider-profile routing (backward-compatible), refines model matching logic (routing enhancement only), and refres...

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

@jatmn jatmn self-assigned this Jun 21, 2026
@jatmn jatmn added the bug Something isn't working label Jun 21, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/integrations/models/opencode.ts`:
- Around line 21-41: In the openCodeModel function, the defaultModel field is
incorrectly assigned to spec.id instead of spec.defaultModel. The
OpenCodeModelSpec type intentionally defines these as separate fields with
different values (e.g., id is 'opencode-claude-fable-5' while defaultModel is
'claude-fable-5'). This causes model matching to fail in
matchesCatalogEntryModel since it compares the defaultModel value against the
incoming modelApiName. Change line 32 in the defineModel call to assign
defaultModel: spec.defaultModel instead of defaultModel: spec.id.

In `@src/integrations/runtimeMetadata.test.ts`:
- Around line 218-240: The test function 'matches provider-prefixed model ids to
built-in runtime limits' currently only validates unprefixed model identifiers
like 'google/gemini-3.1-pro' and 'moonshotai/kimi-k2.6', but does not test the
provider-prefixed forms that the change actually targets (such as those with an
additional prefix like 'opencode/google/gemini-3.1-pro'). Add additional
expect() assertions in this test that call resolveModelRuntimeLimits with the
fully prefixed provider/model paths and verify that they resolve to the correct
contextWindow limits, ensuring the regression test covers the exact
gateway-prefixed model path this change was designed to handle.

In `@src/integrations/runtimeMetadata.ts`:
- Around line 280-286: The getProviderScopedModelSegments function only returns
individual segments after removing the provider prefix, but does not include the
composite tail path. For a model ID like opencode/google/gemini-3.1-pro, it
returns only ['google', 'gemini-3.1-pro'] but misses 'google/gemini-3.1-pro'.
Modify the function to also include the composite path by joining the remaining
segments back together with '/' and adding it to the returned array. Apply the
same fix to the similar function at line 335-348 that handles the same
provider-scoped model matching logic.

In `@src/utils/context.test.ts`:
- Around line 483-493: The test for prefixed Gemini 3.1 Pro router model is
incomplete. In addition to the existing assertions for getContextWindowForModel
and getModelMaxOutputTokens, add an assertion that calls
getMaxOutputTokensForModel with the model identifier 'google/gemini-3.1-pro' and
verifies it returns the expected capped output token value. This wrapper
function represents the user-facing API and should be tested consistently with
other model test cases in the suite. Apply the same fix to the other new model
case mentioned at lines 495-506.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 85ca6144-d0f7-4940-bace-b8ff64ee373d

📥 Commits

Reviewing files that changed from the base of the PR and between b581bd9 and 8d0d2ab.

⛔ Files ignored due to path filters (1)
  • src/integrations/generated/integrationArtifacts.generated.ts is excluded by !**/generated/**, !src/integrations/generated/**
📒 Files selected for processing (12)
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/gemini.ts
  • src/integrations/models/opencode.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.test.ts
  • src/utils/context.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (13)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
src/integrations/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Check existing provider implementations before adding a new pattern

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/models/opencode.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/runtimeMetadata.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/utils/context.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/utils/context.ts
🔇 Additional comments (9)
src/integrations/gateways/nvidia-nim.ts (1)

95-100: LGTM!

src/integrations/models/gemini.ts (1)

43-43: LGTM!

src/utils/context.ts (1)

14-14: LGTM!

Also applies to: 46-47, 77-102, 121-124, 165-168, 269-272

src/integrations/gateways/opencode.test.ts (1)

287-292: LGTM!

src/utils/hooks/hooksSettings.ts (1)

179-179: LGTM!

src/utils/statusRedaction.test.ts (1)

99-100: LGTM!

src/integrations/models/opencode.ts (1)

3-8: LGTM!

Also applies to: 43-92, 94-115, 117-117

src/integrations/gateways/opencode.ts (1)

3-70: LGTM!

Also applies to: 92-92, 107-107

src/integrations/gateways/opencode-go.ts (1)

3-44: LGTM!

Also applies to: 74-80

Comment thread src/integrations/models/opencode.ts
Comment thread src/integrations/runtimeMetadata.test.ts
Comment thread src/integrations/runtimeMetadata.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/integrations/runtimeMetadata.test.ts (1)

240-262: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add a truly provider-prefixed assertion in this regression test.

Line 240 labels this as provider-prefixed coverage, but both current inputs are unprefixed. That leaves the new prefix-segment matching path under-tested.

Minimal extension
 it('matches provider-prefixed model ids to built-in runtime limits', () => {
+  expect(
+    resolveModelRuntimeLimits({
+      model: 'opencode/google/gemini-3.1-pro',
+      activeProfileProvider: 'opencode',
+      processEnv: {
+        CLAUDE_CODE_USE_OPENAI: '1',
+        OPENAI_BASE_URL: 'https://opencode.ai/zen/v1',
+      },
+    }).contextWindow,
+  ).toBe(1_048_576)
+
   expect(
     resolveModelRuntimeLimits({
       model: 'google/gemini-3.1-pro',
       activeProfileProvider: 'custom',

As per coding guidelines, “Test the exact provider/model path you changed when possible” and “Block when risky runtime changes lack focused regression coverage...”.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/integrations/runtimeMetadata.test.ts` around lines 240 - 262, The test
function labeled 'matches provider-prefixed model ids to built-in runtime
limits' does not actually test the prefix-matching scenario it claims to cover.
While the model IDs contain prefixes (google/, moonshotai/), the
activeProfileProvider values (custom, nvidia-nim) do not match those prefixes,
so the prefix-segment matching logic remains untested. Add at least one
additional expect block to the test where the activeProfileProvider value
matches the provider prefix in the model ID (for example, model with a google/
prefix paired with activeProfileProvider: 'google') to properly exercise the
provider-prefixed matching path in the resolveModelRuntimeLimits function.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/integrations/runtimeMetadata.test.ts`:
- Around line 240-262: The test function labeled 'matches provider-prefixed
model ids to built-in runtime limits' does not actually test the prefix-matching
scenario it claims to cover. While the model IDs contain prefixes (google/,
moonshotai/), the activeProfileProvider values (custom, nvidia-nim) do not match
those prefixes, so the prefix-segment matching logic remains untested. Add at
least one additional expect block to the test where the activeProfileProvider
value matches the provider prefix in the model ID (for example, model with a
google/ prefix paired with activeProfileProvider: 'google') to properly exercise
the provider-prefixed matching path in the resolveModelRuntimeLimits function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: df71b7aa-7ab3-4676-84ea-f1f56d896da6

📥 Commits

Reviewing files that changed from the base of the PR and between 8d0d2ab and 9b8e323.

⛔ Files ignored due to path filters (1)
  • src/integrations/generated/integrationArtifacts.generated.ts is excluded by !**/generated/**, !src/integrations/generated/**
📒 Files selected for processing (14)
  • README.md
  • docs/advanced-setup.md
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/gemini.ts
  • src/integrations/models/opencode.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.test.ts
  • src/utils/context.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (15)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
src/integrations/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Check existing provider implementations before adding a new pattern

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/integrations/gateways/opencode.test.ts
  • docs/advanced-setup.md
  • README.md
  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/runtimeMetadata.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/runtimeMetadata.test.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/integrations/gateways/opencode.test.ts
  • docs/advanced-setup.md
  • README.md
  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/runtimeMetadata.test.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/integrations/gateways/opencode.test.ts
  • docs/advanced-setup.md
  • README.md
  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
docs/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update docs when setup, commands, or user-facing behavior changes

Files:

  • docs/advanced-setup.md
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • docs/advanced-setup.md
  • README.md
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/utils/statusRedaction.test.ts
  • src/utils/context.ts
🔇 Additional comments (14)
src/integrations/gateways/nvidia-nim.ts (1)

95-100: LGTM!

src/integrations/models/gemini.ts (1)

43-43: LGTM!

src/integrations/models/opencode.ts (1)

32-32: Blocking: defaultModel is wired to the wrong field.

Line 32 should use spec.defaultModel, not spec.id; otherwise provider/model alias matching can resolve the wrong descriptor for OpenCode routes.

Suggested fix
-    defaultModel: spec.id,
+    defaultModel: spec.defaultModel,
src/integrations/gateways/opencode.ts (1)

3-19: LGTM!

Also applies to: 21-70, 92-92, 107-107

src/integrations/gateways/opencode-go.ts (1)

3-44: LGTM!

Also applies to: 74-80

src/integrations/runtimeMetadata.ts (1)

280-303: LGTM!

Also applies to: 338-351

src/integrations/runtimeMetadata.test.ts (1)

85-120: LGTM!

README.md (1)

206-207: LGTM!

docs/advanced-setup.md (1)

200-201: LGTM!

Also applies to: 215-216

src/utils/context.ts (1)

14-14: LGTM!

Also applies to: 46-47, 77-102, 121-124, 165-168, 269-272

src/integrations/gateways/opencode.test.ts (1)

285-288: LGTM!

Also applies to: 290-292

src/utils/context.test.ts (1)

483-493: LGTM!

Also applies to: 495-506

src/utils/hooks/hooksSettings.ts (1)

179-179: LGTM!

src/utils/statusRedaction.test.ts (1)

99-100: LGTM!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/integrations/models/opencode.ts (1)

21-33: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Use spec.defaultModel for generated defaultModel.

Line 32 assigns defaultModel: spec.id, which breaks runtime matching for provider model API names (e.g., claude-fable-5 won’t match descriptor default model opencode-claude-fable-5).

Suggested fix
-    defaultModel: spec.id,
+    defaultModel: spec.defaultModel,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/integrations/models/opencode.ts` around lines 21 - 33, In the
openCodeModel function, change the defaultModel property assignment from spec.id
to spec.defaultModel. The current implementation incorrectly assigns the raw ID
(e.g., claude-fable-5) which won't match the generated descriptor model ID
(e.g., opencode-claude-fable-5), breaking runtime model matching. Replace
spec.id with spec.defaultModel on the defaultModel property assignment.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/integrations/models/opencode.ts`:
- Around line 21-33: In the openCodeModel function, change the defaultModel
property assignment from spec.id to spec.defaultModel. The current
implementation incorrectly assigns the raw ID (e.g., claude-fable-5) which won't
match the generated descriptor model ID (e.g., opencode-claude-fable-5),
breaking runtime model matching. Replace spec.id with spec.defaultModel on the
defaultModel property assignment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e36000a0-6f8a-4f98-bdd0-03b2a0ff8b07

📥 Commits

Reviewing files that changed from the base of the PR and between 9b8e323 and 86128dc.

⛔ Files ignored due to path filters (1)
  • src/integrations/generated/integrationArtifacts.generated.ts is excluded by !**/generated/**, !src/integrations/generated/**
📒 Files selected for processing (14)
  • README.md
  • docs/advanced-setup.md
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/gemini.ts
  • src/integrations/models/opencode.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.test.ts
  • src/utils/context.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (15)
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • README.md
  • docs/advanced-setup.md
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/utils/hooks/hooksSettings.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • README.md
  • docs/advanced-setup.md
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/utils/hooks/hooksSettings.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • README.md
  • docs/advanced-setup.md
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • README.md
  • docs/advanced-setup.md
  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/utils/hooks/hooksSettings.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
docs/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update docs when setup, commands, or user-facing behavior changes

Files:

  • docs/advanced-setup.md
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/utils/hooks/hooksSettings.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/models/gemini.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
src/integrations/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Check existing provider implementations before adding a new pattern

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/models/gemini.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/utils/hooks/hooksSettings.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/models/gemini.ts
  • src/utils/hooks/hooksSettings.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/models/gemini.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/utils/statusRedaction.test.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/context.test.ts
  • src/utils/context.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.test.ts
🔇 Additional comments (11)
src/integrations/gateways/nvidia-nim.ts (1)

95-100: LGTM!

src/integrations/models/gemini.ts (1)

43-43: LGTM!

src/integrations/runtimeMetadata.ts (1)

280-293: LGTM!

Also applies to: 304-307, 342-356

src/utils/context.ts (1)

14-14: LGTM!

Also applies to: 46-47, 77-102, 121-124, 165-168, 269-272

src/utils/context.test.ts (1)

483-493: Wrapper-path coverage is still missing for these two new cases.

These tests validate getModelMaxOutputTokens, but still skip getMaxOutputTokensForModel, the user-facing capped path used elsewhere in this suite.

Also applies to: 495-506

src/integrations/gateways/opencode.test.ts (1)

285-292: LGTM!

src/integrations/runtimeMetadata.test.ts (1)

85-130: LGTM!

Also applies to: 250-272

src/utils/hooks/hooksSettings.ts (1)

179-179: LGTM!

src/utils/statusRedaction.test.ts (1)

99-100: LGTM!

README.md (1)

206-207: LGTM!

docs/advanced-setup.md (1)

200-200: LGTM!

Also applies to: 215-215

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 22, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 22, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 22, 2026
@jatmn
jatmn marked this pull request as ready for review June 22, 2026 00:40
@kevincodex1

Copy link
Copy Markdown
Member

please rebase bro and fix conflcits

jatmn added 4 commits June 21, 2026 20:20
Resolve issue Twigpine#1732 by keeping active provider-profile routes attached during context limit resolution and making gateway-prefixed model IDs resolve against provider-scoped metadata instead of falling through to global aliases.

Preserve composite provider-path suffixes such as accounts/fireworks/models/... and fireworks/models/... before generic last-segment matching, so wrapped gateway IDs resolve Fireworks-specific limits instead of generic descriptors.

Refresh OpenCode Zen and OpenCode Go catalog metadata, including route-specific context/output limits, regenerate integration artifacts, add DeepSeek V4 Pro on NVIDIA NIM, add the Gemini 3.1 Pro router alias, and update user-facing OpenCode model counts.

Scope OpenCode descriptor default model names to OpenCode routes via providerModelMap so unprefixed vendor lookups are not hijacked by gateway descriptors. Add wrapper-path assertions for the user-facing max output token helper.

Add regression coverage for provider-prefixed gateway models, active-profile route preservation, account-qualified composite paths, and OpenRouter-wrapped fireworks/models/... paths. Harden Windows/full-suite validation by normalizing plugin hook display paths and resetting status-redaction HOME/USERPROFILE state.

Validation: bun install; bun run build; bun run smoke; bun run typecheck; bun run typecheck:type-tests; bun run check (4634 pass, 0 fail); bun run test:provider (857 pass, 0 fail); bun run test:provider-recommendation (91 pass, 0 fail); bun run integrations:check; bun run security:pr-scan -- --base upstream/main; git diff --check. Follow-up validation: bun test src/integrations/runtimeMetadata.test.ts --max-concurrency=1; bun test src/utils/context.test.ts src/integrations/runtimeMetadata.test.ts src/integrations/gateways/opencode.test.ts --max-concurrency=1; bun run test:provider; bun run integrations:check; bun run typecheck; git diff --check.

# Conflicts:
#	src/integrations/gateways/opencode-go.ts
#	src/integrations/models/opencode.ts
Refresh OpenCode Zen and Go descriptor context/output limits against the live OpenCode model lists and Models.dev provider metadata.

Add a regression assertion for provider-specific OpenCode limits so route-scoped metadata does not fall back to generic model budgets.
Keep the canonical Gemini 3.1 Pro descriptor and rely on provider-prefixed suffix matching for google/gemini-3.1-pro runtime lookups.

Also separate the OpenCode limit regression test from the following assertion for readability.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/integrations/gateways/opencode-go.ts`:
- Around line 41-44: The new Qwen3.7 models (qwen3.7-max and qwen3.7-plus) with
endpointPath set to '/messages' in the opencode-go.ts configuration lack
corresponding test coverage. Update the test file
src/integrations/gateways/opencode.test.ts to add regression test cases for the
provider IDs opencode-go-qwen3.7-max and opencode-go-qwen3.7-plus, ensuring that
auth/header handling and endpoint routing to '/messages' are properly validated
for these new models.

In `@src/utils/context.test.ts`:
- Around line 483-494: The test prefixed Gemini 3.1 Pro router model uses
integration metadata is sensitive to environment state set outside the test
process. To ensure proper test isolation, add deletion of the
CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED environment variable and its applied-id
variant (CLAUDE_CODE_PROVIDER_PROFILE_ENV_APPLIED_ID) alongside the existing
delete statements for CLAUDE_CODE_MAX_OUTPUT_TOKENS and OPENAI_MODEL. Apply the
same fix to the related test in the Also applies to range (lines 496-508) to
maintain consistency and ensure both tests are properly isolated from external
profile environment flags.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b56bce7a-ad08-4a32-94c3-4a253fe64fa4

📥 Commits

Reviewing files that changed from the base of the PR and between f4321b4 and 29b225b.

⛔ Files ignored due to path filters (1)
  • src/integrations/generated/integrationArtifacts.generated.ts is excluded by !**/generated/**, !src/integrations/generated/**
📒 Files selected for processing (13)
  • README.md
  • docs/advanced-setup.md
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/models/opencode.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/runtimeMetadata.ts
  • src/utils/context.test.ts
  • src/utils/context.ts
  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (15)
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports

Files:

  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
{src/services/**/*.ts,src/utils/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Use execa for child processes

Files:

  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/utils/context.test.ts
  • src/utils/context.ts
**/*.{ts,tsx,js,jsx,py,json,md}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow the existing code style in the touched files

Files:

  • src/utils/hooks/hooksSettings.ts
  • README.md
  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • docs/advanced-setup.md
  • src/integrations/gateways/opencode.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Keep comments useful and concise

Files:

  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Follow TypeScript strict mode and type safety practices by running typecheck before submitting

Files:

  • src/utils/hooks/hooksSettings.ts
  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/utils/hooks/hooksSettings.ts
  • README.md
  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • docs/advanced-setup.md
  • src/integrations/gateways/opencode.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.
  • Python exists for legacy/local-provider helper code. Do not add new Python code or expand Python-based features unless a maintainer explicitly approves that direction.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • `src/integration...

Files:

  • src/utils/hooks/hooksSettings.ts
  • README.md
  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • docs/advanced-setup.md
  • src/integrations/gateways/opencode.ts
  • src/utils/context.test.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
  • src/utils/context.ts
{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}

⚙️ CodeRabbit configuration file

{README.md,CONTRIBUTING.md,docs/**,.github/pull_request_template.md}: Review docs for accuracy against current code behavior. Flag security or provider claims that overpromise, stale install commands, missing setup caveats, and instructions that could push users toward unsafe credential handling. Keep purely wording-level suggestions non-blocking.

Files:

  • README.md
  • docs/advanced-setup.md
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.test.ts
**/*.test.{ts,tsx,js}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Test the exact provider/model path you changed when possible

Files:

  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/utils/statusRedaction.test.ts
  • src/integrations/gateways/opencode.test.ts
  • src/utils/context.test.ts
  • src/integrations/runtimeMetadata.test.ts
{src/integrations/**/*.ts,src/services/**/*.ts}

📄 CodeRabbit inference engine (AGENTS.md)

Test the exact provider/model path you changed when possible for provider modifications

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
src/integrations/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Check existing provider implementations before adding a new pattern

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}

⚙️ CodeRabbit configuration file

{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}: Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny. Block on silent default changes, hidden fallback expansion, credential reuse mistakes, hardcoded provider assumptions, or new network reach that is not intentional and documented.

Files:

  • src/integrations/gateways/nvidia-nim.ts
  • src/integrations/gateways/opencode.test.ts
  • src/integrations/gateways/opencode.ts
  • src/integrations/gateways/opencode-go.ts
  • src/integrations/runtimeMetadata.ts
  • src/integrations/runtimeMetadata.test.ts
  • src/integrations/models/opencode.ts
docs/**/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Update docs when setup, commands, or user-facing behavior changes

Files:

  • docs/advanced-setup.md
🔇 Additional comments (11)
src/integrations/gateways/nvidia-nim.ts (1)

95-100: Catalog entry correctly references existing model descriptor.

The deepseek-v4-pro model descriptor is defined in src/integrations/models/deepseek.ts and properly registered. The nvidia-nim gateway catalog entry at lines 95-100 correctly references it via modelDescriptorId: 'deepseek-v4-pro'. Registry validation will pass.

src/integrations/models/opencode.ts (1)

3-45: LGTM!

Also applies to: 47-96, 98-119, 121-121

src/integrations/gateways/opencode.ts (1)

3-71: LGTM!

Also applies to: 92-92, 107-107

src/integrations/runtimeMetadata.ts (1)

280-293: LGTM!

Also applies to: 304-322, 345-358

src/integrations/runtimeMetadata.test.ts (1)

85-130: LGTM!

Also applies to: 250-272

README.md (1)

206-207: LGTM!

docs/advanced-setup.md (1)

200-200: LGTM!

Also applies to: 215-215

src/utils/context.ts (1)

14-14: LGTM!

Also applies to: 46-47, 77-102, 121-124, 165-168, 269-272

src/integrations/gateways/opencode.test.ts (1)

287-292: LGTM!

Also applies to: 321-341, 469-480

src/utils/hooks/hooksSettings.ts (1)

179-179: LGTM!

src/utils/statusRedaction.test.ts (1)

99-100: LGTM!

Comment thread src/integrations/gateways/opencode-go.ts
Comment thread src/utils/context.test.ts
@jatmn

jatmn commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

@kevincodex1

@kevincodex1 kevincodex1 left a comment

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.

LGTM

@kevincodex1 kevincodex1 left a comment

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.

LGTM

@kevincodex1
kevincodex1 merged commit 5625f42 into Twigpine:main Jun 22, 2026
4 checks passed
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.

Bug: OpenClaude incorrectly detects the model context window size on some providers

2 participants