Skip to content

Model Aliases in system prompt cause LLM to substitute providers unexpectedly #61949

Description

@lucca-alma

Environment

  • OpenClaw version: 2026.3.28 (f9b1079)
  • OS: macOS 15.7.2 (arm64)
  • Note: We have not tested on 2026.4.x versions due to disruptive changes in tool call permissions/UX.

Summary

When multiple providers are configured for equivalent models (e.g., github-copilot/claude-sonnet-4.6 and amazon-bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0), the Model Aliases section injected into the system prompt causes the LLM to treat them as interchangeable. This leads to unexpected provider substitution.

Observed Behavior

  1. Dispatcher requests sub-agent with explicit model: github-copilot/claude-sonnet-4.6
  2. The LLM (Opus) receives this in a prompt: Model: "github-copilot/claude-sonnet-4.6"
  3. The LLM sees the Model Aliases in its system prompt:
    ## Model Aliases
    Prefer aliases when specifying model overrides; full provider/model is also accepted.
    - Bedrock Sonnet 4: amazon-bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0
    ...
    
  4. The LLM interprets "Sonnet 4" as equivalent across providers
  5. When calling sessions_spawn, it substitutes amazon-bedrock/... instead of passing through the requested github-copilot/...

Why This Is a Problem

Different providers for the "same" model are not equivalent:

  • Different API behaviors: Bedrock's Converse API has strict thinking block requirements that GitHub Copilot doesn't
  • Different auth mechanisms: One uses OAuth/token, the other uses AWS SDK
  • Different cost structures: Bedrock is significantly more expensive
  • Different rate limits and availability

In our case, sub-agents were crashing immediately because Bedrock Sonnet 4 with thinking enabled requires assistant messages to start with thinking blocks — a constraint the LLM violated after receiving tool results. The crash happened silently with no advance/retreat, causing infinite dispatch loops.

Root Cause

The "Model Aliases" section in the system prompt teaches the LLM that different provider paths are interchangeable:

Prefer aliases when specifying model overrides; full provider/model is also accepted.

This invites the LLM to "helpfully" translate a specific provider/model request to whatever alias it recognizes, even when an explicit provider is specified.

Suggested Fix

Options (not mutually exclusive):

  1. Don't inject aliases for multi-provider overlaps — if two providers offer the same underlying model, don't suggest they're equivalent
  2. Change alias guidance — instead of "prefer aliases," say "use the exact provider/model string when one is specified"
  3. Separate aliases from provider routing — aliases should be for user convenience ("use sonnet"), not for LLM decision-making about provider selection
  4. Make provider explicit — when a full provider/model string is given, the LLM should pass it through verbatim, not interpret it

Workaround

We're removing Bedrock from our config entirely to prevent this. The aliases will no longer be injected, and the LLM won't have alternative providers to choose from.

Config That Triggered This

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "github-copilot/claude-opus-4.5",
        "fallbacks": ["amazon-bedrock/us.anthropic.claude-opus-4-5-20251101-v1:0"]
      },
      "models": {
        "amazon-bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0": {"alias": "Bedrock Sonnet 4"},
        ...
      }
    }
  },
  "models": {
    "providers": {
      "amazon-bedrock": { ... },
      "github-copilot": { ... }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions