fix(delegate-task): inherit the parent model for unconfigured tasks#2738
fix(delegate-task): inherit the parent model for unconfigured tasks#27380xYiliu wants to merge 3 commits intocode-yeongyu:devfrom
Conversation
|
All contributors have signed the CLA. Thank you! ✅ |
There was a problem hiding this comment.
1 issue found across 6 files
Confidence score: 3/5
- There is a concrete regression risk in
src/tools/delegate-task/tools.ts: the unstable-agent safeguard can be bypassed for subagents becauseisUnstableAgentonly runs whenargs.categoryis set, while routing now allows inheriting models viaresolveTaskRouting. - Given the high confidence (9/10) and user-facing impact (unstable models may be selected despite mitigation), this sits above a minor issue and justifies a moderate merge-risk score.
- Pay close attention to
src/tools/delegate-task/tools.ts- ensure unstable-agent checks are applied consistently for subagent routing paths, including inherited parent-session models.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/tools/delegate-task/tools.ts">
<violation number="1" location="src/tools/delegate-task/tools.ts:201">
P1: Unstable agent mitigation bypassed for subagents. The `isUnstableAgent` check is guarded by `if (args.category)`, but subagents can now inherit unstable models from the parent session via the new `resolveTaskRouting` logic. When `args.category` is undefined (subagent task) but the inherited model is unstable (e.g., o1-preview) and `run_in_background=false`, the task will bypass the unstable agent check and proceed to `executeSyncTask`, which will likely fail since unstable models lack streaming support. The unstable agent check should apply to all tasks regardless of whether they use category or subagent_type.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
I have read the CLA Document and I hereby sign the CLA |
Why: - delegated tasks captured the parent model but still fell back to built-in agent/category defaults when no explicit model override existed - this made runtime model selection inconsistent for users who switch the main orchestrator model What: - insert inherited parent model ahead of built-in delegate defaults in delegate-task model resolution - keep explicit agent/category model overrides higher priority than inherited models - add regression coverage for subagent and category inheritance behavior Impact: - unconfigured delegated tasks now follow the parent session model more consistently - explicitly configured delegated tasks keep their existing behavior Refs: code-yeongyu#2737
Why: - inherited subagent models can now resolve to unstable providers such as gemini or minimax - the previous guard only forced supervised execution for category-based delegation, which left inherited subagent paths unsafeguarded What: - carry actualModel and unstable-agent detection through subagent routing results - apply the unstable-model supervision path for delegated tasks regardless of whether they use category or subagent_type - add regression coverage for inherited unstable subagent models Impact: - delegated subagents keep the same runtime safety behavior as category-based tasks when they inherit unstable models - explicit model precedence remains unchanged
5ada402 to
70d58f9
Compare
|
recheck |
|
This PR has merge conflicts with the recently merged #2892 (category-resolver.ts cold-cache fix). Could you rebase on the latest dev branch? The model inheritance approach is approved — parent model fallback for unconfigured tasks is the right behavior. Just needs a clean rebase to resolve the conflict. Thanks! |
|
I have read the CLA Document and I hereby sign the CLA |
Why: - the PR branch needed to sync with upstream/dev, but the previous merge commit used an unsigned author identity and blocked CLA - the upstream sync also dropped direct unstable subagent supervision and left an unused routing helper behind What: - re-sync the branch with upstream/dev using the signed noreply identity - preserve inherited-model behavior across category and subagent routing while restoring supervised execution for direct unstable subagents - remove the unused task-routing-resolver and keep the regression coverage for the repaired path Impact: - the PR keeps the upstream sync, remains mergeable against dev, and no longer depends on an unsigned merge commit - direct unstable subagents regain monitored execution and the delegate-task tree stays clean
33d226e to
acc52eb
Compare
|
@code-yeongyu Sorry for the late reply, and thank you for confirming that the model inheritance approach is the right direction. I had assumed this issue was no longer needed, so I did not follow up quickly enough. I've now rebased the branch onto the latest dev, resolved the conflict from #2892, restored the unstable-subagent supervision path that regressed during the sync, removed the leftover dead routing helper, and re-ran the relevant tests and build locally. Thanks again for the guidance. |
Summary
Why
Delegated tasks already capture the parent session model, but unconfigured subagents/categories still fall back to built-in defaults instead of following the parents current effective model. That makes runtime model selection inconsistent whenever users switch the main orchestrator model.
Behavior
Validation
bun test src/tools/delegate-task/model-inheritance.test.tsbun test src/tools/delegate-task/tools.test.tsRelated
Fixes #2737
Summary by cubic
Delegated tasks inherit the parent session model when no subagent/category model is set, and unstable-model supervision is enforced for both category and direct
subagent_typecalls. Explicit agent/category overrides still win. Fixes #2737.Bug Fixes
modelInfomarkinginherited.actualModel/isUnstableAgentpropagate from subagent routing and a common guard runs whenrun_in_background=false.Refactors
tools.ts;resolveSubagentExecutionnow acceptsinheritedModeland returnsactualModel/isUnstableAgent.flattenToFallbackModelStrings,agentCategoryModel,fuzzyMatchModel); removed an unused routing helper.Written for commit acc52eb. Summary will update on new commits.