Skip to content

fix(tools): pass target_model to resolve_runtime_provider in delegation (#15319)#15447

Open
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/delegation-target-model-resolution
Open

fix(tools): pass target_model to resolve_runtime_provider in delegation (#15319)#15447
Tranquil-Flow wants to merge 2 commits into
NousResearch:mainfrom
Tranquil-Flow:fix/delegation-target-model-resolution

Conversation

@Tranquil-Flow

@Tranquil-Flow Tranquil-Flow commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

When delegation.model differs from the parent model (e.g., delegating to claude-opus-4-6 on an opencode-zen provider while the parent uses a chat_completions model), resolve_runtime_provider needs the target model to select the correct api_mode. Without target_model, the delegate inherits the parent's api_mode and gets 404 errors.

The fix is a 1-line change to forward target_model to resolve_runtime_provider, plus 5 test assertion updates and 1 new test case.

Related Issue

Fixes #15319

Supersedes #15320.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Delegation call site now passes target_model to resolve_runtime_provider so api_mode is selected for the delegate, not the parent
  • Updated 4 existing TestDelegationCredentialResolution assertions to verify target_model kwarg is forwarded
  • Added test_target_model_forwarded_for_api_mode_resolution covering the anthropic_messages api_mode case

How to Test

  1. pytest -k TestDelegationCredentialResolution — 11/11 delegation credential tests pass
  2. pytest -k test_target_model_forwarded_for_api_mode_resolution — covers the anthropic_messages api_mode case

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15 (Darwin 24.6.0)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

11/11 delegation credential tests pass

@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/tools Tool registry, model_tools, toolsets tool/delegate Subagent delegation labels Apr 25, 2026
@Tranquil-Flow Tranquil-Flow force-pushed the fix/delegation-target-model-resolution branch from acfe927 to 8f1067e Compare May 18, 2026 21:20
…on (NousResearch#15319)

When delegation.model differs from the parent model (e.g., delegating
to claude-opus-4-6 on an opencode-zen provider while the parent uses
a chat_completions model), resolve_runtime_provider needs the target
model to select the correct api_mode.  Without it, the delegate
inherits the parent's api_mode and gets 404 errors.

Supersedes NousResearch#15320.
@Tranquil-Flow Tranquil-Flow force-pushed the fix/delegation-target-model-resolution branch from 8f1067e to aafe9a6 Compare May 25, 2026 11:05
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 P1 High — major feature broken, no workaround 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 404 when delegation model differs from main model on opencode-go/opencode-zen

2 participants