fix(delegate): honor per-call and per-task model overrides#23649
Open
qWaitCrypto wants to merge 1 commit into
Open
fix(delegate): honor per-call and per-task model overrides#23649qWaitCrypto wants to merge 1 commit into
qWaitCrypto wants to merge 1 commit into
Conversation
19 tasks
|
Reviewed this alongside the other competing PRs (#20000, #23266, #23769, #25026) and this is the cleanest implementation by far. The guard that suppresses the parent's fallback chain is a critical detail every other PR misses — without it, an explicit model override could be silently subverted by a rate-limit or auth fail fallback. The model-only approach is also the right call: adding a separate +1 from me, hope this gets merged soon 🙏 |
This was referenced May 14, 2026
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a delegation wiring gap:
delegate_task()could only route child modelsthrough
delegation.modelconfig or by inheriting the parent model. A singledelegation call could not explicitly choose a child model, and batch mode could
not route different sub-tasks to different models.
This PR adds per-call and per-task model overrides for delegation without
expanding the provider/credential system.
Model selection precedence is now:
tasks[].modeldelegate_task(model=...)delegation.modelparent_agent.modelIt also keeps explicit model overrides from silently inheriting the parent's
fallback model chain, so a child that was explicitly routed to another model
does not fail back onto the parent model behind the caller's back.
This PR intentionally does not add per-task provider overrides. Provider,
base URL, API mode, and credential resolution remain controlled by existing
delegation config and parent runtime state.
Related Issue
Fixes the
delegate_taskper-call / per-task model override gap described inthe delegation model routing discussion.
Type of Change
Changes Made
modelsupport totools/delegate_tool.pydelegate_task(...).tasks[].modelsupport to the delegate tool schema.tasks[].model > delegate_task(model=...) > delegation.model > parent.model_normalize_model_override(...)helper to keep override parsing narrowand explicit.
tests/tools/test_delegate.pyfor:modeldelegation.modelHow to Test
modelandtasks[].modelAIAgent(model=...)tasks[].modelbeats top-levelmodeldelegation.modeldelegation.modelbehaviorChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passpython3 -m pytestDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Focused verification passed locally: