fix(desktop): report session override provider in session info - #53947
fix(desktop): report session override provider in session info#53947luntion wants to merge 1 commit into
Conversation
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Clean fix: adds _session_info_provider() helper that prefers the per-session model_override provider over agent.provider for the user-facing provider identity. This prevents the Desktop picker's internal custom value from leaking into sticky composer state. Test coverage covers both the override-preferred and stale-override-fallback cases.
Reviewed by Hermes Agent
|
Thanks for the focused backend fix. The premise remains present on current main: The related #50151 maintainer comment identifies backend emission of the canonical user-facing identity as the correct boundary; this change follows that direction. The target Automated hermes-sweeper review. |
Summary
Fix Desktop/TUI
session.infoso it reports the user-facing per-session provider override instead of the internal resolved runtime provider when a session was created or switched through a named custom provider.For named custom providers, the live agent may expose
agent.provider == "custom"because that is the resolved runtime/billing class. Desktop treatssession.info.provideras sticky composer state. If it stores the internal"custom"value, a later session can pair the selected model with the wrong provider group and fail with provider-side model-not-supported errors.This change makes
session.infoprefersession["model_override"]["provider"]when it still matches the live agent model, falling back toagent.providerfor normal/built-in providers and older sessions.Why
Desktop model selection sends both model and provider. However, after the live agent is built,
session.infocan overwrite the Desktop provider state with the runtime provider class instead of the original provider slug.This is especially visible when multiple named custom providers expose overlapping model IDs. The model name remains correct, but the next request can be routed to a different provider group.
Changes
_session_info_provider()helper intui_gateway/server.py.model_override.providerwhen it describes the live model.agent.provider.agent.provider == "custom"Related
Refs #50151
This is complementary to #50151. That PR guards Desktop against unsafe provider payloads. This PR fixes the backend payload source so
session.infosends the user-facing session provider when available.Testing
Note:
scripts/run_tests.shwas not used on this Windows checkout because it expects a POSIX-style.venv/binorvenv/binvirtualenv, while this local venv is Windows-style.venv/Scripts.