Skip to content

[Bug]: /status usage should follow session-selected model after /model switch #93322

Description

@rollingshmily

Bug type

Bug / model switching status regression

Summary

After switching a live session with /model, the /status / session_status card should resolve provider usage from the session-selected model, not from the configured default model/provider.

On OpenClaw 2026.6.6, a live Telegram direct session was pinned to openai/gpt-5.5, but /status displayed a DeepSeek API balance as the single status-card usage line:

🧠 Model: openai/gpt-5.5 · 🔑 api-key (models.json) (default: deepseek/deepseek-v4-flash)
📊 Usage: Balance ¥22.75

That Balance ¥22.75 is the DeepSeek provider balance, while the active session model shown on the same card is OpenAI.

Why this is wrong

/model is session-scoped. Users expect /status for that session to answer: "what model/auth/usage is this session currently using?"

If the configured default is DeepSeek but the current session is switched to OpenAI, /status should show OpenAI usage/limits.

Conversely, if the configured default is OpenAI but the current session is switched to DeepSeek, /status should show DeepSeek usage/balance.

The status card should follow the current session's selected/effective model, not the global default model.

Steps to reproduce

  1. Configure OpenClaw with default model/provider set to DeepSeek, for example:
deepseek/deepseek-v4-flash
  1. In a live Telegram/direct session, switch the session model:
/model openai/gpt-5.5
  1. Run /status or invoke session_status for the current session.

Expected behavior

The status card should show usage for the session-selected/effective model provider:

🧠 Model: openai/gpt-5.5 ... (default: deepseek/deepseek-v4-flash)
📊 Usage: 5h ... left · Week ... left

or otherwise omit the usage line if OpenAI/Codex usage cannot be resolved.

It should not show DeepSeek balance as the usage line for an OpenAI-selected session.

Actual behavior

/status showed the selected model as OpenAI but the usage line as DeepSeek balance:

🧠 Model: openai/gpt-5.5 · 🔑 api-key (models.json) (default: deepseek/deepseek-v4-flash)
📊 Usage: Balance ¥22.75

Running openclaw status --usage on the same host showed both provider usage snapshots, including OpenAI usage, so the OpenAI usage source existed. The bug is specifically that the session status card picked/displayed the wrong provider summary for the current session.

Environment

OpenClaw 2026.6.6 (8c802aa)
OS: Debian/Linux 6.1.0-34-amd64 x64
Gateway: systemd user service
Channel: Telegram direct session
Session: agent:main:main
Session selected model: openai/gpt-5.5
Configured default model: deepseek/deepseek-v4-flash

Suspected cause

The status text path appears to mix raw/default provider inputs with session override fields when deciding which provider usage summary to load.

A likely fix is to resolve a single "selected/effective session model" first, using sessionEntry.providerOverride / sessionEntry.modelOverride when present, and use that same resolved provider/model for:

  • status card model line
  • runtime/auth resolution
  • currentUsageProvider / provider usage summary selection

This also appears related to the broader session model/auth state split tracked in #87957 and model-switch state bugs like #92415.

Acceptance criteria

  • After /model openai/gpt-5.5, /status usage follows OpenAI/Codex usage, not the configured default provider.
  • After switching back to a DeepSeek model, /status usage follows DeepSeek balance/usage.
  • The behavior is consistent between /status and session_status.
  • If usage cannot be resolved for the selected provider, the status card should omit the provider usage line or show an error for that selected provider, not silently display another provider's usage.

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:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.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