fix: OAuth flag stale after refresh/fallback, memory nudge never fires, dead code#1890
Merged
fix: OAuth flag stale after refresh/fallback, memory nudge never fires, dead code#1890
Conversation
…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.
5 tasks
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.
Four targeted fixes in run_agent.py, salvaged from PR #1797 by @0xbyt4 (252 commits behind, applied manually onto current main):
OAuth flag stale after credential refresh —
_try_refresh_anthropic_client_credentials()now updates_is_anthropic_oauthwhen the token type changes (API key ↔ OAuth), preventing stalemcp_prefix behavior.OAuth flag missing in fallback —
_try_activate_fallback()Anthropic path now sets_is_anthropic_oauthso fallback sessions get correct identity handling.Memory/skill nudge counters reset every call — Moved
_turns_since_memoryand_iters_since_skillinitialization fromrun_conversation()to__init__(). In CLI mode (same agent reused), the counters were zeroed every turn, preventing nudges from ever accumulating to their threshold.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.