Skip to content

feat: add Atlas Cloud Chat Completions support - #1131

Open
binyangzhu000-sudo wants to merge 2 commits into
massgen:mainfrom
binyangzhu000-sudo:codex/atlascloud-chatcompletion
Open

feat: add Atlas Cloud Chat Completions support#1131
binyangzhu000-sudo wants to merge 2 commits into
massgen:mainfrom
binyangzhu000-sudo:codex/atlascloud-chatcompletion

Conversation

@binyangzhu000-sudo

@binyangzhu000-sudo binyangzhu000-sudo commented Aug 10, 2026

Copy link
Copy Markdown

Description

Adds Atlas Cloud support to the generic Chat Completions backend by:

  • detecting ATLASCLOUD_API_KEY for https://api.atlascloud.ai/v1
  • identifying Atlas Cloud in provider-specific logging and diagnostics
  • documenting the endpoint and environment variable
  • adding a validated single-agent example configuration

Type of change

  • New feature (feat:) - Non-breaking change which adds functionality

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove the feature works
  • New and existing focused unit tests pass locally

Pre-commit status

All applicable hooks pass. The configured pyupgrade hook crashes under Python 3.14 before inspecting files due to an upstream compatibility error; the same configured pyupgrade --py311-plus check passes under Python 3.13.

How to Test

uv run pytest massgen/tests/test_chat_completions_refactor.py -q
uv run python scripts/validate_all_configs.py
uv build --wheel

A live request through the MassGen-created backend to qwen/qwen3.8-max at the Atlas Cloud endpoint also completed successfully.

Summary by CodeRabbit

  • New Features

    • Added Atlas Cloud as a supported Chat Completions provider.
    • Added automatic API key detection using ATLASCLOUD_API_KEY.
    • Added a ready-to-use single-agent configuration with a Qwen model.
    • Documented Atlas Cloud’s endpoint and account-specific model IDs.
  • Bug Fixes

    • Added clear configuration errors when the Atlas Cloud API key is missing.
    • Improved validation for Atlas Cloud endpoints.
  • Tests

    • Added coverage for provider detection, API key resolution, and missing-key errors.

Signed-off-by: binyangzhu000-sudo <224954946+binyangzhu000-sudo@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e34dff2b-040d-4dc8-956d-414a2542c1a6

📥 Commits

Reviewing files that changed from the base of the PR and between 2fee372 and 782dd2b.

📒 Files selected for processing (5)
  • massgen/backend/chat_completions.py
  • massgen/cli/backends.py
  • massgen/configs/basic/single/single_atlascloud.yaml
  • massgen/tests/test_chat_completions_refactor.py
  • massgen/utils/provider_urls.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • massgen/backend/chat_completions.py
  • massgen/cli/backends.py
  • massgen/configs/basic/single/single_atlascloud.yaml

Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Atlas Cloud is added as a ChatCompletion provider. The change adds URL validation, provider detection, API-key resolution, configuration errors, documentation, a single-agent configuration, and regression tests.

Changes

Atlas Cloud provider support

Layer / File(s) Summary
Provider detection and credential resolution
massgen/utils/provider_urls.py, massgen/backend/chat_completions.py, massgen/cli/backends.py
Atlas Cloud URLs are validated and identify the provider. create_backend reads ATLASCLOUD_API_KEY and raises ConfigurationError when the key is absent.
Provider validation coverage
massgen/tests/test_chat_completions_refactor.py
Tests cover trusted and rejected URLs, API-key isolation, provider configuration, and missing credentials.
Provider documentation and example configuration
.env.example, docs/source/reference/supported_models.rst, massgen/configs/BACKEND_CONFIGURATION.md, massgen/configs/basic/single/single_atlascloud.yaml
Documentation and configuration examples list Atlas Cloud, its endpoint, credential variable, and account-specific model IDs.

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

Merge Risk: ⚪ Minimal · up to 782dd

This change adds Atlas Cloud support and related documentation and examples without any supplied actionable merge-blocking risk; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant BackendConfig
  participant create_backend
  participant is_atlascloud_url
  participant Environment
  participant ConfigurationError
  BackendConfig->>create_backend: pass Atlas Cloud base URL
  create_backend->>is_atlascloud_url: validate base URL
  is_atlascloud_url-->>create_backend: return provider match
  create_backend->>Environment: read ATLASCLOUD_API_KEY
  Environment-->>create_backend: return API key
  Environment-->>ConfigurationError: key unavailable
Loading
🚥 Pre-merge checks | ✅ 6 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Documentation Updated ⚠️ Warning The PR adds Atlas Cloud as a user-facing provider but changes no docs/source/user_guide/*.rst; its documentation updates are limited to reference and config files. Add an Atlas Cloud setup and usage section to a relevant docs/source/user_guide/*.rst page, including ATLASCLOUD_API_KEY, base_url, and model configuration.
Capabilities Registry Check ⚠️ Warning The PR adds Atlas Cloud backend handling and qwen/qwen3.8-max, but main...HEAD has no capabilities.py update; the registry still exposes only generic chatcompletion/custom metadata. Update massgen/backend/capabilities.py for the introduced backend/model capabilities, then run uv run pytest massgen/tests/test_backend_capabilities.py -v; uv and pytest were unavailable here.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required feat format and clearly summarizes the main change: Atlas Cloud Chat Completions support.
Description check ✅ Passed The description explains the feature, marks the change type, documents testing, reports validation results, and notes the pre-commit limitation.
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.
Config Parameter Sync ✅ Passed The added YAML uses existing keys only; no new YAML parameter names were introduced. Both required methods already derive exclusions from the shared canonical set.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

❤️ Share

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

@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 `@massgen/cli/backends.py`:
- Around line 242-250: Replace substring-based Atlas Cloud detection with one
shared URL-host predicate that safely parses the hostname and accepts only the
approved exact host and valid subdomains, excluding userinfo and query-string
tricks. Use this predicate in massgen/cli/backends.py lines 242-250 to decide
whether to load ATLASCLOUD_API_KEY, and in massgen/backend/chat_completions.py
lines 1149-1150 within ChatCompletionsBackend.get_provider_name(); add tests
covering exact-host, subdomain-boundary, userinfo, and query-string cases.

In `@massgen/configs/basic/single/single_atlascloud.yaml`:
- Around line 1-8: The configuration example needs a “What happens” comment
describing the Atlas Cloud request, the textual terminal output, and the
required ATLASCLOUD_API_KEY. Add this comment near the existing invocation
comment in the YAML file, while preserving the current configuration.
🪄 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: CHILL

Plan: Pro Plus

Run ID: fc314023-eb92-47b6-9bc1-8fa3330b5ccd

📥 Commits

Reviewing files that changed from the base of the PR and between 007bd85 and 2fee372.

📒 Files selected for processing (7)
  • .env.example
  • docs/source/reference/supported_models.rst
  • massgen/backend/chat_completions.py
  • massgen/cli/backends.py
  • massgen/configs/BACKEND_CONFIGURATION.md
  • massgen/configs/basic/single/single_atlascloud.yaml
  • massgen/tests/test_chat_completions_refactor.py

Comment thread massgen/cli/backends.py Outdated
Comment thread massgen/configs/basic/single/single_atlascloud.yaml
Signed-off-by: binyangzhu000-sudo <142146267+binyangzhu000-sudo@users.noreply.github.com>
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