feat(integrations): add ApiSmart OpenAI-compatible gateway provider - #2109
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 7 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughApiSmart is added as an OpenAI-compatible gateway with hybrid model discovery, curated fallbacks, canonical endpoint validation, API-key handling, route resolution, profile persistence, environment support, web configuration, tests, and documentation. Credential placeholder handling is standardized. ChangesApiSmart integration
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)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/utils/envFile.test.ts (1)
73-73: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winRestore
APISMART_MODELbetween tests.Line 73 restores
APISMART_API_KEYbut notAPISMART_MODEL.loadEnvFiledoes not overwrite an existing variable. A staleAPISMART_MODELcauses the assertion at line 287 to expect a value thatloadedcorrectly omits. Both reported smoke-and-tests checks fail at line 287.Proposed fix
'ATLAS_CLOUD_API_KEY', 'APISMART_API_KEY', + 'APISMART_MODEL', 'CLINE_API_KEY',Run
bun test ./src/utils/envFile.test.tsafter the fix.As per coding guidelines, “Add or update tests when behavior changes, and run the narrowest useful focused test checks.”
🤖 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/utils/envFile.test.ts` at line 73, Update the test cleanup around writeTempEnvFile and the corresponding environment restoration logic to preserve and restore APISMART_MODEL alongside APISMART_API_KEY. Ensure each test starts without stale APISMART_MODEL state so the loaded result and assertion remain accurate, then run the focused envFile test suite.Sources: Coding guidelines, Path instructions, Linters/SAST tools
🤖 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/routeMetadata.ts`:
- Around line 405-416: Update isApismartBaseUrl to require the parsed URL
protocol to be HTTPS and its port to be the default HTTPS port (or unspecified),
while preserving hostname matching and invalid-input rejection. Add regression
cases covering HTTP URLs and ApiSmart URLs with custom ports, ensuring neither
matches.
In `@src/utils/providerFlag.test.ts`:
- Line 43: Add APISMART_MODEL to the saved environment keys at
src/utils/providerFlag.test.ts:43-43, RESET_KEYS at
src/utils/providerFlag.test.ts:93-93, and ENV_KEYS at
scripts/system-check.test.ts:85-85 so tests isolate and restore the model
setting; then run bun test ./src/utils/providerFlag.test.ts.
In `@src/utils/providerFlag.ts`:
- Around line 586-605: Update the apismart branch around
applyOpenAIBaseUrlDefault so APISMART_API_KEY is mirrored to OPENAI_API_KEY only
when getConfiguredOpenAIBaseUrl() matches isApismartBaseUrl(); otherwise remove
or preserve the generic key without forwarding the ApiSmart credential. Add a
regression test in providerFlag.test.ts covering a stale custom OPENAI_BASE_URL,
then run the specified test file.
---
Outside diff comments:
In `@src/utils/envFile.test.ts`:
- Line 73: Update the test cleanup around writeTempEnvFile and the corresponding
environment restoration logic to preserve and restore APISMART_MODEL alongside
APISMART_API_KEY. Ensure each test starts without stale APISMART_MODEL state so
the loaded result and assertion remain accurate, then run the focused envFile
test suite.
🪄 Autofix
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
Run ID: 60d9ed00-aec4-4b74-9bd2-4c32cf36914c
⛔ Files ignored due to path filters (2)
src/integrations/generated/integrationArtifacts.generated.tsis excluded by!**/*.generated.*,!**/generated/**,!src/integrations/generated/**src/integrations/generated/integrationManifest.generated.tsis excluded by!**/*.generated.*,!**/generated/**,!src/integrations/generated/**
📒 Files selected for processing (19)
scripts/system-check.test.tssrc/integrations/compatibility.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/services/api/client.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerProfiles.tsweb/src/data/providers.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
src/integrations/compatibility.test.tssrc/services/api/openaiShim/requestExecutor.tsscripts/system-check.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/services/api/client.tsweb/src/data/providers.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
src/integrations/compatibility.test.tssrc/services/api/openaiShim/requestExecutor.tsscripts/system-check.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/services/api/client.tsweb/src/data/providers.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/integrations/compatibility.test.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/services/api/client.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
src/integrations/compatibility.test.tsscripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
src/integrations/compatibility.test.tssrc/services/api/openaiShim/requestExecutor.tsscripts/system-check.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/services/api/client.tsweb/src/data/providers.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
src/integrations/compatibility.test.tsscripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
src/integrations/compatibility.test.tssrc/services/api/openaiShim/requestExecutor.tsscripts/system-check.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/services/api/client.tsweb/src/data/providers.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.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/compatibility.test.tssrc/services/api/openaiShim/requestExecutor.tsscripts/system-check.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/services/api/client.tsweb/src/data/providers.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.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/compatibility.test.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerFlag.test.tssrc/services/api/client.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.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/compatibility.test.tsscripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerProfile.test.tssrc/utils/envFile.test.ts
src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.
Files:
src/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.ts
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}
⚙️ CodeRabbit configuration file
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}: Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety. Block on changes that can break Windows/macOS/Linux startup or publish unexpected artifacts.
Files:
scripts/system-check.test.ts
web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When changing the web application, run the web typecheck and build checks.
Files:
web/src/data/providers.ts
web/**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When changing files under
web/, runbun run web:typecheckandbun run web:build.
Files:
web/src/data/providers.ts
web/**
⚙️ CodeRabbit configuration file
web/**: Review browser extension changes for content-script isolation, message validation, cross-origin assumptions, permission surfaces, and failures that could leak prompts or credentials.
Files:
web/src/data/providers.ts
🪛 GitHub Check: smoke-and-tests (22)
src/utils/envFile.test.ts
[failure] 287-287: error: expect(received).toEqual(expected)
{
"APISMART_API_KEY": "apismart-key",
-
"APISMART_MODEL": "KIMI_K3",
} -
Expected - 1
-
Received + 0
at <anonymous> (/home/runner/work/openclaude/openclaude/src/utils/envFile.test.ts:287:20)
🪛 GitHub Check: smoke-and-tests (24.11.x)
src/utils/envFile.test.ts
[failure] 287-287: error: expect(received).toEqual(expected)
{
"APISMART_API_KEY": "apismart-key",
-
"APISMART_MODEL": "KIMI_K3",
} -
Expected - 1
-
Received + 0
at <anonymous> (/home/runner/work/openclaude/openclaude/src/utils/envFile.test.ts:287:20)
🔇 Additional comments (8)
src/integrations/gateways/apismart.ts (1)
1-227: LGTM!src/integrations/gateways/apismart.test.ts (1)
1-44: LGTM!src/integrations/compatibility.test.ts (1)
22-22: LGTM!web/src/data/providers.ts (1)
191-198: LGTM!src/services/api/providerConfig.ts (1)
27-29: LGTM!Also applies to: 935-1026
src/services/api/providerConfig.test.ts (1)
317-405: LGTM!src/services/api/openaiShim/requestExecutor.ts (1)
290-290: LGTM!src/utils/providerFlag.ts (1)
319-321: LGTM!
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/integrations/routeMetadata.ts (1)
648-648: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftPreserve matching competing base URLs.
When
APISMART_API_KEYandOPENAI_BASE_URL=https://api.aimlapi.com/v1are set, both env-only predicates reject the configuration. Resolution falls back toanthropicinstead ofaimlapi.Apply ApiSmart precedence only when no compatible competing base URL is configured. Add regression tests and run
bun test ./src/integrations/routeMetadata.test.ts.🤖 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/routeMetadata.ts` at line 648, Update the ApiSmart environment predicate near hasNonEmptyEnvValue so ApiSmart precedence applies only when no compatible competing base URL, including OPENAI_BASE_URL=https://api.aimlapi.com/v1, is configured; preserve matching aimlapi resolution instead of falling back to anthropic. Add regression coverage in routeMetadata tests for this environment combination and run the specified test file.Sources: Coding guidelines, Path instructions
🤖 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.
Outside diff comments:
In `@src/integrations/routeMetadata.ts`:
- Line 648: Update the ApiSmart environment predicate near hasNonEmptyEnvValue
so ApiSmart precedence applies only when no compatible competing base URL,
including OPENAI_BASE_URL=https://api.aimlapi.com/v1, is configured; preserve
matching aimlapi resolution instead of falling back to anthropic. Add regression
coverage in routeMetadata tests for this environment combination and run the
specified test file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: f821f68f-e60d-4c81-9366-385af5ca36c2
📒 Files selected for processing (6)
scripts/system-check.test.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/utils/envFile.test.tssrc/utils/providerFlag.test.tssrc/utils/providerFlag.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: smoke-and-tests (24.11.x)
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/integrations/routeMetadata.test.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/integrations/routeMetadata.test.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/integrations/routeMetadata.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/integrations/routeMetadata.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:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/integrations/routeMetadata.test.ts
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}
⚙️ CodeRabbit configuration file
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}: Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety. Block on changes that can break Windows/macOS/Linux startup or publish unexpected artifacts.
Files:
scripts/system-check.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:
scripts/system-check.test.tssrc/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.test.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/utils/providerFlag.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/integrations/routeMetadata.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/utils/providerFlag.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/integrations/routeMetadata.test.ts
🔇 Additional comments (6)
src/integrations/routeMetadata.ts (1)
405-422: LGTM!Also applies to: 816-816
src/utils/providerFlag.ts (1)
30-30: LGTM!Also applies to: 320-322, 587-611
src/integrations/routeMetadata.test.ts (1)
9-9: LGTM!Also applies to: 225-236, 321-334, 469-504
src/utils/envFile.test.ts (1)
21-22: LGTM!Also applies to: 279-294
src/utils/providerFlag.test.ts (1)
43-44: LGTM!Also applies to: 94-95, 988-996
scripts/system-check.test.ts (1)
85-86: LGTM!
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/routeMetadata.ts`:
- Around line 626-633: The route resolver must reject placeholder ApiSmart
credentials instead of treating any non-empty APISMART_API_KEY as usable. In
src/integrations/routeMetadata.ts:626-633, update hasCompetingApismartCredential
to use the existing placeholder-aware credential validation; in
src/integrations/routeMetadata.ts:812-827, require the same validation for
ApiSmart env-only intent; and in src/services/api/providerConfig.ts:935, enable
ApiSmart mode only when its dedicated credential is usable. Add placeholder-only
and placeholder-plus-valid-competing-route coverage in
src/integrations/routeMetadata.test.ts:471-477, plus verification in
src/services/api/providerConfig.test.ts:379-390 that a placeholder key does not
override valid OpenAI configuration, then run both specified test files.
In `@src/utils/providerProfiles.ts`:
- Around line 154-155: Update isApismartProfile to classify missing or blank
profile.baseUrl values as ApiSmart, while continuing to reject explicit
non-ApiSmart URLs. Preserve buildApismartProfileEnv’s default-endpoint behavior,
and add runtime and persisted-startup regression tests covering an ApiSmart
profile without baseUrl, including credential handling and startup discovery.
🪄 Autofix
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
Run ID: 1b999b50-acd3-4d9f-a65f-5b757026a0df
📒 Files selected for processing (10)
src/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerProfiles.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: smoke-and-tests (24.11.x)
- GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
src/utils/providerProfiles.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfile.tssrc/integrations/routeMetadata.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
src/utils/providerProfiles.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfile.tssrc/integrations/routeMetadata.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/utils/providerProfiles.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfile.tssrc/integrations/routeMetadata.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
src/utils/providerProfiles.test.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
src/utils/providerProfiles.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfile.tssrc/integrations/routeMetadata.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
src/utils/providerProfiles.test.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
src/utils/providerProfiles.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfile.tssrc/integrations/routeMetadata.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/providerProfiles.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfile.tssrc/integrations/routeMetadata.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/utils/providerProfiles.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfile.tssrc/integrations/routeMetadata.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/providerProfiles.test.tssrc/utils/providerProfile.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.ts
src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.
Files:
src/services/api/providerConfig.tssrc/services/api/providerConfig.test.ts
Add a hybrid-catalog ApiSmart gateway with dedicated APISMART_API_KEY/APISMART_MODEL env wiring, route detection, profile persistence, and regression tests so the provider works via --provider, env-only setup, and saved profiles.
cc818f9 to
be559ab
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/utils/providerProfiles.ts (2)
944-949: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueClarify the nested base-URL ternary.
The indentation suggests
: profile.baseUrlon Line 949 belongs to the inner ApiSmart ternary. It is the else of the outer Xiaomi condition. The logic is correct, but a reader must count operators to confirm it.Extract a small helper or add braces-style formatting so the two independent normalizations read separately.
🤖 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/utils/providerProfiles.ts` around lines 944 - 949, Clarify the nested ternary in the base-URL normalization logic by extracting the Xiaomi and ApiSmart cases into a small helper or using explicit brace-style conditionals. Update the code around normalizedProfileBaseUrl so each independent normalization has an unambiguous fallback to profile.baseUrl, while preserving the existing behavior.
976-1020: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
profileApiKeyconsistently inside the credential block.Line 984 gates the block on
profileApiKey, and Line 1019 assignsprofileApiKey. The other branches in the same block assign the rawprofile.apiKey, includingMINIMAX_API_KEY,NVIDIA_API_KEY,XAI_API_KEY, andATLAS_CLOUD_API_KEY.Today this is harmless.
profileApiKeydiffers fromprofile.apiKeyonly for an ApiSmart profile with an unusable key, and that case skips the whole block. The risk is future: ifprofileApiKeygains a validator for another route, the raw key would still reach those dedicated variables and bypass the sanitization.Assign
profileApiKeyin every branch so one sanitized value feeds all mirrors.🤖 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/utils/providerProfiles.ts` around lines 976 - 1020, Within the credential block guarded by profileApiKey, replace every dedicated environment-variable assignment that currently uses profile.apiKey with profileApiKey, including MINIMAX_API_KEY, NVIDIA_API_KEY, BNKR_API_KEY, XAI_API_KEY, AIMLAPI_API_KEY, VENICE_API_KEY, MIMO_API_KEY, and ATLAS_CLOUD_API_KEY. Keep the existing route conditions and the APISMART_API_KEY assignment unchanged.src/integrations/routeMetadata.ts (1)
634-646: 🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick winBlocking: sentinel base-URL values falsely suppress ApiSmart route selection.
hasConflictingOpenAIBaseUrlForRoutetests the raw env value.hasNonEmptyEnvValue(' UNDEFINED ')returns true andisApismartBaseUrl(' UNDEFINED ')returns false, so the function reports a conflicting endpoint.hasApismartProviderIntentthen returns false,resolveEnvOnlyProviderRouteIddoes not returnapismart, andapplyApismartEnvOnlyDefaultsinsrc/services/api/client.tsnever runs.This is a contract break between producer and consumer.
applyApismartEnvOnlyDefaultsalready discardsnullandundefinedsentinels throughgetUsableRouteConfigEnvValue, but this selector treats the same values as a real endpoint. The four failures atsrc/services/api/client.test.tsLine 1607 match this path: the sentinel survives inOPENAI_BASE_URL, orOPENAI_BASE_URLstays unset when the sentinel is inOPENAI_API_BASE.Apply one sentinel policy in the selector. The fix is shared by every route that calls this helper.
🐛 Proposed fix to normalize sentinel values before conflict detection
function hasConflictingOpenAIBaseUrlForRoute( processEnv: NodeJS.ProcessEnv, isRouteBaseUrl: (value: string | undefined) => boolean, ): boolean { - if (hasNonEmptyEnvValue(processEnv.OPENAI_BASE_URL)) { - return !isRouteBaseUrl(processEnv.OPENAI_BASE_URL) - } - - return ( - hasNonEmptyEnvValue(processEnv.OPENAI_API_BASE) && - !isRouteBaseUrl(processEnv.OPENAI_API_BASE) - ) + const baseUrl = getUsableRouteConfigEnvValue(processEnv.OPENAI_BASE_URL) + if (baseUrl !== undefined) { + return !isRouteBaseUrl(baseUrl) + } + + const apiBase = getUsableRouteConfigEnvValue(processEnv.OPENAI_API_BASE) + return apiBase !== undefined && !isRouteBaseUrl(apiBase) }As per path instructions, review provider routing, env precedence, and outbound HTTP behavior with high scrutiny.
Also applies to: 860-890
🤖 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/routeMetadata.ts` around lines 634 - 646, Update hasConflictingOpenAIBaseUrlForRoute to normalize OPENAI_BASE_URL and OPENAI_API_BASE through the shared getUsableRouteConfigEnvValue sentinel policy before checking for non-empty values or route compatibility. Preserve OPENAI_BASE_URL precedence, fall back to OPENAI_API_BASE only when the normalized primary value is absent, and ensure null/undefined sentinel values do not count as conflicting endpoints for every caller.Sources: Path instructions, Pipeline failures
🤖 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/routeMetadata.test.ts`:
- Around line 73-80: Add null and undefined assertions to the test for
hasUsableRouteCredentialEnvValue with APISMART_API_KEY, ensuring both sentinel
values are rejected alongside the existing placeholder case while retaining the
valid-key assertion. Update the test description to reflect ApiSmart’s stricter
credential rules rather than OpenAI placeholder rules.
In `@src/integrations/routeMetadata.ts`:
- Around line 874-890: The ApiSmart env-only intent uses an inconsistent
credential validator, and its tests omit required placeholder cases. In
src/integrations/routeMetadata.ts lines 874-890, update
hasApismartEnvOnlyProviderIntent to use hasUsableRouteCredentialEnvValue with
APISMART_API_KEY, while leaving hasConfiguredApismartProviderIntent unchanged;
in src/integrations/routeMetadata.test.ts lines 73-80, rename the test to
describe ApiSmart rules and cover sua_chave, null, NULL, whitespace-padded
undefined, and the empty string. Run the specified routeMetadata test.
In `@src/services/api/client.test.ts`:
- Around line 1543-1609: The ApiSmart tests must isolate
CLAUDE_CODE_PROVIDER_ROUTE_ID so external values cannot redirect requests away
from ApiSmart. Update the shared environment snapshot, cleanup helper, and
teardown/restoration logic used by these tests to clear and restore
CLAUDE_CODE_PROVIDER_ROUTE_ID, while preserving the existing nullish-sentinel
assertions.
In `@src/services/api/openaiShim/requestExecutor.ts`:
- Around line 247-265: Extend the existing restricted-route POST test for the
ApiSmart path in client.test.ts by supplying caller custom headers, then assert
those headers are omitted from the request. Also verify the managed client
headers and route credential authorization remain present, preserving the
current restricted-route behavior.
---
Outside diff comments:
In `@src/integrations/routeMetadata.ts`:
- Around line 634-646: Update hasConflictingOpenAIBaseUrlForRoute to normalize
OPENAI_BASE_URL and OPENAI_API_BASE through the shared
getUsableRouteConfigEnvValue sentinel policy before checking for non-empty
values or route compatibility. Preserve OPENAI_BASE_URL precedence, fall back to
OPENAI_API_BASE only when the normalized primary value is absent, and ensure
null/undefined sentinel values do not count as conflicting endpoints for every
caller.
In `@src/utils/providerProfiles.ts`:
- Around line 944-949: Clarify the nested ternary in the base-URL normalization
logic by extracting the Xiaomi and ApiSmart cases into a small helper or using
explicit brace-style conditionals. Update the code around
normalizedProfileBaseUrl so each independent normalization has an unambiguous
fallback to profile.baseUrl, while preserving the existing behavior.
- Around line 976-1020: Within the credential block guarded by profileApiKey,
replace every dedicated environment-variable assignment that currently uses
profile.apiKey with profileApiKey, including MINIMAX_API_KEY, NVIDIA_API_KEY,
BNKR_API_KEY, XAI_API_KEY, AIMLAPI_API_KEY, VENICE_API_KEY, MIMO_API_KEY, and
ATLAS_CLOUD_API_KEY. Keep the existing route conditions and the APISMART_API_KEY
assignment unchanged.
🪄 Autofix
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
Run ID: 835eb453-9fff-4a28-b5bd-7994d67ac48f
📒 Files selected for processing (33)
README.mdsrc/components/ProviderManager.test.tsxsrc/components/ProviderManager.tsxsrc/components/StartupScreen.test.tssrc/components/StartupScreen.tssrc/integrations/discoveryService.test.tssrc/integrations/discoveryService.tssrc/integrations/index.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/services/api/agentRouting.test.tssrc/services/api/agentRouting.tssrc/services/api/client.test.tssrc/services/api/client.tssrc/services/api/credentialPool.test.tssrc/services/api/openaiShim.tssrc/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/utils/model/model.openai-shim-providers.test.tssrc/utils/model/model.tssrc/utils/providerFlag.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerProfiles.tssrc/utils/providerStartupOverrides.test.tssrc/utils/providerStartupOverrides.tssrc/utils/providerValidation.test.tssrc/utils/providerValidation.tsweb/src/data/configuration.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/integrations/index.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tsweb/src/data/configuration.tssrc/utils/providerStartupOverrides.tssrc/services/api/credentialPool.test.tssrc/integrations/discoveryService.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/components/ProviderManager.tsxsrc/services/api/agentRouting.tssrc/utils/providerValidation.test.tssrc/components/StartupScreen.tssrc/utils/providerFlag.test.tssrc/utils/model/model.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/integrations/index.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tsweb/src/data/configuration.tssrc/utils/providerStartupOverrides.tssrc/services/api/credentialPool.test.tssrc/integrations/discoveryService.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/components/ProviderManager.tsxsrc/services/api/agentRouting.tssrc/utils/providerValidation.test.tssrc/components/StartupScreen.tssrc/utils/providerFlag.test.tssrc/utils/model/model.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/integrations/index.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/utils/providerStartupOverrides.tssrc/services/api/credentialPool.test.tssrc/integrations/discoveryService.tssrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/services/api/agentRouting.tssrc/utils/providerValidation.test.tssrc/components/StartupScreen.tssrc/utils/providerFlag.test.tssrc/utils/model/model.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.ts
src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/services/api/agentRouting.test.tssrc/services/api/credentialPool.test.tssrc/services/api/agentRouting.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/services/api/openaiShim/requestExecutor.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/services/api/credentialPool.test.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/utils/providerValidation.test.tssrc/utils/providerFlag.test.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/integrations/index.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tsweb/src/data/configuration.tssrc/utils/providerStartupOverrides.tssrc/services/api/credentialPool.test.tssrc/integrations/discoveryService.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/components/ProviderManager.tsxsrc/services/api/agentRouting.tssrc/utils/providerValidation.test.tssrc/components/StartupScreen.tssrc/utils/providerFlag.test.tssrc/utils/model/model.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/services/api/credentialPool.test.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/utils/providerValidation.test.tssrc/utils/providerFlag.test.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
src/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/integrations/index.tssrc/services/api/agentRouting.test.tsREADME.mdsrc/utils/model/model.openai-shim-providers.test.tsweb/src/data/configuration.tssrc/utils/providerStartupOverrides.tssrc/services/api/credentialPool.test.tssrc/integrations/discoveryService.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/components/ProviderManager.tsxsrc/services/api/agentRouting.tssrc/utils/providerValidation.test.tssrc/components/StartupScreen.tssrc/utils/providerFlag.test.tssrc/utils/model/model.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.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/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/integrations/index.tssrc/services/api/agentRouting.test.tsREADME.mdsrc/utils/model/model.openai-shim-providers.test.tsweb/src/data/configuration.tssrc/utils/providerStartupOverrides.tssrc/services/api/credentialPool.test.tssrc/integrations/discoveryService.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/components/ProviderManager.tsxsrc/services/api/agentRouting.tssrc/utils/providerValidation.test.tssrc/components/StartupScreen.tssrc/utils/providerFlag.test.tssrc/utils/model/model.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.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/services/api/openaiShim/requestExecutor.test.tssrc/services/api/openaiShim.tssrc/integrations/discoveryService.test.tssrc/integrations/index.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/utils/providerStartupOverrides.tssrc/services/api/credentialPool.test.tssrc/integrations/discoveryService.tssrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/services/api/agentRouting.tssrc/utils/providerValidation.test.tssrc/utils/providerFlag.test.tssrc/utils/model/model.tssrc/services/api/providerConfig.tssrc/services/api/client.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.tssrc/utils/providerFlag.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.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/services/api/openaiShim/requestExecutor.test.tssrc/integrations/discoveryService.test.tssrc/components/StartupScreen.test.tssrc/services/api/agentRouting.test.tssrc/utils/model/model.openai-shim-providers.test.tssrc/services/api/credentialPool.test.tssrc/components/ProviderManager.test.tsxsrc/utils/providerStartupOverrides.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfile.test.tssrc/utils/providerValidation.test.tssrc/utils/providerFlag.test.tssrc/utils/providerProfiles.test.tssrc/services/api/client.test.tssrc/services/api/providerConfig.test.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
web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When changing the web application, run the web typecheck and build checks.
Files:
web/src/data/configuration.ts
web/**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When changing files under
web/, runbun run web:typecheckandbun run web:build.
Files:
web/src/data/configuration.ts
web/**
⚙️ CodeRabbit configuration file
web/**: Review browser extension changes for content-script isolation, message validation, cross-origin assumptions, permission surfaces, and failures that could leak prompts or credentials.
Files:
web/src/data/configuration.ts
🪛 GitHub Actions: PR Checks / 2_smoke-and-tests (22).txt
src/services/api/client.test.ts
[error] 1587-1587: Test assertion failed: expected the request URL to be "https://gw.apismart.ai/v1/chat/completions", but received "https://api.anthropic.com/v1/messages?beta=true".
🪛 GitHub Actions: PR Checks / 3_smoke-and-tests (24.11.x).txt
src/services/api/client.test.ts
[error] 1587-1587: Test assertion failed: expected request URL https://gw.apismart.ai/v1/chat/completions, but received https://api.anthropic.com/v1/messages?beta=true.
🪛 GitHub Actions: PR Checks / smoke-and-tests (22)
src/services/api/client.test.ts
[error] 1587-1587: Test assertion failed: expected request URL 'https://gw.apismart.ai/v1/chat/completions', but received 'https://api.anthropic.com/v1/messages?beta=true'.
🪛 GitHub Actions: PR Checks / smoke-and-tests (24.11.x)
src/services/api/client.test.ts
[error] 1587-1587: Test assertion failed: expected request URL 'https://gw.apismart.ai/v1/chat/completions', but received 'https://api.anthropic.com/v1/messages?beta=true'.
🪛 GitHub Check: smoke-and-tests (22)
src/services/api/client.test.ts
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: undefined
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: undefined
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: " UNDEFINED "
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: "null"
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1587-1587: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1/chat/completions"
Received: "https://api.anthropic.com/v1/messages?beta=true"
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1587:23)
🪛 GitHub Check: smoke-and-tests (24.11.x)
src/services/api/client.test.ts
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: undefined
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: undefined
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: " UNDEFINED "
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1607-1607: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1"
Received: "null"
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1607:41)
[failure] 1587-1587: error: expect(received).toBe(expected)
Expected: "https://gw.apismart.ai/v1/chat/completions"
Received: "https://api.anthropic.com/v1/messages?beta=true"
at <anonymous> (/home/runner/work/openclaude/openclaude/src/services/api/client.test.ts:1587:23)
🔇 Additional comments (45)
src/integrations/discoveryService.test.ts (1)
113-138: LGTM!src/integrations/discoveryService.ts (1)
184-185: LGTM!README.md (1)
271-271: LGTM!web/src/data/configuration.ts (1)
81-82: LGTM!src/services/api/openaiShim.ts (1)
525-530: LGTM!src/services/api/openaiShim/requestExecutor.ts (1)
50-51: LGTM!Also applies to: 186-187, 308-308, 379-379
src/services/api/agentRouting.test.ts (1)
13-14: LGTM!Also applies to: 737-763
src/services/api/agentRouting.ts (1)
5-9: LGTM!Also applies to: 52-52, 66-67, 374-383
src/services/api/providerConfig.test.ts (1)
317-504: LGTM!src/services/api/providerConfig.ts (1)
29-30: LGTM!Also applies to: 239-265, 938-938, 980-1034
src/integrations/routeMetadata.ts (4)
202-242: LGTM!Also applies to: 244-249, 256-281
690-707: LGTM!
1181-1196: LGTM!
1198-1237: LGTM!src/integrations/routeMetadata.test.ts (3)
21-71: LGTM!
82-99: LGTM!Also applies to: 405-420
555-639: LGTM!src/integrations/index.ts (1)
145-145: LGTM!src/services/api/client.ts (3)
381-401: LGTM!
496-506: LGTM!
532-574: LGTM!Also applies to: 679-679
src/services/api/client.test.ts (3)
9-9: LGTM!Also applies to: 72-73, 127-128, 170-171, 221-222
321-341: LGTM!
1611-1658: LGTM!src/utils/model/model.ts (2)
38-62: LGTM!
75-76: LGTM!Also applies to: 216-217, 268-269, 318-319, 406-407
src/utils/providerProfile.ts (4)
642-686: LGTM!
1394-1402: LGTM!
2015-2067: LGTM!
2119-2139: LGTM!src/utils/providerProfiles.test.ts (3)
833-849: LGTM!
878-917: LGTM!
3244-3282: LGTM!Also applies to: 3284-3327, 3329-3361
src/utils/providerProfiles.ts (4)
157-159: LGTM!
299-344: LGTM!
1577-1593: LGTM!
1743-1748: LGTM!src/components/ProviderManager.tsx (3)
46-47: LGTM!Also applies to: 340-346
874-897: LGTM!Also applies to: 1650-1650
1759-1759: LGTM!Also applies to: 2189-2191
src/components/StartupScreen.ts (2)
84-88: LGTM!
111-125: 🎯 Functional CorrectnessNo change needed for the ApiSmart banner label. Credential-only
APISMART_API_KEYconfiguration resolves the ApiSmart endpoint and displaysApiSmart.StartupScreen.test.tscovers this case.> Likely an incorrect or invalid review comment.src/utils/providerValidation.ts (3)
130-135: LGTM!Also applies to: 379-385
244-274: LGTM!
283-283: LGTM!Also applies to: 292-304, 557-557
This reverts commit f8cd975.
…root Expand the shared credential usability helpers so dotenv sentinels like null/undefined cannot win ApiSmart env-only precedence or get mirrored into OPENAI_API_KEY, and restore focused ApiSmart docs after dropping the shared routing centralization.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/utils/providerFlag.ts (1)
173-175: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReject
nullbase URL sentinels.Line 175 treats
OPENAI_BASE_URL=nullas a configured endpoint. The ApiSmart branch can then retain that invalid value and clearOPENAI_API_KEYbecause the value is not an ApiSmart URL.Normalize
nullandundefinedcase-insensitively. Add a regression test that setsOPENAI_BASE_URLtonull, callsapplyProviderFlag('apismart', []), and expects the ApiSmart default endpoint and dedicated credential.Proposed fix
function normalizeBaseUrlEnv(value: string | undefined): string | undefined { const trimmed = value?.trim() - return trimmed && trimmed !== 'undefined' ? trimmed : undefined + if (!trimmed) return undefined + const normalized = trimmed.toLowerCase() + return normalized === 'undefined' || normalized === 'null' + ? undefined + : trimmed }Run
bun test ./src/utils/providerFlag.test.ts.As per coding guidelines, “Add or update tests when behavior changes.” As per path instructions, “Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny.”
🤖 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/utils/providerFlag.ts` around lines 173 - 175, Update normalizeBaseUrlEnv to treat trimmed “null” and “undefined” values case-insensitively as unset, while preserving valid URLs. Add a regression test in the providerFlag tests that sets OPENAI_BASE_URL to “null”, calls applyProviderFlag('apismart', []), and verifies the ApiSmart default endpoint and dedicated credential are retained.Sources: Coding guidelines, Path instructions
src/utils/providerProfiles.ts (1)
364-364: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse the shared placeholder rule for ApiSmart credentials.
sanitizeApiKeyrejects template values, but these paths retain or accept them. This can mirrornull,undefined, orSUA_CHAVEinto OpenAI-compatible configuration or allow credential validation to succeed with no usable ApiSmart key.
src/utils/providerProfiles.ts#L364-L364: sanitizeprofile.apiKeywithsanitizeApiKeybefore storing the profile.src/utils/providerValidation.ts#L129-L143: reject ApiSmart placeholder values when checking credential environment variables.Add regression tests for case-insensitive and whitespace-padded placeholders in both profile and environment flows.
As per coding guidelines, “Add or update tests when behavior changes.” As per path instructions, “Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny.”
🤖 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/utils/providerProfiles.ts` at line 364, Apply the shared sanitizeApiKey placeholder handling to profile.apiKey in providerProfiles.ts, and update the ApiSmart environment credential validation in providerValidation.ts to reject case-insensitive, whitespace-padded placeholders; add regression tests covering both profile and environment flows.Sources: Coding guidelines, Path instructions
🤖 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.
Outside diff comments:
In `@src/utils/providerFlag.ts`:
- Around line 173-175: Update normalizeBaseUrlEnv to treat trimmed “null” and
“undefined” values case-insensitively as unset, while preserving valid URLs. Add
a regression test in the providerFlag tests that sets OPENAI_BASE_URL to “null”,
calls applyProviderFlag('apismart', []), and verifies the ApiSmart default
endpoint and dedicated credential are retained.
In `@src/utils/providerProfiles.ts`:
- Line 364: Apply the shared sanitizeApiKey placeholder handling to
profile.apiKey in providerProfiles.ts, and update the ApiSmart environment
credential validation in providerValidation.ts to reject case-insensitive,
whitespace-padded placeholders; add regression tests covering both profile and
environment flows.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 106cc2d2-3278-47d4-ae1a-c979fd81dc2a
📒 Files selected for processing (20)
src/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/services/api/client.test.tssrc/services/api/client.tssrc/services/api/credentialPool.test.tssrc/services/api/credentialPool.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/utils/providerFlag.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerProfiles.tssrc/utils/providerSecrets.test.tssrc/utils/providerSecrets.tssrc/utils/providerValidation.test.tssrc/utils/providerValidation.tsweb/src/data/providers.ts
💤 Files with no reviewable changes (3)
- src/utils/providerValidation.test.ts
- src/utils/providerProfile.test.ts
- src/services/api/providerConfig.test.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
src/utils/providerSecrets.test.tsweb/src/data/providers.tssrc/services/api/client.test.tssrc/utils/providerSecrets.tssrc/services/api/credentialPool.test.tssrc/utils/providerValidation.tssrc/services/api/credentialPool.tssrc/utils/providerFlag.test.tssrc/utils/providerProfile.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/utils/providerFlag.tssrc/services/api/providerConfig.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
src/utils/providerSecrets.test.tsweb/src/data/providers.tssrc/services/api/client.test.tssrc/utils/providerSecrets.tssrc/services/api/credentialPool.test.tssrc/utils/providerValidation.tssrc/services/api/credentialPool.tssrc/utils/providerFlag.test.tssrc/utils/providerProfile.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/utils/providerFlag.tssrc/services/api/providerConfig.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/utils/providerSecrets.test.tssrc/services/api/client.test.tssrc/utils/providerSecrets.tssrc/services/api/credentialPool.test.tssrc/utils/providerValidation.tssrc/services/api/credentialPool.tssrc/utils/providerFlag.test.tssrc/utils/providerProfile.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/utils/providerFlag.tssrc/services/api/providerConfig.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
src/utils/providerSecrets.test.tssrc/services/api/client.test.tssrc/services/api/credentialPool.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
src/utils/providerSecrets.test.tsweb/src/data/providers.tssrc/services/api/client.test.tssrc/utils/providerSecrets.tssrc/services/api/credentialPool.test.tssrc/utils/providerValidation.tssrc/services/api/credentialPool.tssrc/utils/providerFlag.test.tssrc/utils/providerProfile.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/utils/providerFlag.tssrc/services/api/providerConfig.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
src/utils/providerSecrets.test.tssrc/services/api/client.test.tssrc/services/api/credentialPool.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
src/utils/providerSecrets.test.tsweb/src/data/providers.tssrc/services/api/client.test.tssrc/utils/providerSecrets.tssrc/services/api/credentialPool.test.tssrc/utils/providerValidation.tssrc/services/api/credentialPool.tssrc/utils/providerFlag.test.tssrc/utils/providerProfile.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/utils/providerFlag.tssrc/services/api/providerConfig.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.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/providerSecrets.test.tsweb/src/data/providers.tssrc/services/api/client.test.tssrc/utils/providerSecrets.tssrc/services/api/credentialPool.test.tssrc/utils/providerValidation.tssrc/services/api/credentialPool.tssrc/utils/providerFlag.test.tssrc/utils/providerProfile.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/utils/providerFlag.tssrc/services/api/providerConfig.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.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/utils/providerSecrets.test.tssrc/services/api/client.test.tssrc/utils/providerSecrets.tssrc/services/api/credentialPool.test.tssrc/utils/providerValidation.tssrc/services/api/credentialPool.tssrc/utils/providerFlag.test.tssrc/utils/providerProfile.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/utils/providerFlag.tssrc/services/api/providerConfig.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.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/providerSecrets.test.tssrc/services/api/client.test.tssrc/services/api/credentialPool.test.tssrc/utils/providerFlag.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerProfiles.test.ts
web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When changing the web application, run the web typecheck and build checks.
Files:
web/src/data/providers.ts
web/**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When changing files under
web/, runbun run web:typecheckandbun run web:build.
Files:
web/src/data/providers.ts
web/**
⚙️ CodeRabbit configuration file
web/**: Review browser extension changes for content-script isolation, message validation, cross-origin assumptions, permission surfaces, and failures that could leak prompts or credentials.
Files:
web/src/data/providers.ts
src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.
Files:
src/services/api/client.test.tssrc/services/api/credentialPool.test.tssrc/services/api/credentialPool.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/services/api/providerConfig.ts
🔇 Additional comments (4)
web/src/data/providers.ts (1)
196-197: LGTM!src/services/api/openaiShim/requestExecutor.ts (1)
243-247:
Keep the existing restricted-route header-isolation finding.These lines reintroduce unrestricted default, caller, and custom authentication header forwarding. This matches the existing ApiSmart restricted-route isolation comment.
Also applies to: 332-342
src/services/api/client.test.ts (1)
71-72: KeepCLAUDE_CODE_PROVIDER_ROUTE_IDisolated.The ApiSmart test cleanup still does not snapshot, clear, and restore
CLAUDE_CODE_PROVIDER_ROUTE_ID. A pre-existing non-apismartvalue can redirect these tests away from ApiSmart and reproduce the reported Anthropic-endpoint failures.Also applies to: 126-127, 169-170, 220-221
Source: Pipeline failures
src/utils/providerProfiles.ts (1)
155-157: Persist default-route ApiSmart profiles.
isApismartProfileaccepts an empty base URL, butsanitizeProfilestill returnsnullfor!baseUrlat Line 346. Persisted ApiSmart profiles withoutbaseUrlare discarded beforebuildApismartProfileEnvcan apply the route default.
Treat dotenv `null`/`undefined` OPENAI_BASE_URL sentinels as unset so --provider apismart can apply defaults, and align profile/validation credential checks with the shared placeholder contract.
Review comment disposition (head
|
Backfill APISMART_API_KEY on relaunch and keyless canonical profiles, and gate credential forwarding on an exact /v1 inference URL so dedicatedCredentialsOnly auth and ambient keys stay aligned with AIMLAPI.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/utils/providerProfiles.ts`:
- Around line 1095-1103: Stop promoting generic OPENAI_API_KEY values into
ApiSmart credentials: in src/utils/providerProfiles.ts:1095-1103, source ambient
credentials only from sanitized APISMART_API_KEY; in
src/utils/providerProfile.ts:2163-2176, retain legacy migration only for
persisted ApiSmart-shaped profiles, preferring explicit dedicated credentials
and never using shell OPENAI_API_KEY as fallback. Add the requested regression
cases in src/utils/providerProfiles.test.ts:870-903 and
src/utils/providerProfile.test.ts:281-307, then run both specified test
commands.
🪄 Autofix
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
Run ID: e9568b87-ce2f-4548-88c6-ae6b842b5c00
📒 Files selected for processing (7)
src/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerProfiles.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
- GitHub Check: typecheck
- GitHub Check: smoke-and-tests (24.11.x)
- GitHub Check: smoke-and-tests (22)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
src/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
src/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
src/utils/providerProfile.test.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
src/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
src/utils/providerProfile.test.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
src/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.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/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.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/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.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/providerProfile.test.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.test.ts
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/integrations/gateways/apismart.test.ts (1)
34-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the remaining mapper branches.
The mapper also handles
visionor other non-chat records and optional ownership labels. The current cases cover image, video, missing-ID, and null records. Add explicit fixtures for avisionrecord, a chat-capable multimodal record, and anowned_byvalue.Run:
bun test ./src/integrations/gateways/apismart.test.tsAs per coding guidelines, behavior changes require focused tests. As per path instructions, changed provider behavior needs meaningful 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/gateways/apismart.test.ts` around lines 34 - 48, Extend the mapModel test to cover the remaining mapper branches: add fixtures asserting vision records are excluded, chat-capable multimodal records are retained, and owned_by contributes the expected ownership label. Keep the existing image, video, missing-ID, and null cases, then run the focused apismart test command.Sources: Coding guidelines, Path instructions
src/integrations/routeMetadata.test.ts (1)
324-332: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd negative ApiSmart resolver cases.
These assertions cover only canonical HTTPS URLs. Add cases for an HTTP URL and a custom port so
resolveRouteIdFromBaseUrlcannot regress to host-only matching.As per coding guidelines, “Add or update tests when a code change affects behavior.” As per path instructions, “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.”
🤖 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/routeMetadata.test.ts` around lines 324 - 332, Extend the test named “ApiSmart route metadata uses official OpenAI-compatible defaults” with negative assertions for an HTTP ApiSmart URL and an ApiSmart URL using a custom port, verifying resolveRouteIdFromBaseUrl returns no ApiSmart match for both. Keep the existing canonical HTTPS and chat-completions assertions unchanged.Sources: Coding guidelines, Path instructions
src/utils/providerProfiles.ts (1)
984-1043: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPreserve the ApiSmart profile contract across apply, relaunch, and routing.
The current profile paths emit generic OpenAI state without proving that ApiSmart credentials and route identity survive environment reconstruction. The related active-route and profile tests are disabled.
src/utils/providerProfiles.ts#L984-L1043: emit the required ApiSmart credential and route metadata when applying a profile.src/utils/providerProfiles.ts#L1348-L1395: preserve the same metadata in keyed startup restoration.src/utils/providerProfiles.ts#L1419-L1467: preserve it in fallback startup restoration.src/integrations/routeMetadata.test.ts#L466-L608: restore active regression coverage for environment-only setup, profile refinement, and relaunch behavior.🤖 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/utils/providerProfiles.ts` around lines 984 - 1043, Preserve the ApiSmart credential and route metadata across profile application and startup restoration: update src/utils/providerProfiles.ts:984-1043, :1348-1395, and :1419-1467 to emit the same ApiSmart-specific environment values and route identity using the existing profile/routing contract, rather than only generic OpenAI state. Restore the disabled regression coverage in src/integrations/routeMetadata.test.ts:466-608 for environment-only setup, profile refinement, and relaunch behavior, ensuring all paths retain identical metadata.Sources: Coding guidelines, Path instructions
src/integrations/routeMetadata.ts (1)
1005-1008: 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy liftApply one strict ApiSmart URL boundary to route and validation matching.
Host-only matching can accept ApiSmart URLs that are not HTTPS or that use a custom port. Enforce the ApiSmart boundary before route selection and validation-target selection, then pin the behavior with negative tests.
src/integrations/routeMetadata.ts#L1005-L1008: reject HTTP and custom-port ApiSmart URLs before the default or host match returnsapismart.src/utils/providerValidation.ts#L274-L285: apply the same ApiSmart boundary before selecting the validation target.src/integrations/routeMetadata.test.ts#L324-L332: add HTTP and custom-port resolver regressions.🤖 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/routeMetadata.ts` around lines 1005 - 1008, Apply one strict HTTPS, standard-port ApiSmart URL boundary before route and validation matching: update the route-selection logic around the Cloudflare/Longcat checks in src/integrations/routeMetadata.ts (lines 1005-1008) to reject HTTP and custom-port ApiSmart URLs before returning apismart; apply the same boundary before validation-target selection in src/utils/providerValidation.ts (lines 274-285); add negative resolver regressions for HTTP and custom-port URLs in src/integrations/routeMetadata.test.ts (lines 324-332).Source: Path instructions
🤖 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/utils/providerFlag.test.ts`:
- Around line 501-512: Add APISMART_API_KEY to the test environment keys saved
and reset by the providerFlag test setup, including the RESET_KEYS list, so the
apismart test’s process.env mutation is isolated and cannot affect later
route-selection tests.
In `@src/utils/providerSecrets.ts`:
- Around line 93-95: Centralize the placeholder values and predicate currently
used by providerSecrets and credentialPool in a dependency-neutral utility, then
replace both local implementations with that shared symbol. Preserve trimming,
case-insensitive matching, and rejection of whitespace-only values, and update
focused tests covering those behaviors while keeping provider credential
integration behavior unchanged.
---
Outside diff comments:
In `@src/integrations/gateways/apismart.test.ts`:
- Around line 34-48: Extend the mapModel test to cover the remaining mapper
branches: add fixtures asserting vision records are excluded, chat-capable
multimodal records are retained, and owned_by contributes the expected ownership
label. Keep the existing image, video, missing-ID, and null cases, then run the
focused apismart test command.
In `@src/integrations/routeMetadata.test.ts`:
- Around line 324-332: Extend the test named “ApiSmart route metadata uses
official OpenAI-compatible defaults” with negative assertions for an HTTP
ApiSmart URL and an ApiSmart URL using a custom port, verifying
resolveRouteIdFromBaseUrl returns no ApiSmart match for both. Keep the existing
canonical HTTPS and chat-completions assertions unchanged.
In `@src/integrations/routeMetadata.ts`:
- Around line 1005-1008: Apply one strict HTTPS, standard-port ApiSmart URL
boundary before route and validation matching: update the route-selection logic
around the Cloudflare/Longcat checks in src/integrations/routeMetadata.ts (lines
1005-1008) to reject HTTP and custom-port ApiSmart URLs before returning
apismart; apply the same boundary before validation-target selection in
src/utils/providerValidation.ts (lines 274-285); add negative resolver
regressions for HTTP and custom-port URLs in
src/integrations/routeMetadata.test.ts (lines 324-332).
In `@src/utils/providerProfiles.ts`:
- Around line 984-1043: Preserve the ApiSmart credential and route metadata
across profile application and startup restoration: update
src/utils/providerProfiles.ts:984-1043, :1348-1395, and :1419-1467 to emit the
same ApiSmart-specific environment values and route identity using the existing
profile/routing contract, rather than only generic OpenAI state. Restore the
disabled regression coverage in src/integrations/routeMetadata.test.ts:466-608
for environment-only setup, profile refinement, and relaunch behavior, ensuring
all paths retain identical metadata.
🪄 Autofix
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
Run ID: b88f2339-3fe1-47e3-b142-067a49d24c9e
⛔ Files ignored due to path filters (1)
src/integrations/generated/integrationManifest.generated.tsis excluded by!**/*.generated.*,!**/generated/**,!src/integrations/generated/**
📒 Files selected for processing (18)
README.mdscripts/system-check.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/services/api/client.test.tssrc/services/api/credentialPool.tssrc/services/api/openaiShim/requestExecutor.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/utils/providerProfiles.tssrc/utils/providerSecrets.tssrc/utils/providerValidation.test.tssrc/utils/providerValidation.tsweb/src/data/configuration.tsweb/src/data/providers.ts
💤 Files with no reviewable changes (5)
- scripts/system-check.test.ts
- src/utils/envFile.ts
- src/services/api/client.test.ts
- src/services/api/openaiShim/requestExecutor.ts
- src/utils/providerValidation.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
src/integrations/gateways/apismart.tssrc/utils/envFile.test.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.tssrc/services/api/credentialPool.tssrc/integrations/routeMetadata.tsweb/src/data/configuration.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerSecrets.tsweb/src/data/providers.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.test.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
src/integrations/gateways/apismart.tssrc/utils/envFile.test.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.tssrc/services/api/credentialPool.tssrc/integrations/routeMetadata.tsweb/src/data/configuration.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerSecrets.tsweb/src/data/providers.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.test.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/integrations/gateways/apismart.tssrc/utils/envFile.test.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.tssrc/services/api/credentialPool.tssrc/integrations/routeMetadata.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerSecrets.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
src/integrations/gateways/apismart.tssrc/utils/envFile.test.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.tssrc/services/api/credentialPool.tssrc/integrations/routeMetadata.tsweb/src/data/configuration.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerSecrets.tsweb/src/data/providers.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
src/integrations/gateways/apismart.tssrc/utils/envFile.test.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.tsREADME.mdsrc/services/api/credentialPool.tssrc/integrations/routeMetadata.tsweb/src/data/configuration.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerSecrets.tsweb/src/data/providers.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.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/apismart.tssrc/utils/envFile.test.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.tsREADME.mdsrc/services/api/credentialPool.tssrc/integrations/routeMetadata.tsweb/src/data/configuration.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerSecrets.tsweb/src/data/providers.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.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/apismart.tssrc/utils/providerValidation.tssrc/utils/providerProfiles.tssrc/services/api/credentialPool.tssrc/integrations/routeMetadata.tssrc/integrations/gateways/apismart.test.tssrc/utils/providerSecrets.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.test.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
src/utils/envFile.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
src/utils/envFile.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.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/envFile.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/routeMetadata.test.tssrc/utils/providerFlag.test.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
src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.
Files:
src/services/api/credentialPool.ts
web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When changing the web application, run the web typecheck and build checks.
Files:
web/src/data/configuration.tsweb/src/data/providers.ts
web/**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When changing files under
web/, runbun run web:typecheckandbun run web:build.
Files:
web/src/data/configuration.tsweb/src/data/providers.ts
web/**
⚙️ CodeRabbit configuration file
web/**: Review browser extension changes for content-script isolation, message validation, cross-origin assumptions, permission surfaces, and failures that could leak prompts or credentials.
Files:
web/src/data/configuration.tsweb/src/data/providers.ts
🔇 Additional comments (12)
src/integrations/gateways/apismart.ts (2)
199-209: LGTM!
170-198: 🎯 Functional CorrectnessRun the ApiSmart tests and type checks in an environment with Bun. The source keeps curated models out of readiness, uses the route-resolved credential, and restricts matching to
gw.apismart.ai; the requested commands remain unexecuted becausebunis unavailable.src/integrations/gateways/apismart.test.ts (1)
8-32: LGTM!README.md (1)
271-271: LGTM!src/services/api/credentialPool.ts (1)
139-145: LGTM!web/src/data/providers.ts (1)
195-197: 🗄️ Data Integrity & IntegrationKeep the ApiSmart environment-variable list unchanged.
envVarsonly renders provider documentation. The runtime already addsOPENAI_API_KEYSandOPENAI_API_KEYfor ApiSmart, and the configuration page documents both variables.> Likely an incorrect or invalid review comment.src/utils/providerValidation.ts (1)
137-139: LGTM!src/integrations/routeMetadata.ts (1)
227-229: LGTM!src/integrations/routeMetadata.test.ts (1)
224-239: LGTM!src/utils/providerProfiles.ts (1)
67-67: LGTM!Also applies to: 357-357
src/utils/envFile.test.ts (1)
21-21: LGTM!Also applies to: 278-288
web/src/data/configuration.ts (1)
81-81: LGTM!
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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/discoveryService.test.ts`:
- Around line 116-135: Strengthen the test around discoverModelsForRoute by
tracking whether the mocked fetch is invoked and asserting it ran before
checking credentials. Inspect all headers from the captured request and assert
the configured secret does not appear anywhere, regardless of header name or
authentication scheme, rather than only checking the authorization value.
In `@src/integrations/routeMetadata.ts`:
- Around line 452-457: Update the canonical URL predicate in the route-matching
function around candidate.protocol to also require empty candidate.search and
candidate.hash, while preserving the existing HTTPS, port, hostname, and
pathname checks. Add regression cases in the routeMetadata tests covering
canonical URLs with query strings or fragments and verify they are rejected.
In `@src/services/api/providerConfig.test.ts`:
- Around line 355-366: Add focused coverage in providerConfig.test.ts for
resolveProviderRequest when APISMART_MODEL is the literal "undefined" or "null"
in varying capitalization, verifying each is treated as unset and OPENAI_MODEL
is selected while the ApiSmart base URL remains unchanged; run bun test
./src/services/api/providerConfig.test.ts.
In `@src/utils/providerProfile.ts`:
- Around line 2169-2187: The ApiSmart legacy OPENAI credential currently
overrides a usable dedicated credential. In
src/utils/providerProfile.ts:2169-2187, hoist persistedOpenAICredential out of
the loop and move backfillLegacyApismartProfileKey to the end of the
dedicatedValue fallback chain, after processEnv[dedicatedKey] and
persistedEnv[dedicatedKey]. In src/utils/providerProfile.test.ts:261-279, add
launch cases covering differing persisted OPENAI_API_KEY/APISMART_API_KEY values
and a live shell APISMART_API_KEY rotating the persisted pair, asserting the
dedicated value is retained; run the targeted providerProfile test.
- Around line 2283-2288: Guard persisted.env before accessing
CLAUDE_CODE_PROVIDER_ROUTE_ID or OPENAI_BASE_URL in the persistedApismartProxy
check within buildLaunchEnv. Treat a missing env object as not matching the
Apismart proxy condition, allowing startup to continue through the normal path
without throwing.
In `@src/utils/providerProfiles.ts`:
- Around line 1092-1101: Update the keyless canonical branch in
isApismartProfile handling to sanitize process.env.APISMART_API_KEY with the
existing sanitizeApiKey helper before assigning it to OPENAI_API_KEY and
APISMART_API_KEY, so placeholders such as SUA_CHAVE, null, or undefined are
treated as absent. Add a providerProfiles test covering a keyless canonical
profile with a placeholder ambient key, then run the targeted providerProfiles
test suite.
🪄 Autofix
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
Run ID: 7c3640aa-1c25-4c99-811d-d68616803349
⛔ Files ignored due to path filters (1)
src/integrations/generated/integrationManifest.generated.tsis excluded by!**/*.generated.*,!**/generated/**,!src/integrations/generated/**
📒 Files selected for processing (27)
README.mdscripts/system-check.test.tssrc/integrations/discoveryService.test.tssrc/integrations/discoveryService.tssrc/integrations/gateways/apismart.test.tssrc/integrations/gateways/apismart.tssrc/integrations/routeMetadata.test.tssrc/integrations/routeMetadata.tssrc/services/api/client.test.tssrc/services/api/client.tssrc/services/api/credentialPool.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/providerConfig.test.tssrc/services/api/providerConfig.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/utils/providerFlag.test.tssrc/utils/providerFlag.tssrc/utils/providerProfile.test.tssrc/utils/providerProfile.tssrc/utils/providerProfiles.test.tssrc/utils/providerProfiles.tssrc/utils/providerSecrets.tssrc/utils/providerValidation.test.tssrc/utils/providerValidation.tsweb/src/data/configuration.tsweb/src/data/providers.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (15)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript strict mode and ESM imports throughout the source code.
Run
bun run typecheckandbun run typecheck:type-testsfor TypeScript changes when applicable.
Files:
scripts/system-check.test.tssrc/utils/providerSecrets.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/integrations/routeMetadata.test.tsweb/src/data/providers.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/services/api/credentialPool.tssrc/integrations/discoveryService.tssrc/services/api/openaiShim/requestExecutor.tssrc/integrations/gateways/apismart.tssrc/utils/providerValidation.tssrc/services/api/client.tssrc/utils/providerValidation.test.tsweb/src/data/configuration.tssrc/services/api/providerConfig.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Use React and Ink patterns for terminal UI components.
Files:
scripts/system-check.test.tssrc/utils/providerSecrets.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/integrations/routeMetadata.test.tsweb/src/data/providers.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/services/api/credentialPool.tssrc/integrations/discoveryService.tssrc/services/api/openaiShim/requestExecutor.tssrc/integrations/gateways/apismart.tssrc/utils/providerValidation.tssrc/services/api/client.tssrc/utils/providerValidation.test.tsweb/src/data/configuration.tssrc/services/api/providerConfig.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.ts
**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Add or update tests when behavior changes, and run the narrowest useful focused test checks.
Files:
scripts/system-check.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/utils/providerValidation.test.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerProfiles.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Do not add new Python code, Python provider paths, or Python dependencies without explicit maintainer approval.
**/*.{ts,tsx,js,jsx}: Follow the existing code style in touched source files, prefer small readable changes, avoid unrelated reformatting, and keep comments useful and concise.
Preserve existing repository patterns unless intentionally refactoring them, and avoid broad rewrites or unnecessary generated changes.
Review AI-assisted code for correctness, style consistency, unnecessary changes, and adherence to project architecture before submitting it.
Files:
scripts/system-check.test.tssrc/utils/providerSecrets.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/integrations/routeMetadata.test.tsweb/src/data/providers.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/services/api/credentialPool.tssrc/integrations/discoveryService.tssrc/services/api/openaiShim/requestExecutor.tssrc/integrations/gateways/apismart.tssrc/utils/providerValidation.tssrc/services/api/client.tssrc/utils/providerValidation.test.tsweb/src/data/configuration.tssrc/services/api/providerConfig.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.ts
**/*.{test,spec}.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.{test,spec}.{ts,tsx,js,jsx}: Add or update tests when a code change affects behavior.
Use focused tests such asbun test ./path/to/test-file.test.tswhen validating a narrowly scoped change.
Files:
scripts/system-check.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/utils/providerValidation.test.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerProfiles.test.ts
**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Update documentation when setup, commands, or user-facing behavior changes.
Files:
scripts/system-check.test.tssrc/utils/providerSecrets.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/integrations/routeMetadata.test.tsweb/src/data/providers.tssrc/services/api/providerConfig.test.tsREADME.mdsrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/services/api/credentialPool.tssrc/integrations/discoveryService.tssrc/services/api/openaiShim/requestExecutor.tssrc/integrations/gateways/apismart.tssrc/utils/providerValidation.tssrc/services/api/client.tssrc/utils/providerValidation.test.tsweb/src/data/configuration.tssrc/services/api/providerConfig.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.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:
scripts/system-check.test.tssrc/utils/providerSecrets.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/integrations/routeMetadata.test.tsweb/src/data/providers.tssrc/services/api/providerConfig.test.tsREADME.mdsrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/services/api/credentialPool.tssrc/integrations/discoveryService.tssrc/services/api/openaiShim/requestExecutor.tssrc/integrations/gateways/apismart.tssrc/utils/providerValidation.tssrc/services/api/client.tssrc/utils/providerValidation.test.tsweb/src/data/configuration.tssrc/services/api/providerConfig.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.ts
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}
⚙️ CodeRabbit configuration file
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}: Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety. Block on changes that can break Windows/macOS/Linux startup or publish unexpected artifacts.
Files:
scripts/system-check.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:
scripts/system-check.test.tssrc/utils/envFile.test.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/utils/providerValidation.test.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerProfiles.test.ts
src/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.ts: Prefer existing service, provider, settings, permission, and UI patterns over introducing new abstractions.
Usechalkfor terminal color andexecafor child-process execution when those capabilities are needed.
Files:
src/utils/providerSecrets.tssrc/utils/envFile.test.tssrc/utils/envFile.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/services/api/credentialPool.tssrc/integrations/discoveryService.tssrc/services/api/openaiShim/requestExecutor.tssrc/integrations/gateways/apismart.tssrc/utils/providerValidation.tssrc/services/api/client.tssrc/utils/providerValidation.test.tssrc/services/api/providerConfig.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.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/utils/providerSecrets.tssrc/integrations/routeMetadata.test.tssrc/services/api/providerConfig.test.tssrc/integrations/gateways/apismart.test.tssrc/integrations/discoveryService.test.tssrc/utils/providerFlag.test.tssrc/services/api/credentialPool.tssrc/integrations/discoveryService.tssrc/services/api/openaiShim/requestExecutor.tssrc/integrations/gateways/apismart.tssrc/utils/providerValidation.tssrc/services/api/client.tssrc/utils/providerValidation.test.tssrc/services/api/providerConfig.tssrc/services/api/client.test.tssrc/utils/providerProfile.test.tssrc/utils/providerFlag.tssrc/utils/providerProfiles.tssrc/utils/providerProfiles.test.tssrc/integrations/routeMetadata.tssrc/utils/providerProfile.ts
web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
When changing the web application, run the web typecheck and build checks.
Files:
web/src/data/providers.tsweb/src/data/configuration.ts
web/**/*
📄 CodeRabbit inference engine (CONTRIBUTING.md)
When changing files under
web/, runbun run web:typecheckandbun run web:build.
Files:
web/src/data/providers.tsweb/src/data/configuration.ts
web/**
⚙️ CodeRabbit configuration file
web/**: Review browser extension changes for content-script isolation, message validation, cross-origin assumptions, permission surfaces, and failures that could leak prompts or credentials.
Files:
web/src/data/providers.tsweb/src/data/configuration.ts
src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use existing service and provider integration patterns when implementing API, MCP, OAuth, wiki, voice, or related integrations.
Files:
src/services/api/providerConfig.test.tssrc/services/api/credentialPool.tssrc/services/api/openaiShim/requestExecutor.tssrc/services/api/client.tssrc/services/api/providerConfig.tssrc/services/api/client.test.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
🔇 Additional comments (25)
src/integrations/gateways/apismart.ts (3)
1-37: LGTM!
39-168: LGTM!
170-227: LGTM!src/integrations/gateways/apismart.test.ts (3)
1-18: LGTM!
20-27: LGTM!
29-44: LGTM!web/src/data/providers.ts (1)
195-197: LGTM!README.md (1)
271-271: LGTM!scripts/system-check.test.ts (1)
85-86: LGTM!src/utils/providerValidation.test.ts (4)
35-35: LGTM!
189-196: LGTM!
198-212: LGTM!
214-229: LGTM!web/src/data/configuration.ts (1)
81-82: LGTM!src/utils/providerSecrets.ts (1)
93-102: Placeholder list is still duplicated withcredentialPool.
src/services/api/credentialPool.tsownsisCredentialPlaceholderand its own placeholder set. This file repeats the same three values. If one list changes, profile persistence and runtime credential validation will accept different values.Move the set and predicate into a dependency-neutral utility and consume it from both modules. Non-blocking for this PR, but the divergence risk is real.
src/services/api/providerConfig.ts (2)
27-32: LGTM!Also applies to: 244-251, 262-275, 277-285
949-949: LGTM!Also applies to: 991-1017, 1027-1045
src/services/api/providerConfig.test.ts (1)
317-354: LGTM!Also applies to: 368-432
src/integrations/discoveryService.test.ts (1)
21-21: LGTM!Also applies to: 63-63, 98-98
src/utils/envFile.test.ts (1)
22-22: LGTM!Also applies to: 279-291
src/utils/envFile.ts (1)
19-19: LGTM!src/utils/providerProfile.test.ts (1)
19-19: LGTM!Also applies to: 281-332, 334-372, 374-410, 412-441, 1125-1142
src/utils/providerProfile.ts (1)
28-28: LGTM!Also applies to: 115-116, 202-202, 639-690, 1406-1415, 2065-2085, 2117-2117, 2133-2135, 2145-2168, 2203-2205
src/utils/providerProfiles.ts (1)
31-31: LGTM!Also applies to: 54-57, 70-70, 156-162, 368-369, 813-816, 973-974, 1002-1016, 1025-1025, 1035-1040, 1086-1091, 1102-1102, 1384-1391, 1416-1418, 1465-1471, 1494-1496, 1686-1697, 1735-1737
src/utils/providerProfiles.test.ts (1)
73-74: LGTM!Also applies to: 270-279, 815-832, 834-843, 845-854, 856-868, 870-939, 941-953, 955-978, 3304-3355
|
@kevincodex1 LGTM |
Summary
https://gw.apismart.ai/v1) with a hybrid catalog: curated LLM model IDs plus authenticated OpenAI-compatible/v1/modelsdiscovery.APISMART_API_KEY/APISMART_MODELsupport across route detection, env-only defaults, provider flag/profile flows, request resolution, and shim credential handling.Contributor checklist
CONTRIBUTING.mdandAGENTS.mdUser / developer impact
--provider apismart, saved profiles, or env-only setup withAPISMART_API_KEY(and optionalAPISMART_MODEL)./v1/models.OPENAI_API_KEYforwarding, matching Atlas Cloud / ClinePass patterns.null/undefined/SUA_CHAVE) so ambient template keys cannot hijack ApiSmart routing.Provider path tested
mapModelfilteringAPISMART_API_KEY, base URL refinement, dual-key precedence vs ClinePass/AIMLAPI)APISMART_MODELresolution inproviderConfig,client,providerFlag, and profile env buildersapismartrouteTest plan
bun run buildbun run smokebun run checkSummary by CodeRabbit
New Features
Bug Fixes
Tests