Skip to content

fix: OAuth flag stale after refresh/fallback, memory nudge never fires, dead code#1890

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-b29f73b2
Mar 18, 2026
Merged

fix: OAuth flag stale after refresh/fallback, memory nudge never fires, dead code#1890
teknium1 merged 1 commit intomainfrom
hermes/hermes-b29f73b2

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Four targeted fixes in run_agent.py, salvaged from PR #1797 by @0xbyt4 (252 commits behind, applied manually onto current main):

  1. OAuth flag stale after credential refresh_try_refresh_anthropic_client_credentials() now updates _is_anthropic_oauth when the token type changes (API key ↔ OAuth), preventing stale mcp_ prefix behavior.

  2. OAuth flag missing in fallback_try_activate_fallback() Anthropic path now sets _is_anthropic_oauth so fallback sessions get correct identity handling.

  3. Memory/skill nudge counters reset every call — Moved _turns_since_memory and _iters_since_skill initialization from run_conversation() to __init__(). In CLI mode (same agent reused), the counters were zeroed every turn, preventing nudges from ever accumulating to their threshold.

  4. Dead code removed — Unreachable if retry_count >= max_retries: block after the raise statement.

Tests

7 new regression tests, all 177 run_agent tests pass.

…s, dead code

- Update _is_anthropic_oauth in _try_refresh_anthropic_client_credentials()
  when token type changes during credential refresh
- Set _is_anthropic_oauth in _try_activate_fallback() Anthropic path
- Move _turns_since_memory and _iters_since_skill init to __init__ so
  nudge counters accumulate across run_conversation() calls in CLI mode
- Remove unreachable retry_count >= max_retries block after raise

Adds 7 regression tests. Salvaged from PR #1797 by @0xbyt4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant