Skip to content

feat: add Atlas Cloud LLM provider#21

Open
binyangzhu000-sudo wants to merge 2 commits into
framerslab:masterfrom
binyangzhu000-sudo:codex/add-atlascloud-provider
Open

feat: add Atlas Cloud LLM provider#21
binyangzhu000-sudo wants to merge 2 commits into
framerslab:masterfrom
binyangzhu000-sudo:codex/add-atlascloud-provider

Conversation

@binyangzhu000-sudo

@binyangzhu000-sudo binyangzhu000-sudo commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • add an atlascloud OpenAI-compatible LLM provider wrapper with Atlas Cloud defaults
  • register Atlas Cloud in provider manager, env resolution, auto-detection, provider defaults, response-format handling, and provider assignment defaults
  • document Atlas Cloud in the LLM provider guide and update provider counts without adding sponsor, logo, credits, or partner placement

Validation

  • ./node_modules/.bin/vitest run src/core/llm/providers/__tests__/OpenAICompatProviders.test.ts src/api/runtime/__tests__/provider-defaults.test.ts src/api/runtime/__tests__/responseFormatForProvider.test.ts tests/api/model.spec.ts src/orchestration/pipeline/query/__tests__/platform-knowledge.test.ts (88 tests passed)
  • ./node_modules/.bin/tsc --noEmit
  • ./node_modules/.bin/eslint "src/**/*.ts" (passes with existing warnings)
  • git diff --check
  • verified Atlas public model catalog includes deepseek-ai/deepseek-v4-pro and qwen/qwen3.5-flash

Note: pnpm install --frozen-lockfile completed dependency resolution and ran the repository build successfully, but exited afterward with ERR_PNPM_IGNORED_BUILDS because this local pnpm setup requires approving build scripts for optional native dependencies.

Summary by Sourcery

Add Atlas Cloud as an OpenAI-compatible LLM provider and wire it into runtime defaults, auto-detection, provider assignment, and JSON response-format handling.

New Features:

  • Introduce AtlasCloudProvider wrapper using the OpenAI transport with Atlas-specific credentials, endpoint, and model catalog.
  • Support Atlas Cloud as a first-class provider in AIModelProviderManager and environment-based provider resolution.

Enhancements:

  • Extend provider defaults, auto-detect order, and provider-assignment engine to include Atlas Cloud models for text and budget routing.
  • Treat Atlas Cloud as a strict JSON schema-capable provider alongside OpenRouter for structured outputs.
  • Update tests and platform knowledge corpus to cover Atlas Cloud behavior and reflect the expanded provider count.
  • Refresh README, architecture docs, and LLM provider guide to document Atlas Cloud and bump the supported provider count to twelve.

Tests:

  • Add and update unit, integration, and e2e tests for Atlas Cloud initialization, auto-detection, model resolution, response-format selection, and platform knowledge messaging.

Summary by CodeRabbit

  • New Features

    • Added built-in support for Atlas Cloud as a 12th LLM provider.
    • Added automatic provider detection using ATLASCLOUD_API_KEY.
    • Added Atlas Cloud model defaults, configuration, capability handling, and tool-calling support.
    • Added support for strict and structured JSON responses through Atlas Cloud.
  • Documentation

    • Updated product documentation, architecture references, package metadata, and knowledge content to reflect 12 supported providers.
    • Added Atlas Cloud setup instructions, models, environment variables, pricing tier, and provider details.

@sourcery-ai

sourcery-ai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a new OpenAI-compatible Atlas Cloud LLM provider and wires it into the runtime: provider manager, env resolution, auto-detection, provider defaults, response-format handling, provider assignment, tests, docs, and platform knowledge copy are all updated to treat Atlas Cloud as the 12th first-class provider.

File-Level Changes

Change Details Files
Introduce AtlasCloudProvider as an OpenAI-compatible provider wrapper and delegate transport to OpenAIProvider while defining Atlas-specific config and model catalog.
  • Implement AtlasCloudProvider class that conforms to IProvider and wraps OpenAIProvider for chat completions and streaming.
  • Define AtlasCloudProviderConfig with Atlas-specific API key, base URL, default model, and timeout options.
  • Add an Atlas Cloud model catalog constant with deepseek-ai/deepseek-v4-pro and qwen/qwen3.5-flash metadata, capabilities, and context sizes.
  • Implement listAvailableModels, getModelInfo, checkHealth, shutdown, and an explicit error for unsupported embeddings.
