Skip to content

fix: default fallback chain excludes Cerebras and Groq providers #17

Closed

Description

@stackbilt-admin

CodeBeast Audit Finding — P2 MEDIUM

Severity: P2 — Medium
Category: Correctness
File: factory.ts:229

Problem

// Default priority: Cloudflare (cheapest) -> Anthropic -> OpenAI
return ['cloudflare', 'anthropic', 'openai'];

When costOptimization is disabled, the default fallback chain is hardcoded to 3 providers. Cerebras and Groq are never included as fallback candidates, even when configured.

A consumer who configures all 5 providers but doesn't set explicit fallback rules will never fall back to Cerebras or Groq — they're invisible to the chain.

Fix

Include all configured providers in the default chain:

const allProviders = Array.from(this.providers.keys());
// Still prefer the configured order, but include everyone
return ['cloudflare', 'cerebras', 'groq', 'anthropic', 'openai']
    .filter(p => allProviders.includes(p));

🤖 Filed by CodeBeast audit

Activity

  1. added
    bug
    P2-medium
    audit
    on Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2-mediumauditbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions