Skip to content

fix(status): show configured fallback models in /status output#33111

Merged
altaywtf merged 6 commits intoopenclaw:mainfrom
AnCoSONG:fix/status-show-fallback-models
Apr 9, 2026
Merged

fix(status): show configured fallback models in /status output#33111
altaywtf merged 6 commits intoopenclaw:mainfrom
AnCoSONG:fix/status-show-fallback-models

Conversation

@AnCoSONG
Copy link
Copy Markdown
Contributor

@AnCoSONG AnCoSONG commented Mar 3, 2026

Fixes #33099

Previously, the /status command only showed fallback models when they were actively being used (i.e., when the primary model failed and a fallback was activated). This made it hard for users to verify their fallback configuration without checking the raw config.

Changes

  • Added "configuredFallbacksLine" to display configured fallback models from "agents.defaults.model.fallbacks"
  • The fallback line shows as "🔄 Fallbacks: model1, model2" when fallbacks are configured
  • Active fallback state is still shown separately with "↪️ Fallback: ..."
  • Added tests for the new functionality

Example Output

With config:
"""json
"model": {
"primary": "anthropic/claude-opus-4-6",
"fallbacks": ["google/gemini-2.5-flash"]
}
"""

Status now shows:
""\

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR adds a configuredFallbacksLine to the /status output so users can see which fallback models are configured before a live failover actually happens. The core change is a small read in buildStatusMessage that surfaces agent.model.fallbacks, and a corresponding update in buildStatusText that resolves agent-specific vs. inherited fallbacks via resolveAgentModelFallbacksOverride before forwarding them. Tests cover the primary scenarios: per-agent override, inheritance from defaults, and the empty-array "disable inherited fallbacks" case.

Confidence Score: 5/5

Safe to merge — all remaining findings are P2 or lower and do not affect correctness.

The logic is straightforward: read model.fallbacks from the resolved agent config and format it. The three-tier inheritance (agent override → agent has no override, inherit defaults → empty array disables) is handled correctly and covered by targeted tests. The fallback state display is additive and does not change any existing behavior.

No files require special attention.

Vulnerabilities

No security concerns identified. The change reads model config strings from the already-validated config object and formats them for display only.

Reviews (2): Last reviewed commit: "fix(status): keep fallback changelog ent..." | Re-trigger Greptile

Copy link
Copy Markdown

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

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: 39aabbab2a

ℹ️ 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".

Comment on lines +655 to +657
const modelConfig = args.agent?.model;
if (typeof modelConfig === "object" && modelConfig && Array.isArray(modelConfig.fallbacks)) {
return modelConfig.fallbacks;
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 Derive displayed fallbacks from effective agent settings

Reading modelConfig.fallbacks from args.agent here causes /status to report the wrong fallback list for non-default agents, because both status callers currently construct args.agent from cfg.agents.defaults (src/auto-reply/reply/commands-status.ts:162-170, src/agents/tools/session-status-tool.ts:351-356). If an agent overrides model.fallbacks (or sets [] to disable global fallbacks), the new line will still show default fallbacks, so users get incorrect configuration feedback even though runtime fallback resolution honors per-agent overrides.

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle bot added agents Agent runtime and tooling size: S and removed size: XS labels Mar 3, 2026
@AnCoSONG
Copy link
Copy Markdown
Contributor Author

AnCoSONG commented Mar 4, 2026

关于 CI 失败的说明

当前 CI 中的失败看起来是已知的 flaky tests,而非本 PR 代码改动造成:

失败的 checks:

验证:

  • ✅ 本地 pnpm test:28/28 通过
  • ✅ Linux CI (checks node test):通过

建议维护者可以重跑失败的 checks,或者考虑在已知 flaky 的情况下 review 合并。

cc @maintainers

@altaywtf altaywtf self-assigned this Apr 8, 2026
@altaywtf altaywtf force-pushed the fix/status-show-fallback-models branch from f86fe90 to 35a76cc Compare April 8, 2026 10:58
@openclaw-barnacle openclaw-barnacle bot removed the agents Agent runtime and tooling label Apr 8, 2026
@altaywtf altaywtf force-pushed the fix/status-show-fallback-models branch 7 times, most recently from dbef32f to 8e15c41 Compare April 9, 2026 08:49
@altaywtf altaywtf requested a review from Copilot April 9, 2026 08:50
@altaywtf
Copy link
Copy Markdown
Member

altaywtf commented Apr 9, 2026

@greptileai review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the /status command (and shared status card output) to always display the configured model fallback chain, not only the active fallback when a failover happens. This improves visibility into agents.defaults.model.fallbacks and per-agent fallback overrides.

Changes:

  • Add a new “🔄 Fallbacks: …” line in buildStatusMessage() when fallbacks are configured.
  • Wire per-agent fallback overrides into /status construction so the displayed list matches the effective agent configuration.
  • Add/extend tests to cover configured fallbacks display, inheritance, and explicit disabling.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/auto-reply/status.ts Adds rendering of configured fallback models into the status message output.
src/auto-reply/status.test.ts Adds unit tests asserting the configured fallbacks line appears/omits correctly.
src/auto-reply/reply/commands-status.ts Threads per-agent fallback override into the status message’s agent model config.
src/auto-reply/reply/commands-status.thinking-default.test.ts Adds integration-style tests verifying per-agent fallback overrides/inheritance in status reply output.
CHANGELOG.md Documents the behavior change for /status and shared status cards.

Comment on lines +793 to +803
// Show configured fallback models (from agent model config)
const configuredFallbacks = (() => {
const modelConfig = args.agent?.model;
if (typeof modelConfig === "object" && modelConfig && Array.isArray(modelConfig.fallbacks)) {
return modelConfig.fallbacks;
}
return undefined;
})();
const configuredFallbacksLine = configuredFallbacks?.length
? `🔄 Fallbacks: ${configuredFallbacks.join(", ")}`
: null;
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The configured fallback list is displayed verbatim via configuredFallbacks.join(", "). Since AgentModelSchema allows arbitrary strings (including whitespace/empty strings and duplicates), /status can show blank entries or repeated models (e.g., Fallbacks: , openai/gpt-4.1, openai/gpt-4.1). Consider normalizing the list before rendering (trim, drop empty, de-dupe case-insensitively) to keep status output clean and consistent with other places that normalize fallback lists (e.g., gateway agent listing).

Copilot uses AI. Check for mistakes.
AnCoSONG and others added 6 commits April 9, 2026 10:12
Fixes openclaw#33099

Previously, the /status command only showed fallback models when they were
actively being used. Now it also displays configured fallback models from
agents.defaults.model.fallbacks so users can verify their setup at a glance.

- Added configuredFallbacksLine to show fallback models from config
- Added tests for the new functionality
PR Review Feedback:
- Use resolveAgentModelFallbacksOverride() to get agent-specific fallbacks
- Fixes incorrect fallback display for non-default agents
- Agent can now set fallbacks: [] to disable global fallbacks
@altaywtf altaywtf force-pushed the fix/status-show-fallback-models branch from 8e15c41 to 5e590aa Compare April 9, 2026 09:12
@altaywtf altaywtf merged commit 1b24560 into openclaw:main Apr 9, 2026
24 of 26 checks passed
@altaywtf
Copy link
Copy Markdown
Member

altaywtf commented Apr 9, 2026

Merged via squash.

Thanks @AnCoSONG!

steipete pushed a commit that referenced this pull request Apr 10, 2026
Merged via squash.

Prepared head SHA: 5e590aa
Co-authored-by: AnCoSONG <32268203+AnCoSONG@users.noreply.github.com>
Co-authored-by: altaywtf <9790196+altaywtf@users.noreply.github.com>
Reviewed-by: @altaywtf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fallback model not shown in /status output

3 participants