fix(dispatch): map custom agents to general-purpose in swarm background dispatch#977
Merged
Merged
Conversation
…nd dispatch Custom project agents (lambda-developer, frontend-developer, etc.) cause CAPIError 401 'Invalid auto-mode selector' when dispatched via task() in background mode, because the task() tool only accepts built-in agent types (explore, task, general-purpose, rubber-duck, code-review, research, security-review). Changes: - Extract _TASK_BUILTIN_AGENT_TYPES (frozenset) at module level - Add _resolve_dispatch_agent_type() helper — returns 'general-purpose' for any custom agent, identity for built-ins - Replace two duplicated inline sets in cmd_swarm() (prompt + parallel output modes) with calls to the helper - Run ruff format to clean whitespace Fixes: swarm --agent-type lambda-developer no longer produces broken task() calls that fail with 401 in background dispatch.
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.
Problem
Custom project agents (e.g. \lambda-developer, \rontend-developer) cause:
\
CAPIError: 401 401 401 Invalid auto-mode selector
\
when dispatched via \ ask()\ in background mode. The \ ask()\ tool only supports built-in agent types in background dispatch.
Root cause
\cmd_swarm()\ passed the user-supplied --agent-type\ value directly into the generated \ ask()\ call for both --output prompt\ and --output parallel\ modes. Custom agent types are not valid for \ ask()\ background dispatch.
Fix
uff format\ to clean whitespace
Testing
uff check\ → all checks passed
uff format\ → reformatted (1 file)