Skip to content

fix(tools): skip credential pool binding when delegate base_url is set - #13752

Closed
androidi wants to merge 2 commits into
NousResearch:mainfrom
androidi:fix/delegate-base-url-override
Closed

fix(tools): skip credential pool binding when delegate base_url is set#13752
androidi wants to merge 2 commits into
NousResearch:mainfrom
androidi:fix/delegate-base-url-override

Conversation

@androidi

Copy link
Copy Markdown

What does this PR do?

Fixes a bug in delegate_task where delegation.base_url is ignored when the child agent's provider matches the parent's provider ("custom"). The child's explicit base_url is silently overwritten at runtime by _swap_credential() from a shared credential pool entry that points to the parent's endpoint.

Related Issue

Fixes #13678

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • tools/delegate_tool.py: Added if not override_base_url: guard before _resolve_child_credential_pool() call in _build_child_agent(). When override_base_url is set, the child is not bound to the parent's credential pool, preventing _swap_credential() from overwriting the child's explicit endpoint with the parent's URL on first API call.

How to Test

  1. Configure parent agent with provider="custom" and base_url="http://localhost:8000"
  2. Spawn subagent via delegate_task with delegation.base_url="http://localhost:8001" and delegation.provider="custom" (same provider as parent)
  3. The subagent should call http://localhost:8001/v1
  4. Before fix: first API call silently redirects to port 8000 (404 or wrong model)
  5. After fix: subagent correctly calls port 8001

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I've searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix (no unrelated commits)
  • I've run pytest tests/ -q — tests not added for this fix (would require mocking two vLLM endpoints)
  • I've added tests for my changes — same as above
  • I've tested on my platform: Debian 13

Documentation & Housekeeping

  • I've considered cross-platform impact — no OS-specific code in this change
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A (only logic change)

For New Skills

N/A — not a skill

@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets tool/delegate Subagent delegation labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #11456 and #8797 — all three fix credential pool overwriting delegate base_url. Maintainers should pick one.

1 similar comment
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #11456 and #8797 — all three fix credential pool overwriting delegate base_url. Maintainers should pick one.

@Bartok9

Bartok9 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Re-verified against current origin/main (4c349e8): resolved by 48ae8029a (fix(delegate): resolve custom-endpoint subagent pools by endpoint identity, #41730, refs #7833). _resolve_child_credential_pool now keys custom pools by get_custom_provider_pool_key(base_url) and only shares the parent pool when parent/child endpoint keys match — so a delegate base_url no longer clobbers the pool binding. Recommend closing as superseded. 🙏

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression report and test coverage. This is already implemented on current main; automated hermes-sweeper review confirms the later fix is more precise than this PR's blanket pool skip.

  • 48ae8029a (fix(delegate): resolve custom-endpoint subagent pools by endpoint identity, merged via fix(delegate): resolve custom-endpoint subagent pools by endpoint identity #41730) passes effective_base_url into child-pool resolution at tools/delegate_tool.py:1358.
  • For provider="custom", tools/delegate_tool.py:2945 compares endpoint-derived pool keys, shares the parent pool only for the same endpoint, otherwise loads the child endpoint's pool, and returns no pool for an unregistered delegated URL.
  • Regression coverage on main covers both different-endpoint isolation and same-endpoint pool sharing in tests/tools/test_delegate.py:1750 and tests/tools/test_delegate.py:1778.
  • This matches @Bartok9's June 21 verification that identified 48ae8029a as the superseding fix.

Closing as implemented on main.

@teknium1 teknium1 closed this Jul 12, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 12, 2026
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 sweeper:implemented-on-main Sweeper: behavior already present on current main tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] delegate_task subagents get 404 from opencode-go — api_key env var not loaded in child process

4 participants