Skip to content

feat(delegation): independent fallback chain for subagents - #85290

Open
motochan wants to merge 1 commit into
NousResearch:mainfrom
motochan:delegation-fallback-chain
Open

feat(delegation): independent fallback chain for subagents#85290
motochan wants to merge 1 commit into
NousResearch:mainfrom
motochan:delegation-fallback-chain

Conversation

@motochan

Copy link
Copy Markdown

What does this PR do?

Adds delegation.fallback_providers so subagents can run on a fallback chain that differs from the parent agent's top-level fallback_providers.

Today _build_child_agent unconditionally passes the parent's _fallback_chain as the child's fallback_model, so a subagent pinned to a cheap/fast provider still fails over to the main agent's fallback models instead of a subagent-appropriate backup.

Concrete use case: main agent runs openrouter/deepseek-v4-pro-0813 with openrouter/glm-5.2 as fallback, while subagents run openrouter/deepseek-v4-flash-0731 and should fail over to a local ascent-dspark endpoint — not to the main agent's fallback chain.

Related Issue

Fixes #65038

Type of Change

  • ✨ New feature (non-breaking change that adds functionality)
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)

Changes Made

  • hermes_cli/config_defaults.py — new delegation.fallback_providers: [] default (empty = inherit parent chain, backward compatible)
  • tools/delegate_tool.py_normalize_delegation_fallback_chain() validates entries against the provider+model contract; _resolve_delegation_credentials() forwards the chain; _build_child_agent() accepts override_fallback_providers and falls back to the parent chain when unset/empty; delegate tool description mentions the knob
  • tests/tools/test_delegate.py — 3 new tests: override wins, empty list inherits parent chain, malformed entries are dropped
  • website/docs/user-guide/configuration.md + website/docs/user-guide/features/fallback-providers.md — document the new key

Add delegation.fallback_providers so subagents can use a fallback chain
that differs from the parent's top-level fallback_providers list. Today
_build_child_agent always passes the parent's _fallback_chain, so a
subagent pinned to a cheap/fast provider still fails over to the main
agent's fallback models (e.g. an expensive reasoning model) instead of
a subagent-appropriate backup.

- config_defaults: new delegation.fallback_providers key (empty =
  inherit parent chain, backward compatible)
- delegate_tool: _normalize_delegation_fallback_chain filters entries
  to the provider+model contract; _resolve_delegation_credentials
  forwards the chain; _build_child_agent accepts
  override_fallback_providers
- tests: override wins, empty list inherits, malformed entries dropped

Fixes NousResearch#65038
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard tool/delegate Subagent delegation area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Aug 13, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #65052 and #81072: this implements the same per-child fallback-chain goal, but its [] semantics inherit the parent chain while those PRs use [] to explicitly disable child fallback. Maintainers should choose the configuration contract before consolidation.

@ayushnangia

ayushnangia commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Welcome, and thanks for the concrete use case — it's a good one. Heads-up for coordination: this feature already has three prior implementations, so reviewers will want the family ordered rather than re-derived:

Your PR's diff overlaps #65052 almost file-for-file, so one of them will need to absorb the other. Options, your pick: fold into #65052 as a co-authored update (your use case + tests would strengthen it), coordinate with me on a landing order, or leave both for maintainers to adjudicate. Happy to review yours either way — the _build_child_agent failover point is exactly where #65052 hooks too.

@Enough1122

Copy link
Copy Markdown
Contributor

AI code review — automated review for reference, author can ignore or act on any point.

feat(delegation): independent fallback chain for subagents

  • tools/delegate_tool.py (~L1590): child_fallback = override_fallback_providers or parent_fallback means a config that normalizes to [] (empty, or all entries malformed) silently inherits the parent chain — there is no way to express "subagents must NOT fall back" when the parent has a chain. Docs say empty = inherit, so this is intentional, but consider documenting that disabling subagent fallback isn't expressible (or adding a null/sentinel for "no fallback").
  • _normalize_delegation_fallback_chain drops malformed entries silently, and delegate_task then converts the result to None, so a config typo (e.g. model under a wrong key) silently reverts to parent inheritance with no log. A logger.warning when entries are dropped would make misconfiguration visible.
  • The normalized chain copies arbitrary extra keys (base_url, api_key, unknown keys) untouched while validating only provider/model. A key typo like baseurl is silently carried into fallback_model, where the child likely ignores it — consistent with the top-level contract, but validating the known optional keys too would catch typos.

@alt-glitch alt-glitch added the needs-decision Awaiting maintainer decision before any implementation label Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

delegation.fallback_providers is ignored; delegated workers inherit the parent fallback chain

4 participants