feat(dynamic-workflow): run subagents on a chosen model - #30
Conversation
Let a workflow hand mechanical work to a cheaper or faster model while the orchestrating agent stays where it is. DynamicWorkflow accepts model and effort, carried on QueuedSubagentTask through SubagentBatch into RunSubagentOptions, where the existing option-then-profile-then-parent precedence resolves them. /workflow model <alias> stores the choice for the session and passes it to the task as an instruction, so the agent can still pick something else when the work plainly calls for it.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 37 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughDynamicWorkflow now accepts optional subagent ChangesDynamic Workflow model configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
commit: |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/pythinker-code/src/tui/commands/dynamic-workflow.ts`:
- Line 114: Update the regular expression in the command parser to include the
Unicode (`u`) flag, preserving its existing case-insensitive matching and
capture behavior so it satisfies Oxlint’s require-unicode-regexp rule.
In `@apps/pythinker-code/test/tui/commands/dynamic-workflow.test.ts`:
- Around line 356-359: Update the test covering handleDynamicWorkflowCommand
with 'model off' to also assert that host.state.appState.dynamicWorkflowModel is
undefined after the command completes, while retaining the existing
status-message assertion.
In `@packages/agent-core/src/tools/builtin/collaboration/dynamic-workflow.md`:
- Line 7: Update the workflow documentation describing model fallback behavior
to include all outcomes: fallback to the calling agent when no model is
configured by the subagent profile, and fallback behavior when the configured
model alias cannot be resolved. Keep the existing subagent-profile fallback
guidance and ensure the documented rules apply to every subagent in the call.
In `@packages/agent-core/test/session/subagent-batch.test.ts`:
- Around line 672-685: Extend the existing resume and rate-limit retry test
cases alongside the spawn-task coverage to assert that every recorded
RunSubagentOptions attempt preserves both modelAlias and thinkingLevel. Use the
existing attempt collections and expected routed-task values, while keeping the
current completion and retry behavior unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a73b5b13-e3c9-49b2-a1c1-ff1638d0f432
📒 Files selected for processing (13)
.changeset/dynamic-workflow-subagent-model.mdapps/pythinker-code/src/tui/commands/dynamic-workflow.tsapps/pythinker-code/src/tui/commands/registry.tsapps/pythinker-code/src/tui/types.tsapps/pythinker-code/test/tui/commands/dynamic-workflow.test.tsapps/pythinker-code/test/tui/commands/registry.test.tsdocs/reference/slash-commands.mddocs/reference/tools.mdpackages/agent-core/src/session/subagent-batch.tspackages/agent-core/src/tools/builtin/collaboration/dynamic-workflow.mdpackages/agent-core/src/tools/builtin/collaboration/dynamic-workflow.tspackages/agent-core/test/session/subagent-batch.test.tspackages/agent-core/test/tools/builtin-current.test.ts
Add the Unicode flag to the /workflow model parser so it satisfies the repo's require-unicode-regexp rule. Assert the cleared state in the model-preference test instead of only its status message, and extend the batch propagation test to the resume and retry launch paths. Document the fallback to the calling agent's model and the unresolved-alias fallback in the tool description, not only in the reference docs.
An alias the engine cannot resolve falls back to the session model when the subagent spawns, so accepting one reported a routing that never happened. Check it against the configured models and show an error instead.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @pythoughts/pythinker-code@0.10.0 ### Minor Changes - [#30](#30) [`463b176`](463b176) - Let a Dynamic Workflow run its subagents on a different model than the agent orchestrating them. `DynamicWorkflow` accepts `model` and `effort` for every subagent in the call, and `/workflow model <alias>` sets that model for the session so an expensive orchestrator can hand mechanical work to a cheaper or faster one. ### Patch Changes - [#28](#28) [`cf5b6b1`](cf5b6b1) - Keep a subagent on the model and effort its profile assigns when the subagent is resumed or retried, instead of reverting it to the main agent's model. - [#31](#31) [`e5e9de4`](e5e9de4) - Brighten the periwinkle accent in the VS Code extension's dark theme so inline code in chat is easier to read. - [#31](#31) [`e5e9de4`](e5e9de4) - Let `/yolo` and `/auto` be used in the VS Code extension before the first message is sent — the request now applies to the session that chat opens next instead of failing with "Could not change the permission mode." Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: M Elkholy <melkholy@techmatrix.com>
Related Issue
No issue — problem described below.
Problem
Every subagent in a Dynamic Workflow ran on whatever model the calling agent
was using. A workflow that fans 128 children out over mechanical work — reading
files, applying a mechanical edit, running a check — paid the orchestrator's
model for all of it, and there was no way to say "plan here, implement there"
without editing an agent profile up front.
The provider layer already supported this: a model alias resolves to its own
provider per agent, and
configureChildalready honouredprofile.model/profile.effort(kept across resume by #28). The routing decision just had noway to reach a single run.
What changed
DynamicWorkflowacceptsmodelandeffort. Both apply to every subagent inthe call and travel on
QueuedSubagentTaskthroughSubagentBatchintoRunSubagentOptions, where the existing option → profile → parent precedenceresolves them, so the choice also survives resume and retry. An alias the
provider cannot resolve falls back to the calling agent's model instead of
failing at generate time.
/workflow model <alias>stores the choice for the session;/workflow modelreports it and
/workflow model offclears it. The alias reaches the run as aninstruction on the task prompt rather than a hard override, so the agent can
still pick something else when the work plainly calls for it — the same shape
as the existing Dynamic Workflow mode reminders.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.Summary by CodeRabbit
New Features
/workflow model <alias>to view, select, or clear the session’s subagent model.Documentation
Bug Fixes