fix(desktop): preserve custom provider identity on resume#45578
Merged
Conversation
…ssion's provider `_stored_session_runtime_overrides` restored the session provider from `billing_provider` when `model_config` had no explicit provider. For a `custom:<name>` endpoint that only ran normal turns (no `/model` switch), the persisted `billing_provider` is the bare billing bucket `"custom"`, which `agent_init` treats as non-routable, so `session.resume` failed with "No LLM provider configured" even though new chats and CLI `--resume` work. Only restore an explicit `model_config.provider`; skip a bare billing bucket (`auto`/`openrouter`/`custom`) so resume falls back to the configured default, matching the CLI path. Fixes #44022
_runtime_model_config persisted the live agent's RESOLVED provider into the session row's model_config JSON. For any named providers:/ custom_providers: entry, agent.provider is the literal string "custom", so the entry name was lost (and the api_key is deliberately never persisted). On session.resume or _reset_session_agent the stored provider="custom" fed resolve_runtime_provider(requested="custom"), which cannot match a named entry — the rebuild either raised "No LLM provider configured" or silently resolved placeholder credentials against the patched-back base_url. Persist the REQUESTED/entry identity instead: a new reverse lookup find_custom_provider_identity(base_url) maps the endpoint URL back to the canonical custom:<name> menu key. _runtime_model_config stores that key; _make_agent performs the same recovery for rows persisted before the fix, falling back to passing the stored base_url as explicit_base_url so the direct-alias branch still targets the session's endpoint when no entry matches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A thinking-only assistant turn (reasoning present, empty visible text) is persisted with its reasoning fields and stays recallable from the transcript, but `_history_to_messages` dropped it as "empty" before its reasoning was attached. On desktop/TUI resume or reload the turn therefore vanished from the session view while the agent could still recall it from a fresh session -- exactly the "messages disappear when the LLM uses its thinking block, but a new session can recall them" symptom reported on #44022. Keep an assistant turn when it carries reasoning, even with empty text, so the desktop "Thinking…" disclosure has something to render. Genuinely empty turns (no text, no reasoning, no tool calls) are still filtered out. Refs #44022 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
invalid-argument-type |
1 |
First entries
tests/hermes_cli/test_custom_provider_identity.py:76: [invalid-argument-type] invalid-argument-type: Argument to function `find_custom_provider_identity` is incorrect: Expected `str`, found `None`
✅ Fixed issues: none
Unchanged: 5710 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
This was referenced Jun 13, 2026
|
@teknium1 That infographic is something else, thanks for your continued work teknium! This next update better be called "the thousand bricks update" or something like that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Desktop/TUI resume now preserves custom-provider session identity and keeps reasoning-only turns visible.
Changes
tui_gateway/server.py: skip bare billing buckets as resume provider identities so oldbilling_provider="custom"rows fall back to configured provider resolution.tui_gateway/server.py+hermes_cli/runtime_provider.py: persist/recover named custom provider identities ascustom:<name>from the session endpoint URL instead of lossy barecustom.tui_gateway/server.py: keep assistant turns with reasoning fields even when visible text is empty.scripts/release.py: map salvaged contributor emails for changelog attribution.Validation
scripts/run_tests.sh tests/test_tui_gateway_server.py tests/hermes_cli/test_custom_provider_identity.py tests/tui_gateway/test_custom_provider_session_persistence.py→ 282 passedprovider_override; custom endpoint persists ascustom:mimo-v2.5-pro; poisoned row rebuilds anAIAgentwith the configured endpoint/key; reasoning-only turn survives_history_to_messagespy_compile scripts/release.py;git diff --checkFixes #44022.
Refs #44108.
Salvages focused fixes from #44062 by @HaozheZhang6 and #44109/#44402 by @AIalliAI with commit authorship preserved.
Infographic