Skip to content

feat(agent): select Subagent models per Task - #25

Open
jiangnan-ten wants to merge 1 commit into
CometixSpace:mainfrom
jiangnan-ten:feat/subagent-model-selection
Open

feat(agent): select Subagent models per Task#25
jiangnan-ten wants to merge 1 commit into
CometixSpace:mainfrom
jiangnan-ten:feat/subagent-model-selection

Conversation

@jiangnan-ten

Copy link
Copy Markdown

Why

Cursor++ currently ignores the model value from Task and Subagent calls. A child agent therefore inherits the parent model or an Explore Settings override, even when the parent selected another provider.

This change exposes the configured canonical BYOK model IDs to Task calls and validates the selected ID before Cursor starts the child agent. Invalid selections fail visibly instead of running a different model.

Scope

  • Build one immutable Subagent model catalog for each Agent run.
  • Add eligible ProviderModel.id values to the Anthropic, OpenAI, Gemini, and cursor-namespace Task schemas.
  • Resolve models with explicit > Settings > parent precedence.
  • Reject disabled, unknown, duplicated, and supportsAgent=false models.
  • Keep the selected model's providers.json thinking defaults. Task does not expose per-call thinking parameters.
  • Preserve complete Task results in checkpoints, including rejected launches.
  • Isolate Task-specific exec failures while preserving parent cancellation.
  • Add structured logs for the canonical model ID, provider entry, API model, parent call, and child agent.
  • Remove the unsupported fast and attachments Task schema options.

Ordinary resume calls reject an explicit model because the current client path does not prove that an existing composer switches models. resume=self remains a new fork and accepts a model.

Tradeoffs

The Task schema exposes internal canonical model IDs instead of accepting display names or API model names. The IDs are less readable, but exact IDs avoid ambiguous aliases and prevent silent routing to the wrong provider.

When no eligible model exists, Cursor++ removes Task from the run instead of publishing an empty model enum.

Blast Radius

The change affects Agent Task and Subagent dispatch, model metadata on ProviderRuntime, and Task result persistence. Other Agent tools and normal Composer model selection keep their existing behavior.

The main risk is Cursor client compatibility with the generated Task schema. A local VSIX built from this commit was installed and validated in Cursor before opening this PR.

Verification

  • pnpm run check-types: passed.
  • pnpm run lint: passed.
  • pnpm run test:server: 39 test files and 378 tests passed.
  • git diff --check: passed.
  • Independent reviews found cancellation, empty-catalog, and checkpoint persistence issues. All accepted findings were fixed before the final test run.
  • The built and installed dist/extension.js files had the same SHA-256 hash.
  • Manual Cursor validation confirmed that a Task can run a Subagent with the selected configured model.

Expose canonical BYOK model IDs to Task calls and fail closed when a requested model cannot run. Preserve complete tool lifecycles so rejected or failed Subagents do not corrupt resumes or cancel successful siblings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant