Skip to content

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

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

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.

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 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

2 participants