fix: preserve provider route context metadata - #1741
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (13)src/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
{src/integrations/**/*.ts,src/services/**/*.ts}📄 CodeRabbit inference engine (AGENTS.md)
Files:
src/integrations/**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx,js,jsx,py,json,md}📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
**/*.test.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
**/*.test.{ts,tsx,js}📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
**/*.{ts,tsx,js,jsx,py}📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (CONTRIBUTING.md)
Files:
**/*⚙️ CodeRabbit configuration file
Files:
{src/services/api/**,src/integrations/**,src/utils/model/**,src/utils/provider*.ts,src/commands/provider/**}⚙️ CodeRabbit configuration file
Files:
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}⚙️ CodeRabbit configuration file
Files:
**⚙️ CodeRabbit configuration file
Files:
{src/services/**/*.ts,src/utils/**/*.ts}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughAdds 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. ChangesModel Catalog Expansion and Spec-Driven Refactor
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
src/integrations/generated/integrationArtifacts.generated.tsis excluded by!**/generated/**,!src/integrations/generated/**
📒 Files selected for processing (12)
src/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/integrations/models/gemini.tssrc/integrations/models/opencode.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/runtimeMetadata.tssrc/utils/context.test.tssrc/utils/context.tssrc/utils/hooks/hooksSettings.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/models/opencode.ts
**
⚙️ CodeRabbit configuration file
**: # AGENTS.md - AI Agent Coding GuideThis 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:
chalkfor terminal color.commanderfor CLI argument parsing.execafor 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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/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.tssrc/utils/context.test.tssrc/utils/statusRedaction.test.tssrc/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.tssrc/utils/context.test.tssrc/utils/statusRedaction.test.tssrc/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.tssrc/utils/context.test.tssrc/utils/statusRedaction.test.tssrc/integrations/runtimeMetadata.test.ts
{src/services/**/*.ts,src/utils/**/*.ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use
execafor child processes
Files:
src/utils/context.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/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
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/integrations/runtimeMetadata.test.ts (1)
240-262:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd 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
⛔ Files ignored due to path filters (1)
src/integrations/generated/integrationArtifacts.generated.tsis excluded by!**/generated/**,!src/integrations/generated/**
📒 Files selected for processing (14)
README.mddocs/advanced-setup.mdsrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/integrations/models/gemini.tssrc/integrations/models/opencode.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/runtimeMetadata.tssrc/utils/context.test.tssrc/utils/context.tssrc/utils/hooks/hooksSettings.tssrc/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.tssrc/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/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.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/gateways/opencode.tssrc/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.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/gateways/opencode.tssrc/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.tsdocs/advanced-setup.mdREADME.mdsrc/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/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.tssrc/utils/context.test.tssrc/utils/statusRedaction.test.tssrc/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.tssrc/utils/context.test.tssrc/utils/statusRedaction.test.tssrc/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.tssrc/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/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.tssrc/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/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.tsdocs/advanced-setup.mdREADME.mdsrc/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/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.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/gateways/opencode.tssrc/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.tssrc/utils/context.test.tssrc/utils/statusRedaction.test.tssrc/integrations/runtimeMetadata.test.ts
**
⚙️ CodeRabbit configuration file
**: # AGENTS.md - AI Agent Coding GuideThis 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:
chalkfor terminal color.commanderfor CLI argument parsing.execafor 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.tsdocs/advanced-setup.mdREADME.mdsrc/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/utils/context.tssrc/integrations/gateways/opencode.tssrc/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.mdREADME.md
{src/services/**/*.ts,src/utils/**/*.ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use
execafor child processes
Files:
src/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/utils/statusRedaction.test.tssrc/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:defaultModelis wired to the wrong field.Line 32 should use
spec.defaultModel, notspec.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!
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/integrations/models/opencode.ts (1)
21-33:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winUse
spec.defaultModelfor generateddefaultModel.Line 32 assigns
defaultModel: spec.id, which breaks runtime matching for provider model API names (e.g.,claude-fable-5won’t match descriptor default modelopencode-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
⛔ Files ignored due to path filters (1)
src/integrations/generated/integrationArtifacts.generated.tsis excluded by!**/generated/**,!src/integrations/generated/**
📒 Files selected for processing (14)
README.mddocs/advanced-setup.mdsrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/integrations/models/gemini.tssrc/integrations/models/opencode.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/runtimeMetadata.tssrc/utils/context.test.tssrc/utils/context.tssrc/utils/hooks/hooksSettings.tssrc/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.mddocs/advanced-setup.mdsrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/utils/hooks/hooksSettings.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.mddocs/advanced-setup.mdsrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/utils/hooks/hooksSettings.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.mddocs/advanced-setup.md
**
⚙️ CodeRabbit configuration file
**: # AGENTS.md - AI Agent Coding GuideThis 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:
chalkfor terminal color.commanderfor CLI argument parsing.execafor 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.mddocs/advanced-setup.mdsrc/integrations/gateways/nvidia-nim.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/utils/hooks/hooksSettings.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/utils/hooks/hooksSettings.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.tssrc/integrations/models/gemini.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/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.tssrc/integrations/models/gemini.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/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.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/utils/hooks/hooksSettings.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.tssrc/utils/statusRedaction.test.tssrc/integrations/models/gemini.tssrc/utils/hooks/hooksSettings.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.tssrc/integrations/models/gemini.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode.test.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.ts
{src/services/**/*.ts,src/utils/**/*.ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use
execafor child processes
Files:
src/utils/statusRedaction.test.tssrc/utils/hooks/hooksSettings.tssrc/utils/context.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/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 skipgetMaxOutputTokensForModel, 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
|
please rebase bro and fix conflcits |
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.
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
src/integrations/generated/integrationArtifacts.generated.tsis excluded by!**/generated/**,!src/integrations/generated/**
📒 Files selected for processing (13)
README.mddocs/advanced-setup.mdsrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode-go.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/integrations/models/opencode.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/runtimeMetadata.tssrc/utils/context.test.tssrc/utils/context.tssrc/utils/hooks/hooksSettings.tssrc/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.tssrc/utils/statusRedaction.test.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/utils/context.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/utils/context.ts
{src/services/**/*.ts,src/utils/**/*.ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use
execafor child processes
Files:
src/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/utils/context.test.tssrc/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.tsREADME.mdsrc/utils/statusRedaction.test.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode.test.tsdocs/advanced-setup.mdsrc/integrations/gateways/opencode.tssrc/utils/context.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/utils/context.ts
**/*.{ts,tsx,js,jsx,py}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Keep comments useful and concise
Files:
src/utils/hooks/hooksSettings.tssrc/utils/statusRedaction.test.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/utils/context.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.tssrc/utils/statusRedaction.test.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/utils/context.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.tsREADME.mdsrc/utils/statusRedaction.test.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode.test.tsdocs/advanced-setup.mdsrc/integrations/gateways/opencode.tssrc/utils/context.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/utils/context.ts
**
⚙️ CodeRabbit configuration file
**: # AGENTS.md - AI Agent Coding GuideThis 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:
chalkfor terminal color.commanderfor CLI argument parsing.execafor 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.tsREADME.mdsrc/utils/statusRedaction.test.tssrc/integrations/gateways/nvidia-nim.tssrc/integrations/gateways/opencode.test.tsdocs/advanced-setup.mdsrc/integrations/gateways/opencode.tssrc/utils/context.test.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/integrations/models/opencode.tssrc/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.mddocs/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/utils/context.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/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.tssrc/integrations/gateways/opencode.test.tssrc/integrations/gateways/opencode.tssrc/integrations/gateways/opencode-go.tssrc/integrations/runtimeMetadata.tssrc/integrations/runtimeMetadata.test.tssrc/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-promodel descriptor is defined insrc/integrations/models/deepseek.tsand properly registered. The nvidia-nim gateway catalog entry at lines 95-100 correctly references it viamodelDescriptorId: '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!
Summary
accounts/fireworks/models/...andfireworks/models/..., so wrapped gateway paths resolve route-specific context/output limits before generic last-segment aliases. The shorterfireworks/models/...form is account-qualified internally before generic fallback matching.README.mdanddocs/advanced-setup.mdto match the refreshed catalog.defaultModelnames throughproviderModelMap, 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 resetHOME/USERPROFILEdeterministically.Impact
Testing
bun installbun run buildbun run smokebun run checkbun run typecheckbun run typecheck:type-testsbun run test:providerbun run test:provider-recommendationbun run integrations:checkbun run security:pr-scan -- --base upstream/maingit diff --checkbun test src/integrations/runtimeMetadata.test.ts --max-concurrency=14634 pass, 0 fail, 11758 expect() calls.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
accounts/fireworks/models/...andfireworks/models/...forms, OpenCode Zen, OpenCode Go, NVIDIA NIM DeepSeek V4 Pro fallback metadata, and Gemini 3.1 Pro router alias metadata.Summary by CodeRabbit
Release Notes
New Features
Improvements
Bug Fixes
Documentation