Repository navigation
Let the supervisor choose model and effort for each worker it delegates (#318) - #325
Merged
Merged
Conversation
…es (#318) TaskCreate and the delegate MCP tool take optional model and effort, validated at task creation against the resolved provider profile's models/effort_levels (422 with the allowed values otherwise), recorded on the task and its attempt, and applied as the new session's /model and /effort override before the attempt's first brief — never by a call after the fact. Leaving both unset is unchanged behavior. Show the chosen model and effort on the task view, and expand the delegate tool's guidance with provider-neutral rules for choosing a tier, reading model names from the resolved profile instead of hardcoding one provider's. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
modelandefforttoTaskCreateand thedelegateMCP tool, validated at task creation against the resolved provider profile'smodels/effort_levels(explicitprovider_profile_id, else the project's or installation's default). Either named but not offered answers422with aTaskErrorwhose detail carriesallowed_models/allowed_effort_levels, via a newapierr.ReasonDetail/tasks.Error.Detail. Leaving both unset is unchanged behavior./model//effortoverride (SetModelOverride/SetEffortOverride, the same storage the owner's routes use) before the attempt's first brief is sent insendBrief— never by a call after the fact that could race the first turn.Task/TaskAttempt.model/.effort); a task-owned session's own view already shows them automatically, since they're the same override storage the chat composer already reads.delegatetool's description with short, provider-neutral guidance for choosing a tier: scope/risk/reversibility, mechanical vs. judgment work, a cost bias toward the cheapest choice likely to succeed, and preferring a higher tier when re-delegating a failure. It names no provider's models, pointing at the resolved profile's own list instead.00340_task_model_effort.sqladdsmodel/effortcolumns totasksandtask_attempts, and includes the attempt's columns in the existing routing-immutability trigger.docs/specs/delegation.md(new "Choosing a worker's model and effort" section),docs/specs/sessions.md,docs/specs/chat.md(cross-reference).Note:
task_retry/task_reassign(handoff) remain stubbed/unavailable in this codebase, so there's no live "resume" path to exercise yet; the attempt-level copy (beginCreate) is the inheritance primitive the issue asks for, ready for when handoff lands.Test plan
go build ./...,go vet,golangci-lint runclean on touched packagesgo generate ./...produces no further diff (contract/codegen drift check)TestCreateValidatesModelAndEffort(server/internal/tasks/service_test.go): validation against the resolved profile, persistence, 422 allowed-values detail, unchanged default — passing against a real test PostgresTestDelegateAppliesModelAndEffortBeforeTheFirstTurn(server/internal/tasks/provision_test.go): attempt persistence + override applied before the first brief + unchanged default when unset — passingserver/internal/tasks,server/internal/sessions,server/internal/mcpserver,server/internal/app(apicheck) suites pass against a real test Postgrestsc -b,eslint,vitest run src/lib/taskState.test.ts,vite buildall clean; newmodelEffortLabeltestpnpm dlx redocly lint api/openapi.yamlvalid6f03c26a77bd16bbddd4a049f544653a50e1b0ed6126416841d3318da7c35eed,health_ok: true, smoke 10 ok/0 fail/1 skip🤖 Generated with Claude Code