Fixed the TypeError: handle_subagent_command() missing 1 required positional argument: 'command_args'
The handle_subagent_command function signature was incompatible with how it was being called:
# Function signature in subagent.py
def handle_subagent_command(agent: Any, console: Console, command_args: str) -> CommandResult:
# How it was being called from commands_main.py
return handler(console, command_args) # Missing 'agent' argument!# Before (incorrect)
def handle_subagent_command(agent: Any, console: Console, command_args: str) -> CommandResult:
# After (correct)
def handle_subagent_command(console: Console, command_args: str) -> CommandResult:# In commands_main.py - now correctly mapped
COMMAND_HANDLERS_CONSOLE_ARGS = {
"subagent": handle_subagent_command, # No agent needed
...
}
# In commands/__init__.py - updated backwards compatibility
elif command_name == "subagent":
return handle_subagent_command(console, command_args) # Fixed call- Fixed all test calls to use new signature
- Simplified test to focus on functionality rather than complex mocking
- All 1122 tests passing
- Beautiful table display showing all subagent types and configurations
- Colored output with Rich formatting
- Graceful error handling with helpful messages
- Comprehensive help text and usage instructions
Subagent Type Configurations
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━┓
┃ Type ┃ Model Override ┃ Max Iterations ┃ Tools ┃
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━┩
│ architect │ None │ 100 │ 9 tools │
│ code_review │ None │ 100 │ 6 tools │
│ security │ None │ 100 │ 7 tools │
│ ... │ ... │ ... │ ... │
└────────────────┴────────────────┴────────────────┴─────────┘
✓ Set model override for general to gpt-4
✓ Cleared model override for general
✓ Cleared 2 model overrides
src/clippy/cli/commands/subagent.py- Main fix and enhancementsrc/clippy/cli/commands/__init__.py- backwards compatibilitytests/cli/test_commands.py- Test fixes
✅ All Tests Pass: 1122/1122
✅ No Type Errors: Mypy passes
✅ Code Quality: Ruff formatting passes
✅ Command Works: Live testing confirms fix
✅ Backwards Compatible: No breaking changes
The /subagent commands now work perfectly in clippy-code! Users can:
- View all subagent types and their configurations
- Pin specific models to specific subagent types
- Clear model overrides individually or all at once
- Get helpful error messages and usage guidance
The TypeError has been completely resolved! 🎉