Skip to content

fix(agent): guard malformed fallback chains#35867

Open
zapabob wants to merge 1 commit into
NousResearch:mainfrom
zapabob:codex/fallback-chain-none-guard
Open

fix(agent): guard malformed fallback chains#35867
zapabob wants to merge 1 commit into
NousResearch:mainfrom
zapabob:codex/fallback-chain-none-guard

Conversation

@zapabob

@zapabob zapabob commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Treat missing or invalid fallback chains as exhausted instead of raising secondary errors.
  • Normalize invalid fallback indexes, skip malformed chain entries, and route pending-fallback checks through the safe helper.
  • Keep valid fallback activation behavior unchanged while preventing malformed runtime state from masking the primary provider failure.

Fixes #35848

Tests

  • uv run --extra dev python -X utf8 -m pytest tests/run_agent/test_provider_fallback.py -q --timeout-method=thread
  • uv run --extra dev python -X utf8 -m pytest tests/gateway/test_empty_model_recovery.py tests/run_agent/test_provider_fallback.py -q --timeout-method=thread
  • uv run --extra dev ruff check .

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent loop, run_agent.py, prompt builder labels May 31, 2026
@zapabob zapabob force-pushed the codex/fallback-chain-none-guard branch from d641891 to 3caba7b Compare May 31, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: model-fallback path raises 'NoneType' object is not iterable, masking the original error

2 participants