Skip to content

fix(delegate): share credential pools with subagents - #5576

Closed
MestreY0d4-Uninter wants to merge 1 commit into
NousResearch:mainfrom
MestreY0d4-Uninter:fix/delegation-child-credential-pool
Closed

fix(delegate): share credential pools with subagents#5576
MestreY0d4-Uninter wants to merge 1 commit into
NousResearch:mainfrom
MestreY0d4-Uninter:fix/delegation-child-credential-pool

Conversation

@MestreY0d4-Uninter

Copy link
Copy Markdown
Contributor

Summary

This PR makes delegated child agents participate in credential-pool rotation instead of inheriting a single fixed credential from the parent.

Today, even when a parent agent has access to a healthy credential pool, a subagent can end up knowing only one effective credential. If that credential hits a rate limit or quota wall, the child stalls even though the pool still has other usable entries.

This patch keeps the change intentionally small:

  • resolve an appropriate credential pool for the child
  • share the parent's pool when parent and child use the same provider
  • otherwise try to load the child's provider pool directly
  • fall back gracefully to the old fixed-credential behavior when no pool exists
  • add focused delegation tests for the child-pool resolution path

What changed

  • added _resolve_child_credential_pool() in tools/delegate_tool.py
  • _build_child_agent() now assigns a credential pool to the child when available
  • same-provider children share the parent's pool so cooldown/rotation state stays synchronized
  • different-provider children try to load their own provider pool
  • empty or unavailable pools fall back to the previous behavior (no pool assignment)

Why

This is the smallest useful extraction from the larger credential-pool hardening branch.

It improves real subagent resilience without pulling in the more invasive pieces yet:

  • no lease scheduler
  • no tier profiles
  • no retry-header parsing
  • no fallback-precedence rewrite

Validation

Automated

  • /home/ubuntu/.hermes/hermes-agent/venv/bin/python -m py_compile tools/delegate_tool.py tests/tools/test_delegate.py
  • /home/ubuntu/.hermes/hermes-agent/venv/bin/python -m pytest -q -o addopts='' tests/tools/test_delegate.py -k 'ChildCredentialPoolResolution or DelegationProviderIntegration'
  • Result: 13 passed, 44 deselected

Additional focused validation:

  • /home/ubuntu/.hermes/hermes-agent/venv/bin/python -m pytest -q -o addopts='' tests/tools/test_delegate.py
  • Result: 57 passed

Related context

Scope notes

This PR only makes child agents see and use credential pools.
It does not yet add:

  • lease-based concurrency control
  • tiered delegation profiles
  • structured provider failure classification
  • fallback precedence changes

@teknium1

teknium1 commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Closing — fully subsumed by #5580 (which includes credential sharing + leasing). Thanks @MestreY0d4-Uninter.

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