fix(delegate): inherit parent fallback_chain in _build_child_agent - #19136
Closed
nftpoetrist wants to merge 2 commits into
Closed
fix(delegate): inherit parent fallback_chain in _build_child_agent#19136nftpoetrist wants to merge 2 commits into
nftpoetrist wants to merge 2 commits into
Conversation
_setup_slack() was the only platform setup function that did not prompt for a home channel. All four sibling setups (_setup_telegram, _setup_discord, _setup_mattermost, _setup_bluebubbles) close with an identical home-channel block, and setup_gateway() already checks for SLACK_HOME_CHANNEL presence at the end of the wizard — but the value was never collected, leaving cron delivery and cross-platform notifications silently broken for Slack after a fresh hermes setup run. Add the standard home-channel prompt at the end of _setup_slack(), symmetric with the Discord implementation. Add two unit tests that verify the prompt is saved when provided and skipped when left blank.
_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.
Collaborator
Collaborator
|
Related to closed #15285. |
Contributor
|
Salvaged via #19601 onto current main — the delegate fix commit was cherry-picked with your authorship preserved. The Slack setup commit from the same branch was salvaged separately as #19583. Thanks @nftpoetrist! |
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.
Root Cause
_build_child_agentconstructed every childAIAgentwithout passingfallback_model, so_fallback_chain = []for all subagents.When a subagent hit a rate-limit or exhausted its credential pool, the runtime fallback check in
run_agent.pyfound an empty chain and failed immediately — even though the parent agent hadfallback_providersconfigured and would have recovered from the same error.Parity Gap
The cron scheduler already propagates
fallback_modelcorrectly:_build_child_agentwas missing the equivalent pass-through.Fix
Read the parent's
_fallback_chain(the normalised list form thatAIAgent.__init__already accepts via itsfallback_modelparameter) and pass it to the child:Empty chains coerce to
NonesoAIAgentinitialises_fallback_chain = []as usual rather than re-filtering an empty list.Test Plan
test_child_inherits_fallback_chain— verifies non-empty_fallback_chainis passed asfallback_modeltest_child_gets_no_fallback_when_parent_chain_empty— verifies empty chain producesfallback_model=None2 passed)