Repository navigation
Description
Bug Description
When switching providers mid-session (e.g. openai-codex → xai-oauth / grok-4.3), the active Telegram session retains encrypted_content reasoning blobs from the previous provider. xAI cannot decrypt OpenAI blobs, so every subsequent request fails with HTTP 400 before the model ever sees the message.
Would be happy to test a fix.
Steps to Reproduce
1. Start a Telegram session with an OpenAI-based provider.
2. Switch the active model to an xAI provider via hermes model or config.
3. Send any message through the Telegram gateway.
4. Gateway returns 400; the session is now poisoned.
Expected Behavior
Hermes should automatically handle provider changes by either:
- Clearing or stripping provider-specific encrypted_content / reasoning blobs on provider switch, or
- Isolating sessions by provider (so a switch naturally starts fresh context for the new provider), or
- Detecting the mismatch and forcing a new session for that chat.
Actual Behavior
When anything gets written in Telegram to bot, this error appears twice in a row -
Session continues to carry the incompatible encrypted blobs. Manual workaround: set "suspended": true on the session key in sessions.json and restart the gateway.
- Affects gateway sessions (especially Telegram DMs).
- The issue only surfaces on future request after the provider change.
- Related files: gateway/run.py, session store (hermes_state.py), and how encrypted_content is persisted per message.
Affected Component
Other, Gateway (Telegram/Discord/Slack/WhatsApp)
Messaging Platform (if gateway-related)
No response
Debug Report
Report https://paste.rs/07AHe
agent.log https://paste.rs/VdKj4
gateway.log https://paste.rs/AGRvTOperating System
Ubuntu 24.04
Python Version
Python 3.11.5
Hermes Version
Hermes Agent v0.15.0 (2026.5.28)
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
No response
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?
- I'd like to fix this myself and submit a PR
Activity
alt-glitch commentedon May 29, 2026
Duplicate of #32617 — same root cause: cross-provider encrypted_content replay after model switch causes 400. Open PR #31629 (foreign-issuer stamp+drop) would fix. Workaround: suspend session and restart gateway.
teknium1 commentedon Jul 13, 2026
This is fixed on current main. Automated hermes-sweeper review verified the duplicate report’s referenced fix was salvaged and merged.
9c69204d8stamps Responses reasoning items with their issuer and drops foreign-issuerencrypted_contentbefore replay (agent/codex_responses_adapter.py:405). This preserves same-endpoint continuity while preventing OpenAI Codex ↔ xAI session poisoning.agent/transports/codex.py:148). Regression coverage exercises the xAI-to-Codex switch intests/run_agent/test_codex_xai_oauth_recovery.py:1033.invalid_encrypted_contentresponse is classified, replay state is stripped, and the request retries once (agent/conversation_loop.py:2901; merged via91d05b982d0bc08a735a2c0b1fedccd93b7fc9cd).