Skip to content

fix: catalogue-driven first-run provider auto-detection - #3798

Open
praisonai-triage-agent[bot] wants to merge 2 commits into
mainfrom
claude/issue-3794-20260808-0857
Open

fix: catalogue-driven first-run provider auto-detection#3798
praisonai-triage-agent[bot] wants to merge 2 commits into
mainfrom
claude/issue-3794-20260808-0857

Conversation

@praisonai-triage-agent

@praisonai-triage-agent praisonai-triage-agent Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #3794

Summary

Zero-config praisonai run "…" previously only recognised a hardcoded ~8-provider set when deciding whether credentials were configured and which default model to use. A user with a valid key for any other model-layer-supported provider (Mistral, DeepSeek, Together, Fireworks, xAI, Perplexity, …) was told No API key configured and could not reach first success.

This replaces the three hardcoded lists with a single data catalogue.

Changes

  • llm/catalogue.py — new PROVIDER_ENV_CATALOGUE (provider id → env-var(s), representative default model, model prefix) plus helpers provider_env_vars(), provider_for_model(), env_vars_for_provider(). One source of truth; adding a provider is a data row, not code.
  • llm/credentials.pyis_configured() now honours any catalogued provider's env var (via _known_credential_vars()); _provider_key_vars_for_model() resolves via the catalogue first, keeping the old prefix branches as fallback.
  • llm/env.py_PROVIDER_DEFAULTS is derived from the catalogue (with a literal fallback); _provider_from_model() falls back to the catalogue for catalogued providers so the correct API-key env-var is picked and litellm routes the endpoint.
  • cli/features/setup/handler.py_detect_provider_from_env() widened from the 4-key dict to the full catalogue, reusing _provider_setup_info() for catalogue-only providers.

Backward compatibility

  • Historical 8 providers stay at the head of the catalogue → ordered-preference behaviour unchanged (OpenAI still wins when OPENAI_API_KEY is set).
  • No-key path still returns not-configured and the gpt-4o-mini terminal fallback.
  • Every hardcoded path retains a literal fallback if the catalogue import ever fails.

Validation

  • Repro fixed: MISTRAL_API_KEY=…is_configured()==True, default mistral/mistral-large-latest.
  • 54 targeted first-run / provider / setup tests pass. Remaining suite failures are pre-existing/unrelated (praisonai_bot import, session-rename, memory command).

Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added broader provider discovery through a centralized provider catalogue.
    • Automatically recognizes API-key environment variables for supported providers.
    • Improved provider and default-model detection from model names and prefixes.
    • Added support for configuring catalogue-listed providers without requiring predefined mappings.
  • Bug Fixes

    • Improved credential detection and provider routing for additional model providers.
    • Preserved fallback behavior for existing provider configurations.

Replace the three hardcoded provider lists (is_configured's 8-key tuple,
_PROVIDER_DEFAULTS, and the setup wizard's 4-key env auto-detect) with a
single data catalogue PROVIDER_ENV_CATALOGUE mapping provider id ->
env-var(s) + representative model + model prefix.

Zero-config `praisonai run` now recognises a valid key for any catalogued
provider (Mistral, DeepSeek, Together, Fireworks, xAI, Perplexity, …) and
selects a provider-appropriate default model instead of gating on the old
~8-provider set. The catalogue keeps the historical 8 at its head so
existing ordered-preference behaviour is unchanged and new providers are
purely additive and backward compatible.

Co-authored-by: MervinPraison <MervinPraison@users.noreply.github.com>
@MervinPraison

Copy link
Copy Markdown
Owner

@coderabbitai review

@MervinPraison

Copy link
Copy Markdown
Owner

/review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@MervinPraison MervinPraison added pipeline/blocked:ci Blocked: CI not green on HEAD pipeline/blocked:no-final Blocked: no FINAL @claude trigger yet pipeline/final-claude-pending Reviews done; waiting for FINAL @claude labels Aug 8, 2026
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 70b376bc-0837-4f42-8564-54be1e762f2b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The provider catalogue now defines credential variables, representative models, and model prefixes. Runtime credential checks, default model resolution, and setup environment detection consume this catalogue with historical fallbacks.

Changes

Provider detection

Layer / File(s) Summary
Provider catalogue and lookup helpers
src/praisonai-code/praisonai_code/llm/catalogue.py
Adds provider credential variables, representative models, prefix matching, provider lookup, and case-insensitive credential lookup.
Runtime credential and model resolution
src/praisonai-code/praisonai_code/llm/credentials.py, src/praisonai-code/praisonai_code/llm/env.py
Uses catalogue-defined variables for credential checks and provider resolution while retaining historical fallbacks.
Setup environment detection
src/praisonai-code/praisonai_code/cli/features/setup/handler.py
Detects configured providers from catalogue variables and resolves catalogue-only provider setup details.

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

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant SetupHandler
  participant credentials.py
  participant env.py
  participant PROVIDER_ENV_CATALOGUE

  Environment->>SetupHandler: expose provider credential variables
  SetupHandler->>PROVIDER_ENV_CATALOGUE: discover provider mappings
  PROVIDER_ENV_CATALOGUE-->>SetupHandler: provider and default model
  Environment->>credentials.py: expose configured credentials
  credentials.py->>PROVIDER_ENV_CATALOGUE: resolve known credential variables
  PROVIDER_ENV_CATALOGUE-->>credentials.py: credential variable set
  Environment->>env.py: provide model configuration
  env.py->>PROVIDER_ENV_CATALOGUE: resolve provider and default model
  PROVIDER_ENV_CATALOGUE-->>env.py: provider credential variable
Loading

Possibly related PRs

Suggested reviewers: mervinpraison

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the catalogue-driven provider auto-detection change.
Linked Issues check ✅ Passed The changes address issue #3794 by centralizing provider credentials, models, routing, and setup detection in a shared catalogue.
Out of Scope Changes check ✅ Passed All changed files support the linked issue's provider auto-detection and catalogue-driven configuration objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-3794-20260808-0857

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
Contributor

Choose a reason for hiding this comment

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

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/praisonai-code/praisonai_code/llm/credentials.py`:
- Around line 122-132: Update _stored_providers_for_vars() in
src/praisonai-code/praisonai_code/llm/credentials.py:122-132 to derive provider
names and environment variables from PROVIDER_ENV_CATALOGUE, including
catalogue-only providers such as Mistral, so stored credentials are recognized
by is_configured(). Update the setup provider-resolution flow in
src/praisonai-code/praisonai_code/cli/features/setup/handler.py:430-446 to use
catalogue environment-variable aliases for Together and Fireworks and select
each catalogue provider’s representative model rather than the first
ModelCatalogue model. Add regression tests covering stored credentials and both
Together and Fireworks aliases.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bfe1d843-492d-4dca-a4dd-7cb7da55860e

📥 Commits

Reviewing files that changed from the base of the PR and between 2aa2348 and e67ae99.

📒 Files selected for processing (4)
  • src/praisonai-code/praisonai_code/cli/features/setup/handler.py
  • src/praisonai-code/praisonai_code/llm/catalogue.py
  • src/praisonai-code/praisonai_code/llm/credentials.py
  • src/praisonai-code/praisonai_code/llm/env.py

Comment on lines +122 to +132
try:
from praisonai_code.llm.catalogue import (
provider_for_model,
env_vars_for_provider,
)

provider = provider_for_model(model)
if provider:
vars_ = env_vars_for_provider(provider)
if vars_:
return vars_

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Finish the catalogue migration for stored credentials and setup metadata.

Both paths still derive provider metadata outside PROVIDER_ENV_CATALOGUE.

  • src/praisonai-code/praisonai_code/llm/credentials.py#L122-L132: Derive stored provider names from the catalogue. _stored_providers_for_vars() only contains the historical providers. Therefore, an explicit mistral/... model with a Mistral key saved in CredentialStore and absent from the environment returns False from is_configured().
  • src/praisonai-code/praisonai_code/cli/features/setup/handler.py#L430-L446: Resolve catalogue-only environment variables and default models directly from the catalogue. Non-interactive setup checks only the synthesized canonical variable. For example, praisonai setup --provider together rejects an environment that contains only TOGETHERAI_API_KEY. Setup also selects the first ModelCatalogue model instead of the catalogue representative model.

Add regression tests for stored credentials and both Together and Fireworks credential aliases.

📍 Affects 2 files
  • src/praisonai-code/praisonai_code/llm/credentials.py#L122-L132 (this comment)
  • src/praisonai-code/praisonai_code/cli/features/setup/handler.py#L430-L446
🤖 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/praisonai-code/praisonai_code/llm/credentials.py` around lines 122 - 132,
Update _stored_providers_for_vars() in
src/praisonai-code/praisonai_code/llm/credentials.py:122-132 to derive provider
names and environment variables from PROVIDER_ENV_CATALOGUE, including
catalogue-only providers such as Mistral, so stored credentials are recognized
by is_configured(). Update the setup provider-resolution flow in
src/praisonai-code/praisonai_code/cli/features/setup/handler.py:430-446 to use
catalogue environment-variable aliases for Together and Fireworks and select
each catalogue provider’s representative model rather than the first
ModelCatalogue model. Add regression tests covering stored credentials and both
Together and Fireworks aliases.

@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR centralizes first-run provider credential and model selection in a shared catalogue and extends setup detection to additional providers. The stored-credential endpoint fallback remains incomplete for the newly catalogued providers.

  • Adds a provider-to-environment-variable, model, and prefix catalogue.
  • Uses the catalogue for credential checks, model-provider inference, and setup auto-detection.
  • Preserves historical provider ordering and literal import fallbacks.

Confidence Score: 4/5

The PR is not yet safe to merge because explicit models for newly catalogued providers can fail to load their stored credentials.

Endpoint resolution derives the correct provider environment-variable name from the catalogue, but its stored-credential fallback still maps only historical variables and defaults unmapped providers to OpenAI.

Files Needing Attention: src/praisonai-code/praisonai_code/llm/env.py

Important Files Changed

Filename Overview
src/praisonai-code/praisonai_code/llm/catalogue.py Adds the centralized ordered provider catalogue and lookup helpers used across first-run resolution.
src/praisonai-code/praisonai_code/llm/credentials.py Extends environment and stored-provider configuration checks through the catalogue, resolving the prior incomplete stored-provider mapping.
src/praisonai-code/praisonai_code/llm/env.py Derives provider defaults and model routing from the catalogue, but explicit new-provider models still cannot retrieve their matching stored credentials.
src/praisonai-code/praisonai_code/cli/features/setup/handler.py Extends setup environment detection and provider metadata resolution to catalogue-only providers.
src/praisonai/tests/unit/cli/test_auth_functionality.py Makes environment cleanup account for every catalogued credential variable.
src/praisonai/tests/unit/cli/test_setup_command.py Makes setup test isolation clear all catalogue-recognized provider variables.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  M[Explicit provider-prefixed model] --> P[_provider_from_model]
  P --> C[Catalogue provider key variable]
  C --> E{Environment key set?}
  E -->|Yes| K[Use environment credential]
  E -->|No| F[_KEY_VAR_TO_FALLBACK_PROVIDERS]
  F -->|Mapped historical provider| S[Load matching stored credential]
  F -->|New provider unmapped| O[Default to OpenAI lookup]
  O --> A[Missing or wrong API key]
Loading

Reviews (2): Last reviewed commit: "fix: resolve provider-alias keys and sto..." | Re-trigger Greptile

Comment thread src/praisonai-code/praisonai_code/llm/env.py Outdated
Comment thread src/praisonai-code/praisonai_code/llm/credentials.py
@MervinPraison

Copy link
Copy Markdown
Owner

@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Focus ONLY on Python packages (praisonaiagents, praisonai). Do NOT modify praisonai-rust or praisonai-ts. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding.

Phase 1: Review per AGENTS.md

  1. Protocol-driven: check heavy implementations vs core SDK
  2. Backward compatible: ensure zero feature regressions
  3. Performance: no hot-path regressions
  4. SDK value: review in depth whether the change genuinely adds value to the SDK — never add features for the sake of adding them. It must strengthen the SDK (simpler, more user-friendly, robust, world-class, secure). If it does not clearly add value, request changes or recommend rejecting/closing rather than merging scope creep
  5. Do not bloat the Agent class with additional params — only if absolutely required; we already support many params.
  6. Repo routing: agent-callable tools → PraisonAI-Tools; lifecycle plugins → PraisonAI-Plugins; optional sandbox backends → PraisonAI-Plugins (praisonai.sandbox entry point) — request changes if wrongly added to praisonaiagents/

Phase 2: FIX Valid Issues
7. For any VALID bugs or architectural flaws found by Gemini, CodeRabbit, Qodo, Copilot, or any other reviewer: implement the fix
8. Also independently identify and fix any gaps or issues you find in the changed code — do not rely only on prior reviewer feedback
9. Push all code fixes directly to THIS branch (do NOT create a new PR)
10. Comment a summary of exact files modified and what you skipped

Phase 3: Final Verdict
11. If all issues are resolved, approve the PR / close the Issue
12. If blocking issues remain, request changes / leave clear action items

@MervinPraison MervinPraison added pipeline/awaiting-merge-gate FINAL done; waiting for merge gate / CI pipeline/blocked:cooldown Blocked: post-push or @claude cooldown claude-ci-fix-pending and removed pipeline/final-claude-pending Reviews done; waiting for FINAL @claude pipeline/blocked:no-final Blocked: no FINAL @claude trigger yet labels Aug 8, 2026
@MervinPraison

Copy link
Copy Markdown
Owner

@claude CI failed on HEAD e67ae99e. Please fix the failures below and push to this branch.

Failed checks

Failures (extracted)

  1. tests/unit/cli/test_auth_functionality.py::test_auth_integrationAssertionError: Should use default model
    • Job: test-core (cli)
  2. tests/unit/cli/test_auth_functionality.py::test_llm_endpoint_resolutionAssertionError: Should use default model
    • Job: test-core (cli)
  3. tests/unit/cli/test_setup_command.py::TestSetupCommand::test_setup_interactive_modeassert 1 == 0
    • Job: test-core (cli)

Critical review first

Before changing code or tests, decide which side is wrong:

  1. Legitimate feature change — the PR intent is correct but implementation or tests need updating. Preserve SDK guarantees; update tests only when behaviour intentionally changed and document why.
  2. Regression / bug in this PR — the failure exposes a real breakage introduced here. Fix the implementation; do not weaken, skip, or delete tests just to go green.
  3. Pre-existing flake or unrelated failure — say so explicitly; prefer fixing the root cause over masking it.

SDK guardrails (AGENTS.md):

  • Agent-callable tools → PraisonAI-Tools; lifecycle plugins → PraisonAI-Plugins; sandbox backends → PraisonAI-Plugins (praisonai.sandbox) — not praisonaiagents/.
  • Do not disturb core SDK contracts to accommodate a wrapper/feature change.
  • Tests must continue to guard backward compatibility and hot-path behaviour — passing CI by lowering test standards is not acceptable.
  • If the feature does not genuinely add SDK value, recommend reverting or narrowing scope instead of patching around failures.

What to do

  1. State your verdict: legitimate fix, regression fix, or needs human review — and why (1–3 sentences).
  2. Fix root cause with minimal changes; never bloat the Agent class with extra params.
  3. Run failing tests locally, e.g. pytest tests/unit/cli/test_auth_functionality.py::test_auth_integration -q, plus any related SDK tests touched by the PR.
  4. Push to this branch and comment: files changed, review verdict, and why tests still protect SDK behaviour.

@praisonai-triage-agent

praisonai-triage-agent Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Claude finished @MervinPraison's task —— View job


Final Architecture Review — PR #3798

Pushed fixes to claude/issue-3794-20260808-0857 (517ecc5).

Phase 1 — Architecture (AGENTS.md)

  • Routing: all changes stay in the praisonai_code wrapper (llm/, cli/features/setup/). No praisonaiagents/ core surface, no new Agent params, no new deps. Correct per routing rules. ✅
  • Protocol-driven / lightweight: collapses 3 hardcoded provider lists into a single data catalogue — reduces surface area rather than adding knobs. Genuine SDK value (zero-config now covers all model-layer providers). ✅
  • Backward compatible: historical 8 providers remain at the head of the catalogue (ordered preference preserved, OpenAI still wins); every catalogue consumer keeps a literal fallback. ✅
  • Performance: all catalogue lookups are cheap dict/tuple ops on cold first-run paths — no hot-path impact. ✅
  • Scope: praisonai-rust / praisonai-ts untouched. ✅

Phase 2 — Valid issues fixed

# Source Issue Fix
1 Greptile P1 env.py returned vars_[0] → alias-only key (TOGETHERAI_API_KEY, FIREWORKS_AI_API_KEY) yielded no api_key at the endpoint _provider_from_model now prefers whichever alias is actually set
2 CodeRabbit + Greptile P1 credentials.py _stored_providers_for_vars only mapped historical vars → stored Mistral/DeepSeek/xAI/… key with explicit prefixed model returned is_configured()==False derived from PROVIDER_ENV_CATALOGUE (aliases layered on top)
3 CodeRabbit Major setup used first ModelCatalogue model + synthesized canonical var only _provider_setup_info now uses catalogue env-var (alias-aware) + representative model

Verified functionally: Together/Fireworks alias-only → correct key var; stored-only Mistral cred → is_configured("mistral/…")==True; canonical fallback intact.

CI failures — verdict: legitimate feature, test helpers were stale

The widened detection is correct SDK behaviour. The 3 failing test-core (cli) tests assumed only ~8 historical keys existed, so a stray catalogued key on the CI host (e.g. OPENROUTER_API_KEY) made detection (correctly) pick it up and break the gpt-4o-mini / interactive-path assertions. I strengthened the tests — their env-clearing/detection lists now derive from PROVIDER_ENV_CATALOGUE (with literal fallback) so they stay deterministic as providers are added. No assertions weakened, skipped, or deleted.

Proven: the three tests pass even when OPENROUTER_API_KEY + MISTRAL_API_KEY are exported (simulated CI).

Tests

  • test_auth_functionality.py + test_setup_command.py: 21 passed.
  • Related provider/auth/setup/credential suite: 67 passed (10 failures are pre-existing test_mock_provider.py async tests failing only due to missing pytest-asyncio locally — unrelated to this PR).

Files modified

  • llm/env.py — alias-aware key resolution
  • llm/credentials.py — catalogue-driven stored-provider mapping
  • cli/features/setup/handler.py — catalogue env-var + representative model
  • tests/unit/cli/test_auth_functionality.py, test_setup_command.py — catalogue-derived env lists

Skipped

  • Docstring/unit-test "finishing touches" from bots (no live consumer / not required).

Verdict

Approve. All blocking reviewer issues resolved, CI root cause fixed at source, backward compatibility and SDK guardrails intact.


Job run · Branch claude/issue-3794-20260808-0857

…t-run tests

- env.py: _provider_from_model prefers the env-set credential alias so
  Together/Fireworks (TOGETHERAI_API_KEY, FIREWORKS_AI_API_KEY) resolve a key
  instead of always using the first declared var.
- credentials.py: _stored_providers_for_vars derives from PROVIDER_ENV_CATALOGUE
  so a stored key for any catalogued provider (Mistral, DeepSeek, xAI, Together,
  Perplexity, Fireworks) satisfies is_configured() for its explicit model.
- setup/handler.py: _provider_setup_info picks the catalogue env-var (honouring
  the alias actually set) and the catalogue representative model for
  catalogue-only providers.
- tests: derive the env-clearing/detection key lists from the catalogue so
  default-model and interactive-path assertions stay deterministic even when the
  CI host exports a catalogued key (e.g. OPENROUTER_API_KEY). Fixes the three
  failing test-core (cli) checks without weakening assertions.

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
@MervinPraison MervinPraison added pipeline/blocked:stale-final Blocked: FINAL stale after new commits and removed pipeline/blocked:stale-final Blocked: FINAL stale after new commits labels Aug 8, 2026
@praisonai-triage-agent

praisonai-triage-agent Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Claude finished @MervinPraison's task —— View job


CI Fix — PR #3798

  • Verify current branch state (HEAD vs failing commit e67ae99e)
  • Run the 3 failing tests locally
  • Confirm root cause & reviewer P1 fixes present
  • Push & summarize

Verdict: legitimate feature — already fixed

The CI failure was reported against e67ae99e, but branch HEAD is now 517ecc5 ("resolve provider-alias keys and stored creds; deterministic first-run tests"), which is exactly the fix commit. Local origin already matches — nothing to push.

The widened catalogue-driven detection is correct SDK behaviour. The three tests failed on CI because they assumed only the historical ~8 provider keys existed; a stray catalogued key on the CI host (e.g. OPENROUTER_API_KEY) made detection correctly pick it up, breaking the gpt-4o-mini / interactive-path assertions. The already-pushed fix makes the tests' env-clearing/detection lists derive from PROVIDER_ENV_CATALOGUE so they stay deterministic — no assertions weakened, skipped, or deleted.

Local verification (branch HEAD 517ecc5)

1. The 3 originally-failing tests — clean env:

tests/unit/cli/test_auth_functionality.py::test_auth_integration        PASSED
tests/unit/cli/test_auth_functionality.py::test_llm_endpoint_resolution PASSED
tests/unit/cli/test_setup_command.py::...::test_setup_interactive_mode   PASSED
3 passed

2. Full auth + setup suites — simulating CI with 5 stray provider keys exported (OPENROUTER, MISTRAL, TOGETHERAI, FIREWORKS_AI, DEEPSEEK):

21 passed

Deterministic under the exact condition that broke CI.

Reviewer P1 issues — confirmed fixed in current code

Source Issue Status
Greptile P1 env.py discarded alias keys → alias-only TOGETHERAI_API_KEY/FIREWORKS_AI_API_KEY yielded no api_key env.py:184 now next((var for var in vars_ if os.environ.get(var)), vars_[0])
CodeRabbit + Greptile P1 stored Mistral/DeepSeek/xAI cred + explicit prefixed model → is_configured()==False credentials.py:196-244 _stored_providers_for_vars derived from PROVIDER_ENV_CATALOGUE
CodeRabbit Major setup used first ModelCatalogue model + synthesized canonical var handler.py uses catalogue env-var (alias-aware) + representative model

Files changed by me

None — all fixes were already present and pushed at 517ecc5. Working tree clean; local HEAD == origin/claude/issue-3794-20260808-0857.

SDK guardrails

All changes stay in the praisonai_code wrapper (llm/, cli/features/setup/). No praisonaiagents/ core surface, no new Agent params, no new deps, praisonai-rust/praisonai-ts untouched. Tests still guard backward compatibility (historical 8 providers keep ordered preference; no-key path still returns not-configured with gpt-4o-mini fallback).

The branch is green-ready. If CI still shows red, it is stale against e67ae99e; a re-run on 517ecc5 should pass.


Job run · Branch claude/issue-3794-20260808-0857

Comment on lines +185 to +186
)
return key_var, None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Stored provider lookup defaults to OpenAI

When an explicit Mistral, DeepSeek, xAI, Together, Perplexity, or Fireworks model relies on a CLI-stored credential rather than an environment variable, _provider_from_model returns the catalogue credential variable but _KEY_VAR_TO_FALLBACK_PROVIDERS does not recognize it. The fallback consequently queries the OpenAI credential namespace, returning no key or the wrong key and causing the LLM request to fail authentication.

Knowledge Base Used: praisonai-code

@praisonai-triage-agent praisonai-triage-agent Bot removed the pipeline/blocked:cooldown Blocked: post-push or @claude cooldown label Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-ci-fix-pending pipeline/awaiting-merge-gate FINAL done; waiting for merge gate / CI pipeline/blocked:ci Blocked: CI not green on HEAD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First run: auto-detect any configured provider from the environment (catalogue-driven), not a hardcoded 8-provider list

1 participant