src/core/llm/providers/implementations/AtlasCloudProvider.ts
Register Atlas Cloud in the provider manager, environment mapping, provider defaults, auto-detection order, and provider assignment engine.
  • Extend ProviderConfigEntry union to include AtlasCloudProviderConfig and add atlascloud case in AIModelProviderManager provider factory.
  • Add atlascloud text/cheap defaults to PROVIDER_DEFAULTS and to ProviderAssignmentEngine DEFAULTS and provider preference lists for best/cheapest selection.
  • Map atlascloud to ATLASCLOUD_API_KEY and ATLASCLOUD_BASE_URL in ENV_KEY_MAP and ENV_URL_MAP used by resolveProvider.
  • Insert atlascloud into AUTO_DETECT_ORDER so ATLASCLOUD_API_KEY is auto-detected ahead of Anthropic and below OpenRouter/OpenAI.
src/core/llm/providers/AIModelProviderManager.ts
src/api/runtime/provider-defaults.ts
src/orchestration/planning/ProviderAssignmentEngine.ts
src/api/model.ts
Extend response-format handling and JSON-mode routing to support Atlas Cloud as a strict JSON-schema-capable OpenAI-compatible provider.
  • Include atlascloud in JSON_MODE_PROVIDERS set for responseFormat handling.
  • Treat atlascloud like openrouter in buildResponseFormatForProvider: strict json_schema when schema is compatible, json_object otherwise.
  • Add unit tests asserting atlascloud responseFormat behavior for plain and record schemas.
src/api/runtime/responseFormatForProvider.ts
src/api/runtime/__tests__/responseFormatForProvider.test.ts
Add Atlas Cloud-specific unit tests for provider wrapper behavior, defaults, auto-detection, and model resolution.
  • Extend OpenAICompatProviders tests to import AtlasCloudProvider and validate providerId, base URL default, API key requirement, default model ID, model catalog contents, completion delegation, and embeddings rejection.
  • Add PROVIDER_DEFAULTS.atlascloud assertions and autoDetectProvider behavior when ATLASCLOUD_API_KEY is set in OpenAICompatProviders tests.
  • Update provider-defaults tests to expect atlascloud text defaults, handle ATLASCLOUD_API_KEY cleanup, and confirm auto-detection and resolveModelOption behavior for atlascloud.
  • Add resolveProvider test to ensure atlascloud picks up ATLASCLOUD_API_KEY and ATLASCLOUD_BASE_URL and returns a config with the expected modelId.
src/core/llm/providers/__tests__/OpenAICompatProviders.test.ts
src/api/runtime/__tests__/provider-defaults.test.ts
tests/api/model.spec.ts
Update platform knowledge corpus, docs, README, architecture diagram caption, tests, and package metadata to reflect Atlas Cloud as the 12th provider and document configuration details.
  • Update LLM_PROVIDERS docs: provider counts (11→12), table rows adding Atlas Cloud, auto-detection order including ATLASCLOUD_API_KEY, env var examples, cost tier table, Atlas Cloud section with models and capabilities, and structured-output support table.
  • Adjust README, ARCHITECTURE.md diagram caption, package.json description, FAQ and API reference strings in build-knowledge-corpus.mjs to say 12 providers and include Atlas Cloud.
  • Update platform-knowledge fixtures and e2e tests so the generated text and corpus mention 12 providers and include Atlas Cloud.
  • Ensure no sponsor/logo/credits/partner placement are added; documentation changes are limited to functional provider info and counts.
docs/features/LLM_PROVIDERS.md
README.md
docs/architecture/ARCHITECTURE.md
package.json
scripts/build-knowledge-corpus.mjs
src/orchestration/pipeline/query/__tests__/platform-knowledge.test.ts
tests/e2e/platform-knowledge.e2e.spec.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • Consider removing or gating the console.log calls in AtlasCloudProvider.initialize and shutdown to avoid noisy logs in production; other providers tend to avoid logging at this level.
  • The ProviderConfigEntry.config union in AIModelProviderManager is becoming large; you might want to refactor it into a mapped type keyed by providerId or a discriminated union to keep the type easier to maintain as new providers like atlascloud are added.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider removing or gating the `console.log` calls in `AtlasCloudProvider.initialize` and `shutdown` to avoid noisy logs in production; other providers tend to avoid logging at this level.
