Skip to content

fix(delegate): inherit parent fallback_chain in _build_child_agent - #19601

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 4, 2026
Merged

fix(delegate): inherit parent fallback_chain in _build_child_agent#19601
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1

@teknium1 teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvage of #19136 by @nftpoetrist onto current main.

Summary

_build_child_agent constructed child AIAgents without passing fallback_model, leaving _fallback_chain=[] for every subagent. When a subagent hit a rate-limit or credential exhaustion, the runtime fallback chain was empty and the error surfaced immediately instead of rotating to another provider. Forward parent_agent._fallback_chain when present.

Changes

  • tools/delegate_tool.py: pass parent_fallback into child AIAgent constructor
  • tests: regressions for chain inheritance and empty-chain behavior

Validation

scripts/run_tests.sh tests/tools/test_delegate.py -k fallback -> 2 passed

Original PR: #19136 (only the delegate commit cherry-picked; the Slack-setup commit from the same branch was salvaged separately as #19583)

_build_child_agent constructed child AIAgents without passing
fallback_model, leaving _fallback_chain=[] for every subagent.
When a subagent hit a rate-limit or credential exhaustion the
runtime fallback check (run_agent.py:7486 / 12267) found an empty
chain and failed immediately — even though the parent agent was
configured with fallback_providers and would have recovered.

The cron scheduler already propagates fallback_model correctly
(scheduler.py:1038). Fix closes the parity gap by reading the
parent's _fallback_chain (the normalised list form accepted by
AIAgent's fallback_model parameter) and threading it through.

Empty chains coerce to None so AIAgent initialises _fallback_chain=[]
as usual rather than iterating an empty list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants