Skip to content

fix(delegate): resolve custom-endpoint subagent pools by endpoint identity#41730

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-32b6a227
Jun 8, 2026
Merged

fix(delegate): resolve custom-endpoint subagent pools by endpoint identity#41730
teknium1 merged 1 commit into
mainfrom
hermes/hermes-32b6a227

Conversation

@teknium1

@teknium1 teknium1 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Subagents delegated to a custom endpoint now stay on that endpoint instead of being silently rebound to the parent's custom endpoint.

Root cause: every direct delegation.base_url runtime collapses to provider="custom". _resolve_child_credential_pool() shared the parent's pool whenever effective_provider == parent_provider, so two different custom endpoints looked identical. The child then leased a parent-pool entry and _swap_credential() overwrote its delegated base_url with the parent's endpoint — sending the delegated model name to the wrong place.

Changes

  • tools/delegate_tool.py: _resolve_child_credential_pool() resolves custom runtimes by endpoint identity (custom:<name> key from base_url). Parent pool reused only when parent and child resolve to the same custom endpoint; unregistered raw endpoints return None so the child keeps its fixed delegated credential. Threaded effective_base_url into the helper at the call site.
  • agent/credential_pool.py: get_custom_provider_pool_key() accepts Optional[str] (it already no-op'd on falsy input).
  • tests/tools/test_delegate.py: 3 new cases — different endpoint no bleed, same endpoint shares, unregistered endpoint returns None.

Validation

Scenario Before After
Parent on custom A, child on custom B child rebound to A child stays on B
Parent + child same custom endpoint shared pool shared pool (rotation/cooldown synced)
Unregistered raw delegation.base_url inherited parent pool None (keeps fixed delegated cred)
Non-custom providers share/load own unchanged

tests/tools/test_delegate.py: 140 passed. E2E with isolated HERMES_HOME + two custom endpoints in auth.json confirmed no pool bleed and correct same-endpoint sharing.

Fixes #7833.

Infographic

delegate-custom-endpoint-pool-fix

…ntity

Subagents delegated to a custom endpoint were misrouted when the parent
ran on a different custom endpoint. Both runtimes collapse to
provider="custom", so _resolve_child_credential_pool() treated them as
interchangeable and handed the child the parent's pool. Leasing from it
then overwrote the child's delegated base_url with the parent's endpoint
via _swap_credential() — the child sent the delegated model name to the
wrong endpoint.

Custom runtimes now resolve by endpoint identity (the custom:<name> pool
key derived from base_url). The parent pool is reused only when both
parent and child resolve to the same custom endpoint; unregistered raw
endpoints return None so the child keeps its fixed delegated credential.
Non-custom provider paths are unchanged.

Fixes #7833.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets tool/delegate Subagent delegation labels Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-32b6a227 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10033 on HEAD, 10033 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5201 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@liuhao1024

Copy link
Copy Markdown
Contributor

✅ Verified — custom-endpoint identity resolution for credential pools

Reviewed the diff (3 files, ~120 lines including tests). Findings:

  1. Root cause correctly identified — all custom endpoints collapse to provider="custom", so bare provider equality lets a child on endpoint B inherit the parent's endpoint A pool, overwriting the child's delegated base_url (issue delegate_task can overwrite delegated custom endpoint with parent custom credential pool #7833).

  2. Fix is clean — resolves custom runtimes by custom:<name> pool key (derived from base_url), not the bare "custom" string. Parent pool is shared only when both resolve to the same key. Unregistered endpoints return None (no pool inheritance).

  3. get_custom_provider_pool_key signature changebase_url parameter changed from str to Optional[str], which is correct since effective_base_url can be None for non-custom providers.

  4. Test coverage is thorough — 3 new tests: different endpoint does not inherit parent pool, same endpoint shares parent pool, unregistered endpoint returns None.

No issues found. LGTM.

@teknium1 teknium1 merged commit 48ae802 into main Jun 8, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-32b6a227 branch June 8, 2026 05:05
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
…ntity (NousResearch#41730)

Subagents delegated to a custom endpoint were misrouted when the parent
ran on a different custom endpoint. Both runtimes collapse to
provider="custom", so _resolve_child_credential_pool() treated them as
interchangeable and handed the child the parent's pool. Leasing from it
then overwrote the child's delegated base_url with the parent's endpoint
via _swap_credential() — the child sent the delegated model name to the
wrong endpoint.

Custom runtimes now resolve by endpoint identity (the custom:<name> pool
key derived from base_url). The parent pool is reused only when both
parent and child resolve to the same custom endpoint; unregistered raw
endpoints return None so the child keeps its fixed delegated credential.
Non-custom provider paths are unchanged.

Fixes NousResearch#7833.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

delegate_task can overwrite delegated custom endpoint with parent custom credential pool

3 participants