- The `ProviderConfigEntry.config` union in `AIModelProviderManager` is becoming large; you might want to refactor it into a mapped type keyed by providerId or a discriminated union to keep the type easier to maintain as new providers like `atlascloud` are added.

## Individual Comments

### Comment 1
<location path="src/core/llm/providers/implementations/AtlasCloudProvider.ts" line_range="128-129" />
<code_context>
+  }
+
+  public async listAvailableModels(filter?: { capability?: string }): Promise<ModelInfo[]> {
+    if (filter?.capability) {
+      return ATLAS_CLOUD_MODELS.filter(m => m.capabilities.includes(filter.capability!));
+    }
+    return [...ATLAS_CLOUD_MODELS];
</code_context>
<issue_to_address>
**nitpick:** Avoid the non-null assertion in the capabilities filter to keep the implementation cleaner and safer.

Within the `if (filter?.capability)` block, `filter.capability` is already typed as `string`, so the `!` is unnecessary. Use `includes(filter.capability)` instead to avoid redundant assertions and keep the code safer if the filter type changes in the future.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/core/llm/providers/implementations/AtlasCloudProvider.ts Outdated
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add Atlas Cloud as a new OpenAI-compatible LLM provider

✨ Enhancement 📝 Documentation 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds a new AtlasCloudProvider OpenAI-compatible wrapper that delegates to OpenAIProvider with
 Atlas Cloud's endpoint/model defaults.
• Registers Atlas Cloud in the provider manager, env-key/base-URL resolution, auto-detection order,
 provider defaults, JSON response-format handling, and provider-assignment engine.
• Updates docs (LLM provider guide, README, CITATION.cff, architecture doc, knowledge corpus) to
 reflect 12 supported providers.
• Adds unit tests covering provider initialization, model catalog, defaults, auto-detection, and
 response-format behavior for the new provider.
Diagram

graph TD
  Manager["AIModelProviderManager"] --> Atlas["AtlasCloudProvider"]
  Atlas --> OpenAICompat["OpenAIProvider delegate"] --> API["Atlas Cloud API"]
  Resolver["model.ts resolveProvider"] --> Atlas
  Defaults["provider-defaults.ts"] --> Atlas
  RespFormat["responseFormatForProvider.ts"] --> Atlas
  Assignment["ProviderAssignmentEngine"] --> Atlas

  subgraph Legend
    direction LR
    _svc([Service]) ~~~ _ext{{External}}
  end
Loading
Files changed (18) +323 / -31

Enhancement (5) +18 / -7
AIModelProviderManager.tsRegister AtlasCloudProvider in provider manager factory +5/-2

Register AtlasCloudProvider in provider manager factory

• Imports AtlasCloudProvider/AtlasCloudProviderConfig, adds it to the ProviderConfigEntry union type, and adds a case in the provider factory switch statement.

src/core/llm/providers/AIModelProviderManager.ts

model.tsAdd Atlas Cloud env key and base URL mappings +2/-0

Add Atlas Cloud env key and base URL mappings

• Registers ATLASCLOUD_API_KEY and ATLASCLOUD_BASE_URL in the ENV_KEY_MAP and ENV_URL_MAP lookup tables used for credential resolution.

src/api/model.ts

provider-defaults.tsAdd Atlas Cloud default models and auto-detect probe +5/-0

Add Atlas Cloud default models and auto-detect probe

• Adds atlascloud text/cheap default model entries to PROVIDER_DEFAULTS and inserts an ATLASCLOUD_API_KEY probe into AUTO_DETECT_ORDER after OPENAI_API_KEY.

src/api/runtime/provider-defaults.ts

responseFormatForProvider.tsRoute Atlas Cloud through OpenAI-shaped JSON schema response format +3/-3

Route Atlas Cloud through OpenAI-shaped JSON schema response format

• Adds 'atlascloud' to JSON_MODE_PROVIDERS and to the openrouter branch so Atlas Cloud gets strict json_schema or json_object structured-output handling identical to OpenRouter.

src/api/runtime/responseFormatForProvider.ts

ProviderAssignmentEngine.tsAdd Atlas Cloud to provider assignment defaults and priority lists +3/-2

Add Atlas Cloud to provider assignment defaults and priority lists

• Adds atlascloud default models and inserts it into the 'best' and 'cheapest' provider priority ordering lists used for node provider assignment.

src/orchestration/planning/ProviderAssignmentEngine.ts

Tests (6) +111 / -4
OpenAICompatProviders.test.tsAdd unit tests for AtlasCloudProvider +71/-1

Add unit tests for AtlasCloudProvider

• Adds a full test suite for AtlasCloudProvider covering initialization, base URL defaults, missing API key error, default model, model catalog listing, completion delegation, embeddings rejection, PROVIDER_DEFAULTS registration, and auto-detection.

src/core/llm/providers/tests/OpenAICompatProviders.test.ts

provider-defaults.test.tsExtend provider-defaults tests with atlascloud coverage +19/-1

Extend provider-defaults tests with atlascloud coverage

• Adds atlascloud to the major-providers text-model check, env cleanup lists, and adds a dedicated auto-detect and resolveModelOption test for atlascloud.

src/api/runtime/tests/provider-defaults.test.ts

responseFormatForProvider.test.tsAdd response-format test case for atlascloud +9/-0

Add response-format test case for atlascloud

• Adds a test verifying atlascloud produces strict json_schema for plain schemas and json_object for record schemas.

src/api/runtime/tests/responseFormatForProvider.test.ts

model.spec.tsAdd resolveProvider test for Atlas Cloud env vars +10/-0

Add resolveProvider test for Atlas Cloud env vars

• Adds a test validating resolveProvider correctly resolves apiKey and baseUrl from ATLASCLOUD_API_KEY and ATLASCLOUD_BASE_URL.

tests/api/model.spec.ts

platform-knowledge.test.tsUpdate fixture provider count to 12 +1/-1

Update fixture provider count to 12

• Updates a test fixture string from '11 LLM providers' to '12 LLM providers' to match the updated knowledge corpus content.

src/orchestration/pipeline/query/tests/platform-knowledge.test.ts

platform-knowledge.e2e.spec.tsUpdate e2e mock text with Atlas Cloud provider count +1/-1

Update e2e mock text with Atlas Cloud provider count

• Updates the mocked generateText response text to reflect 12 providers and mention Atlas Cloud.

tests/e2e/platform-knowledge.e2e.spec.ts

Documentation (6) +44 / -20
LLM_PROVIDERS.mdDocument Atlas Cloud provider in LLM provider guide +36/-12

Document Atlas Cloud provider in LLM provider guide

• Adds Atlas Cloud to the table of contents, provider comparison table, auto-detection priority list, env var example, a dedicated Atlas Cloud configuration section with model table, cost tier, and tool-calling support table; updates provider counts throughout.

docs/features/LLM_PROVIDERS.md

README.mdBump documented provider count to 12 +3/-3

Bump documented provider count to 12

• Updates provider count references from 11 to 12 in the tagline, feature bullet, and package table.

README.md

CITATION.cffUpdate citation abstract provider count +1/-1

Update citation abstract provider count

• Changes the abstract text from 11 to 12 LLM providers.

CITATION.cff

ARCHITECTURE.mdUpdate architecture diagram alt text provider count +1/-1

Update architecture diagram alt text provider count

• Updates the image alt text describing the I/O and providers layer from 11 to 12 LLM providers.

docs/architecture/ARCHITECTURE.md

package.jsonUpdate package description provider count +1/-1

Update package description provider count

• Updates the npm package description from 11 to 12 LLM providers.

package.json

build-knowledge-corpus.mjsUpdate generated knowledge corpus with Atlas Cloud references +2/-2

Update generated knowledge corpus with Atlas Cloud references

• Updates the FAQ and API reference entries generated for the platform knowledge corpus to mention Atlas Cloud and the 12-provider count.

scripts/build-knowledge-corpus.mjs

Other (1) +150 / -0
AtlasCloudProvider.tsNew AtlasCloudProvider implementing IProvider via OpenAI delegate +150/-0

New AtlasCloudProvider implementing IProvider via OpenAI delegate

• Adds a new provider class that wraps OpenAIProvider with Atlas Cloud's default base URL (https://api.atlascloud.ai/v1), default model (deepseek-ai/deepseek-v4-pro), and a static model catalog (deepseek-v4-pro, qwen3.5-flash). Embeddings are explicitly unsupported and throw.

src/core/llm/providers/implementations/AtlasCloudProvider.ts

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Atlas Cloud was added as an OpenAI-compatible LLM provider, including model defaults, environment-based resolution, auto-detection, response formatting, provider assignment, tests, and documentation updates. Provider-count references were updated from 11 to 12.

Changes

Atlas Cloud provider support

Layer / File(s) Summary
Provider implementation and manager wiring
src/core/llm/providers/implementations/AtlasCloudProvider.ts, src/core/llm/providers/AIModelProviderManager.ts, src/core/llm/providers/__tests__/*
Adds AtlasCloudProvider, its model catalog and configuration, OpenAI-compatible completion delegation, capability filtering, health and shutdown handling, and provider-manager registration with tests.
Runtime resolution and response formats
src/api/model.ts, src/api/runtime/*, tests/api/model.spec.ts
Adds Atlas Cloud environment variables, defaults, auto-detection, model resolution, and structured-response handling with corresponding tests.
Provider assignment defaults
src/orchestration/planning/ProviderAssignmentEngine.ts
Adds Atlas Cloud defaults and includes it in best and cheapest provider selection strategies.
Provider documentation and knowledge content
CITATION.cff, README.md, docs/architecture/ARCHITECTURE.md, docs/features/LLM_PROVIDERS.md, package.json, scripts/build-knowledge-corpus.mjs, src/orchestration/pipeline/query/__tests__/platform-knowledge.test.ts, tests/e2e/platform-knowledge.e2e.spec.ts
Documents Atlas Cloud, updates provider counts to 12, and aligns generated knowledge and fixtures with the new provider list.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AIModelProviderManager
  participant AtlasCloudProvider
  participant OpenAIProvider
  AIModelProviderManager->>AtlasCloudProvider: initialize provider configuration
  AtlasCloudProvider->>OpenAIProvider: initialize compatible transport
  AtlasCloudProvider->>OpenAIProvider: delegate completion or streaming request
  OpenAIProvider-->>AtlasCloudProvider: return completion response
Loading

Suggested reviewers: jddunn, victor-evogor

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the summary and validation, but it omits the required Checklist and Related sections from the template. Add the Checklist section with tests/docs/conventional commit items and include a Related section with an issue reference or an explicit none.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and directly matches the main change: adding Atlas Cloud as a new LLM provider.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 846378f240

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// are set".
{ envKey: 'OPENROUTER_API_KEY', provider: 'openrouter' },
{ envKey: 'OPENAI_API_KEY', provider: 'openai' },
{ envKey: 'ATLASCLOUD_API_KEY', provider: 'atlascloud' },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wire Atlas Cloud into QueryRouter defaults

When only ATLASCLOUD_API_KEY is configured and a caller uses the QueryRouter/platform-knowledge defaults, this new auto-detect entry makes the public API recognize Atlas Cloud, but QueryRouter still has separate hard-coded provider lists: src/orchestration/pipeline/query/types.ts:789-798 omits Atlas when choosing the default provider, src/orchestration/pipeline/query/QueryRouter.ts:1614-1623 omits its API key, and the cheap/strong model maps omit Atlas model IDs. In that environment QueryRouter falls back to openai and passes apiKey: '' into generateText, so routing fails with an OpenAI credential error instead of using Atlas Cloud. Add ATLASCLOUD_API_KEY and the Atlas default models to the QueryRouter resolver paths as part of registering the provider.

Useful? React with 👍 / 👎.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Cheap model capability mismatch 🐞 Bug ≡ Correctness
Description
PROVIDER_DEFAULTS sets Atlas Cloud’s cheap model to qwen/qwen3.5-flash, but
AtlasCloudProvider’s model catalog declares that model as chat-only (no tool_use / json_mode),
while response-format selection treats all atlascloud calls as JSON-mode capable. This internal
mismatch can suppress tools (and raise TOOLS_NOT_SUPPORTED) for cheapest routing while still
emitting JSON response-format payloads for the same provider.
Code

src/api/runtime/provider-defaults.ts[R58-61]

+  atlascloud: {
+    text: 'deepseek-ai/deepseek-v4-pro',
+    cheap: 'qwen/qwen3.5-flash',
+  },
Evidence
The codebase sets atlascloud.cheap to qwen/qwen3.5-flash, but the model catalog marks that model
as not tool-capable, and tool support is enforced by PromptEngine/GMI based on those capabilities;
meanwhile response-format handling for atlascloud does not account for per-model capability
differences.

src/api/runtime/provider-defaults.ts[58-61]
src/core/llm/providers/implementations/AtlasCloudProvider.ts[44-65]
src/api/runtime/responseFormatForProvider.ts[21-110]
src/cognition/substrate/GMI.ts[806-816]
src/core/llm/PromptEngine.ts[271-273]
src/core/llm/PromptEngine.ts[394-396]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Atlas Cloud’s `cheap` default model is configured as `qwen/qwen3.5-flash`, but the in-repo model metadata marks it as lacking `tool_use` and `json_mode`. The runtime derives tool support from `capabilities.includes('tool_use')` and may suppress tool schema injection / flag errors, while `buildResponseFormatForProvider` still emits OpenAI-style JSON response formats for providerId `atlascloud` without model-specific gating.

### Issue Context
This is an internal consistency issue between:
- The model chosen by default for “cheap” routing.
- The declared capabilities used to determine tool support.
- The provider-level responseFormat behavior that assumes JSON-mode compatibility.

### Fix Focus Areas
- src/api/runtime/provider-defaults.ts[58-61]
- src/core/llm/providers/implementations/AtlasCloudProvider.ts[44-65]
- src/api/runtime/responseFormatForProvider.ts[21-110]
- src/cognition/substrate/GMI.ts[806-816]
- src/core/llm/PromptEngine.ts[271-273]
- src/core/llm/PromptEngine.ts[394-396]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

2. Unconditional provider logs 🐞 Bug ◔ Observability
Description
AtlasCloudProvider logs initialization/shutdown via console.log unconditionally, bypassing the
existing debug/log-level gating used by AIModelProviderManager and OpenAIProvider. This will add
noisy stdout output for library consumers and can unexpectedly surface operational configuration
(e.g., default model) even when debug is off.
Code

src/core/llm/providers/implementations/AtlasCloudProvider.ts[R95-97]

+    this.isInitialized = true;
+    console.log(`AtlasCloudProvider initialized. Default model: ${this.defaultModelId}.`);
+  }
Evidence
AtlasCloudProvider unconditionally logs on init/shutdown, while the manager and OpenAI provider
explicitly gate similar logs behind debug checks.

src/core/llm/providers/implementations/AtlasCloudProvider.ts[81-97]
src/core/llm/providers/implementations/AtlasCloudProvider.ts[144-149]
src/core/llm/providers/AIModelProviderManager.ts[68-81]
src/core/llm/providers/AIModelProviderManager.ts[167-170]
src/core/llm/providers/implementations/OpenAIProvider.ts[471-497]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`AtlasCloudProvider` uses unconditional `console.log` statements on initialize/shutdown. The rest of the provider stack already has log-gating (AGENTOS_DEBUG / AGENTOS_LOG_LEVEL), so these logs should be similarly gated or routed through the same logging mechanism.

### Issue Context
- `AIModelProviderManager` only logs init traces when debug is enabled.
- `OpenAIProvider` only logs init success when debug is enabled.
- `AtlasCloudProvider` currently always logs, which is inconsistent and noisy.

### Fix Focus Areas
- src/core/llm/providers/implementations/AtlasCloudProvider.ts[81-97]
- src/core/llm/providers/implementations/AtlasCloudProvider.ts[144-149]
- src/core/llm/providers/AIModelProviderManager.ts[68-81]
- src/core/llm/providers/implementations/OpenAIProvider.ts[471-497]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment on lines +95 to +97
this.isInitialized = true;
console.log(`AtlasCloudProvider initialized. Default model: ${this.defaultModelId}.`);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Informational

1. Unconditional provider logs 🐞 Bug ◔ Observability

AtlasCloudProvider logs initialization/shutdown via console.log unconditionally, bypassing the
existing debug/log-level gating used by AIModelProviderManager and OpenAIProvider. This will add
noisy stdout output for library consumers and can unexpectedly surface operational configuration
(e.g., default model) even when debug is off.
Agent Prompt
### Issue description
`AtlasCloudProvider` uses unconditional `console.log` statements on initialize/shutdown. The rest of the provider stack already has log-gating (AGENTOS_DEBUG / AGENTOS_LOG_LEVEL), so these logs should be similarly gated or routed through the same logging mechanism.

### Issue Context
- `AIModelProviderManager` only logs init traces when debug is enabled.
- `OpenAIProvider` only logs init success when debug is enabled.
- `AtlasCloudProvider` currently always logs, which is inconsistent and noisy.

### Fix Focus Areas
- src/core/llm/providers/implementations/AtlasCloudProvider.ts[81-97]
- src/core/llm/providers/implementations/AtlasCloudProvider.ts[144-149]
- src/core/llm/providers/AIModelProviderManager.ts[68-81]
- src/core/llm/providers/implementations/OpenAIProvider.ts[471-497]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +58 to +61
atlascloud: {
text: 'deepseek-ai/deepseek-v4-pro',
cheap: 'qwen/qwen3.5-flash',
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

2. Cheap model capability mismatch 🐞 Bug ≡ Correctness

PROVIDER_DEFAULTS sets Atlas Cloud’s cheap model to qwen/qwen3.5-flash, but
AtlasCloudProvider’s model catalog declares that model as chat-only (no tool_use / json_mode),
while response-format selection treats all atlascloud calls as JSON-mode capable. This internal
mismatch can suppress tools (and raise TOOLS_NOT_SUPPORTED) for cheapest routing while still
emitting JSON response-format payloads for the same provider.
Agent Prompt
### Issue description
Atlas Cloud’s `cheap` default model is configured as `qwen/qwen3.5-flash`, but the in-repo model metadata marks it as lacking `tool_use` and `json_mode`. The runtime derives tool support from `capabilities.includes('tool_use')` and may suppress tool schema injection / flag errors, while `buildResponseFormatForProvider` still emits OpenAI-style JSON response formats for providerId `atlascloud` without model-specific gating.

### Issue Context
This is an internal consistency issue between:
- The model chosen by default for “cheap” routing.
- The declared capabilities used to determine tool support.
- The provider-level responseFormat behavior that assumes JSON-mode compatibility.

### Fix Focus Areas
- src/api/runtime/provider-defaults.ts[58-61]
- src/core/llm/providers/implementations/AtlasCloudProvider.ts[44-65]
- src/api/runtime/responseFormatForProvider.ts[21-110]
- src/cognition/substrate/GMI.ts[806-816]
- src/core/llm/PromptEngine.ts[271-273]
- src/core/llm/PromptEngine.ts[394-396]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

Inline comments:
In `@docs/features/LLM_PROVIDERS.md`:
- Line 3: Update the provider breakdown in the introductory text and the
corresponding reference around the provider matrix: describe twelve providers as
9 API-key providers, Ollama, and 2 CLI providers, ensuring the category counts
sum to twelve and removing the incorrect “10 via API key” wording.

In `@src/orchestration/planning/ProviderAssignmentEngine.ts`:
- Line 109: Update the assignBalanced method’s cheap, strong, and standard
preferred-provider lists to include atlascloud in the same priority positions
used by the corresponding best and cheapest strategies, while preserving the
existing balanced rotation keys and tier selection logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bedc9ccf-dd65-4f83-8f1c-c8e0f74832fb

📥 Commits

Reviewing files that changed from the base of the PR and between eec46c9 and 1be41ac.

📒 Files selected for processing (18)
  • CITATION.cff
  • README.md
  • docs/architecture/ARCHITECTURE.md
  • docs/features/LLM_PROVIDERS.md
  • package.json
  • scripts/build-knowledge-corpus.mjs
  • src/api/model.ts
  • src/api/runtime/__tests__/provider-defaults.test.ts
  • src/api/runtime/__tests__/responseFormatForProvider.test.ts
  • src/api/runtime/provider-defaults.ts
  • src/api/runtime/responseFormatForProvider.ts
  • src/core/llm/providers/AIModelProviderManager.ts
  • src/core/llm/providers/__tests__/OpenAICompatProviders.test.ts
  • src/core/llm/providers/implementations/AtlasCloudProvider.ts
  • src/orchestration/pipeline/query/__tests__/platform-knowledge.test.ts
  • src/orchestration/planning/ProviderAssignmentEngine.ts
  • tests/api/model.spec.ts
  • tests/e2e/platform-knowledge.e2e.spec.ts

# LLM Providers — multi-provider configuration & routing

AgentOS abstracts every LLM behind a single [`IProvider`](https://github.com/framerslab/agentos/blob/master/src/core/llm/providers/IProvider.ts) interface. Eleven providers are wired in directly — nine via API key, two via local CLI bridges that ride an existing Claude Max or Google account subscription. OpenRouter, included in the eleven, fans out to 200+ additional models from the same set of vendors. Every provider speaks the same streaming protocol, supports the same tool-call shape (with the documented exceptions below), and participates in the same cost ledger. The fallback chain is auto-built from whichever keys are set in the environment and is overridable per agent.
AgentOS abstracts every LLM behind a single [`IProvider`](https://github.com/framerslab/agentos/blob/master/src/core/llm/providers/IProvider.ts) interface. Twelve providers are wired in directly — ten via API key, two via local CLI bridges that ride an existing Claude Max or Google account subscription. OpenRouter, included in the twelve, fans out to 200+ additional models from the same set of vendors. Every provider speaks the same streaming protocol, supports the same tool-call shape (with the documented exceptions below), and participates in the same cost ledger. The fallback chain is auto-built from whichever keys are set in the environment and is overridable per agent.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the provider breakdown.

The provider matrix contains 9 API-key providers + Ollama + 2 CLI providers, not “10 API-key + 2 CLI-based.” Update both references so the documented categories sum to twelve.

Also applies to: 40-40

🤖 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 `@docs/features/LLM_PROVIDERS.md` at line 3, Update the provider breakdown in
the introductory text and the corresponding reference around the provider
matrix: describe twelve providers as 9 API-key providers, Ollama, and 2 CLI
providers, ensuring the category counts sum to twelve and removing the incorrect
“10 via API key” wording.

const provider = this.pickProvider(
'cheapest',
['groq', 'gemini', 'openai', 'openrouter', 'together', 'mistral', 'xai', 'anthropic', 'ollama'],
['groq', 'gemini', 'atlascloud', 'openai', 'openrouter', 'together', 'mistral', 'xai', 'anthropic', 'ollama'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add atlascloud to the balanced assignment strategies.

atlascloud was successfully added to the preferred lists for the best and cheapest strategies, but it appears to be missing from the balanced tiers implemented below (lines 129-144). If omitted there, atlascloud won't be chosen for balanced workloads when other preferred providers are available.

Consider updating the assignBalanced method to include atlascloud in its preferred lists to ensure it properly participates in balanced provider rotation.

💡 Proposed fix for assignBalanced

Apply the following modifications to assignBalanced (around lines 129-144):

    const provider =
      tier === 'cheap'
        ? this.pickProvider(
            'balanced:cheap',
            ['groq', 'gemini', 'atlascloud', 'openai', 'openrouter', 'together', 'mistral', 'xai', 'anthropic', 'ollama'],
          )
        : tier === 'strong'
          ? this.pickProvider(
              'balanced:strong',
              ['anthropic', 'openai', 'openrouter', 'atlascloud', 'gemini', 'groq', 'xai', 'mistral', 'together', 'ollama'],
            )
          : this.pickProvider(
              'balanced:standard',
              ['openai', 'openrouter', 'atlascloud', 'anthropic', 'gemini', 'groq', 'mistral', 'xai', 'together', 'ollama'],
            );
🤖 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/orchestration/planning/ProviderAssignmentEngine.ts` at line 109, Update
the assignBalanced method’s cheap, strong, and standard preferred-provider lists
to include atlascloud in the same priority positions used by the corresponding
best and cheapest strategies, while preserving the existing balanced rotation
keys and tier selection logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant