Skip to content

fix(tui): resolve wrong provider prefix when session has model without modelProvider#25874

Merged
gumadeiras merged 7 commits intoopenclaw:mainfrom
byungsker:fix/tui-status-bar-wrong-provider-prefix
Feb 25, 2026
Merged

fix(tui): resolve wrong provider prefix when session has model without modelProvider#25874
gumadeiras merged 7 commits intoopenclaw:mainfrom
byungsker:fix/tui-status-bar-wrong-provider-prefix

Conversation

@byungsker
Copy link
Copy Markdown

@byungsker byungsker commented Feb 24, 2026

Problem

Closes #25408

When a session was reset (via /new or /reset), the TUI status bar could display a wrong provider prefix — e.g. google-gemini-cli/claude-sonnet-4-6 instead of anthropic/claude-sonnet-4-6.

Root cause (two-part):

  1. Missing modelProvider copy on session reset (src/gateway/server-methods/sessions.ts): sessions.reset copied the previous entry's model field to the new entry but did not copy modelProvider. This left the new entry with modelProvider = null.

  2. Wrong fallback in resolveSessionModelRef (src/gateway/session-utils.ts): When runtimeProvider is null and the stored runtimeModel has no / separator (e.g. "claude-sonnet-4-6"), the code used provider || DEFAULT_PROVIDER as the fallback. Here provider was resolved from the config's default_model (e.g. google-gemini-cli), producing the wrong prefix.

Fix

1. Copy modelProvider on session reset

// src/gateway/server-methods/sessions.ts
entry: { ...existing, model: existing.model, modelProvider: existing.modelProvider },

2. Defensive fallback in resolveSessionModelRef

When the stored model string contains no provider prefix (/), fall back to DEFAULT_PROVIDER ("anthropic") rather than the config default_model's provider — a bare model name like claude-sonnet-4-6 is always an Anthropic model:

// Before
const parsedRuntime = parseModelRef(runtimeModel, provider || DEFAULT_PROVIDER);

// After
const fallbackProvider = runtimeModel.includes("/")
  ? provider || DEFAULT_PROVIDER
  : DEFAULT_PROVIDER;
const parsedRuntime = parseModelRef(runtimeModel, fallbackProvider);

Testing

Two new tests added to src/gateway/session-utils.test.ts:

  • bare model string (no /) with a non-Anthropic config default → uses DEFAULT_PROVIDER
  • fully-qualified model string (anthropic/claude-sonnet-4-6) → provider parsed from the string itself

All 97 test files pass.

Greptile Summary

Fixed TUI status bar displaying wrong provider prefix after session reset by ensuring modelProvider is preserved during reset and implementing defensive fallback logic for legacy sessions. The changes prevent cross-contamination between config defaults and session state (e.g., preventing google-gemini-cli/claude-sonnet-4-6 when it should be anthropic/claude-sonnet-4-6).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is focused, well-tested, and addresses a clear bug with comprehensive test coverage. The changes are minimal and defensive, with no breaking changes or risky refactoring.
  • No files require special attention

Last reviewed commit: 86bbc93

@gumadeiras gumadeiras self-assigned this Feb 25, 2026
@gumadeiras gumadeiras force-pushed the fix/tui-status-bar-wrong-provider-prefix branch from 86bbc93 to ff6b44c Compare February 25, 2026 02:04
@gumadeiras gumadeiras force-pushed the fix/tui-status-bar-wrong-provider-prefix branch from ff6b44c to 4c197fd Compare February 25, 2026 02:05
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations agents Agent runtime and tooling labels Feb 25, 2026
@gumadeiras gumadeiras force-pushed the fix/tui-status-bar-wrong-provider-prefix branch from fa1d1df to 91449c8 Compare February 25, 2026 02:15
lbo728 and others added 7 commits February 25, 2026 00:35
…rovider cross-contamination

When a session is reset (via /new or /reset), the previous entry's model
field was copied to the new entry but modelProvider was not. This left the
new entry in a state where resolveSessionModelRef would fall back to the
config default_model provider (e.g. google-gemini-cli) when the stored
model string has no provider prefix — producing a wrong display like
'google-gemini-cli/claude-sonnet-4-6' in the TUI status bar.

Fixes the root cause for issue openclaw#25408 alongside the defensive fix in
session-utils.ts.
This reverts commit 0da3cd2f18c70fbb1ff045f183cae1beeb291bbb.
@gumadeiras gumadeiras force-pushed the fix/tui-status-bar-wrong-provider-prefix branch from aade9d3 to f0953a7 Compare February 25, 2026 05:36
@gumadeiras gumadeiras merged commit 177386e into openclaw:main Feb 25, 2026
9 checks passed
@gumadeiras
Copy link
Copy Markdown
Member

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Thanks @lbo728!

Jackson3195 pushed a commit to Jackson3195/openclaw-with-a-personal-touch that referenced this pull request Feb 25, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
kevinWangSheng pushed a commit to kevinWangSheng/openclaw that referenced this pull request Feb 26, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
kevinWangSheng pushed a commit to kevinWangSheng/openclaw that referenced this pull request Feb 26, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
execute008 pushed a commit to execute008/openclaw that referenced this pull request Feb 27, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
thebenjaminlee pushed a commit to escape-velocity-ventures/openclaw that referenced this pull request Mar 7, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…t modelProvider (openclaw#25874)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: f0953a7
Co-authored-by: lbo728 <72309817+lbo728@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling commands Command implementations gateway Gateway runtime size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: TUI status bar displays wrong provider prefix for active model

2 participants