Skip to content

fix: handle list fallback_model config in streaming#1339

Closed
jimdawdy-hub wants to merge 1 commit intonesquena:masterfrom
jimdawdy-hub:fix/fallback-model-list-handling
Closed

fix: handle list fallback_model config in streaming#1339
jimdawdy-hub wants to merge 1 commit intonesquena:masterfrom
jimdawdy-hub:fix/fallback-model-list-handling

Conversation

@jimdawdy-hub
Copy link
Copy Markdown

Problem

When fallback_model is configured as a list (chained fallback), the WebUI crashes with:

Error: list object has no attribute get

api/streaming.py calls .get() directly on the value, but lists dont have .get(). Hermes Agent supports both formats:

# List (chained fallback) — causes the crash
fallback_model:
  - provider: openrouter
    model: google/gemini-2.5-pro-preview
  - provider: kimi-coding
    model: kimi-k2.5

Fix

Normalize both list and dict formats in api/streaming.py:

  • If fallback_model is a list, iterate to find the first valid entry
  • If it is a dict, use it directly (existing behavior)
  • Also reads fallback_providers (newer config key) in addition to fallback_model
  • Gracefully handles empty/invalid entries

When fallback_model is a list (chained fallback), the code called
.get() directly on the list, causing: 'list' object has no attribute
'get'. Normalize both single-dict (legacy) and list (chained) formats,
using the first valid entry as the fallback passed to AIAgent.

Also reads fallback_providers (newer config key) in addition to
fallback_model.
@nesquena-hermes
Copy link
Copy Markdown
Collaborator

Shipped in v0.50.246 via batch release PR #1343 (merge commit dec4b486). Thanks @jimdawdy-hub! 🙏

Live now at https://github.com/nesquena/hermes-webui/releases/tag/v0.50.246.

Released alongside 4 other contributor fixes — see the v0.50.246 entry in CHANGELOG.md.

pull Bot pushed a commit to JamesWilliam1977/hermes-webui that referenced this pull request Apr 30, 2026
…single fallback_model dict

From PR nesquena#1339.

Co-authored-by: Jim Dawdy <[email protected]>
pull Bot pushed a commit to JamesWilliam1977/hermes-webui that referenced this pull request Apr 30, 2026
 fallback list

- tests/test_issue765_streaming_persistence.py — replace timing-based polling
  in test_checkpoint_fires_on_activity_counter_increment with deterministic
  threading.Event-driven sync. The old version used time.sleep(0.15)+(0.25)+(0.25)
  with a 0.1s polling thread, which under CI scheduling jitter could miss the
  second increment and complete with only 1 save instead of 2. Now waits up
  to 3.0s for save_count to advance to the target after each increment.
  Locally observed flake on Python 3.11 in CI run 25175204451.

- tests/test_pr1339_fallback_providers_list.py — new structural test that
  asserts streaming.py handles both legacy fallback_model (single dict) and
  new fallback_providers (list form) without calling .get() on a list. Three
  assertions: both keys consulted, list-form has explicit isinstance check,
  _fallback_resolved defaults to None.
pull Bot pushed a commit to JamesWilliam1977/hermes-webui that referenced this pull request Apr 30, 2026
Combines:
- 4 contributor PRs (nesquena#1335 user fenced code, nesquena#1337 mermaid+cache-bust,
  nesquena#1339 fallback_providers list, nesquena#1341 context_length persistence)
- Self-built nesquena#1338 (cancel data-loss + activity panel) — already
  independently APPROVED by nesquena before absorption
- CONTRIBUTORS.md and markdown refresh from nesquena#1340

See CHANGELOG.md for the full list with author credit.
GeoffBao pushed a commit to GeoffBao/hermes-webui that referenced this pull request May 1, 2026
GeoffBao pushed a commit to GeoffBao/hermes-webui that referenced this pull request May 1, 2026
 fallback list

- tests/test_issue765_streaming_persistence.py — replace timing-based polling
  in test_checkpoint_fires_on_activity_counter_increment with deterministic
  threading.Event-driven sync. The old version used time.sleep(0.15)+(0.25)+(0.25)
  with a 0.1s polling thread, which under CI scheduling jitter could miss the
  second increment and complete with only 1 save instead of 2. Now waits up
  to 3.0s for save_count to advance to the target after each increment.
  Locally observed flake on Python 3.11 in CI run 25175204451.

- tests/test_pr1339_fallback_providers_list.py — new structural test that
  asserts streaming.py handles both legacy fallback_model (single dict) and
  new fallback_providers (list form) without calling .get() on a list. Three
  assertions: both keys consulted, list-form has explicit isinstance check,
  _fallback_resolved defaults to None.
GeoffBao pushed a commit to GeoffBao/hermes-webui that referenced this pull request May 1, 2026
Combines:
- 4 contributor PRs (nesquena#1335 user fenced code, nesquena#1337 mermaid+cache-bust,
  nesquena#1339 fallback_providers list, nesquena#1341 context_length persistence)
- Self-built nesquena#1338 (cancel data-loss + activity panel) — already
  independently APPROVED by nesquena before absorption
- CONTRIBUTORS.md and markdown refresh from nesquena#1340

See CHANGELOG.md for the full list with author credit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants