hermes - 💡(How to fix) Fix [Feature]: Make fallback session-stickiness configurable (fallback_model.sticky) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#23094Fetched 2026-05-11 03:31:16
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4cross-referenced ×1

Code Example

fallback_model:
  provider: deepseek
  model: deepseek-v4-flash
  sticky: true   # <-- new option, default true preserves current behavior

---

self._fallback_sticky = True  # session-sticky: persist until /new

---

self._fallback_sticky = self._fallback_sticky_config  # from config, default True
RAW_BUFFERClick to expand / collapse

Problem or Use Case

Hermes currently has a _fallback_sticky mechanism that, once fallback is activated in a session, keeps the session pinned to the fallback provider for all subsequent turns until /new. This is a deliberate design choice that avoids 3 retries + fallback on every single message when the primary provider is persistently failing.

However, this behavior is currently hardcoded with no config option for users who prefer per-turn restoration (each new message tries the primary first and only falls back on failure).

Proposed Solution

Add a new config key fallback_model.sticky (default: true) that controls whether fallback is session-sticky or turn-scoped.

Config example:

fallback_model:
  provider: deepseek
  model: deepseek-v4-flash
  sticky: true   # <-- new option, default true preserves current behavior

When sticky: false:

  • Each turn starts by attempting to restore the primary provider
  • If restoration fails, fallback kicks in for that turn only
  • Next turn tries primary again

Implementation Details

1. Config parsing — hermes_cli/config.py (~line 3000-3044)

Add sticky as an optional bool field in fallback_model/fallback_providers validation. Default true to preserve current behavior.

2. Agent init — run_agent.py (~line 1652-1660)

When parsing fallback entries at init, extract sticky from each entry and store as self._fallback_sticky_config.

3. Fallback activation — run_agent.py line 8104

Current hardcoded line:

self._fallback_sticky = True  # session-sticky: persist until /new

Change to use config value:

self._fallback_sticky = self._fallback_sticky_config  # from config, default True

4. Sticky check — run_agent.py line 8215-8222

Already uses self._fallback_sticky — no change needed once value comes from config.

5. Gateway — gateway/run.py

Gateway has _session_fallback_sticky: Dict[str, bool] (~line 1176-1180) that persists across agent cache misses. The config value should be plumbed so sticky: false does NOT apply the model override on agent recreation.

Files to Change

FileWhat
hermes_cli/config.py (~L3000)Validate sticky field; add to allowed keys
run_agent.py (~L1652-1660)Parse sticky from fallback entries at init
run_agent.py (L8104)Set _fallback_sticky from config instead of hardcoded True
run_agent.py (L8215-8222)Already uses self._fallback_sticky — no change
gateway/run.py (~L1176, L8233)Respect sticky: false in session override logic

Code References

  • AIAgent.__init__ parses fallback_model at run_agent.py:1109 and seeds _fallback_chain at run_agent.py:1652-1660
  • _fallback_sticky set to True at run_agent.py:8104 in _try_activate_fallback()
  • _restore_primary_runtime() checks self._fallback_sticky at run_agent.py:8215-8222
  • Gateway _session_fallback_sticky at gateway/run.py:1176-1180
  • Cleared on /new at gateway/run.py:6371 and gateway/run.py:7495
  • Cleared on model switch at gateway/run.py:8233-8234
  • Fallback config validation at hermes_cli/config.py:3000-3044
  • hermes fallback commands at hermes_cli/fallback_cmd.py

Alternatives Considered

  • Leave as-is, just document it: Works for most users, but no escape hatch for transient primary failures.
  • Slash command only: Could add /fallback-sticky toggle, but config key integrates with profiles and is more discoverable.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix [Feature]: Make fallback session-stickiness configurable (fallback_model.sticky) [1 participants]