fix: allow plugin-registered agent roles in factory agent CLI - #1267
Draft
shivchander wants to merge 2 commits into
Draft
fix: allow plugin-registered agent roles in factory agent CLI#1267shivchander wants to merge 2 commits into
shivchander wants to merge 2 commits into
Conversation
Plugin modes registered via add_modes() failed Pydantic validation when headless mode created a CycleState, since the Literal type only accepted hardcoded built-in mode names. Closes #1262 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The hardcoded choices list in argparse rejected plugin-registered roles before the agent runner could execute. Move validation to cmd_agent() where it checks both BUILTIN_AGENT_ROLES and plugin-registered roles via get_registry().agent_roles. Add add_agent_roles() to PluginRegistry following the same collision-guard pattern as add_modes(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sentrux Quality ReportAbsoluteDiff (vs base branch) |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (39.13%) is below the target coverage (79.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1267 +/- ##
==========================================
- Coverage 86.34% 86.29% -0.05%
==========================================
Files 211 211
Lines 23054 23075 +21
Branches 3627 3632 +5
==========================================
+ Hits 19906 19913 +7
- Misses 2308 2321 +13
- Partials 840 841 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes #1260
Changes
BUILTIN_AGENT_ROLESfrozenset infactory/cli/_parser_groups.pyas the single source of truth for built-in roleschoicesfrom the argparseroleargument — argparse no longer rejects unknown roles at parse timecmd_agent()that checks the role againstBUILTIN_AGENT_ROLES | plugin_registry.agent_roles, returning a clear error with valid role listagent_rolesfield andadd_agent_roles()method toPluginRegistryinfactory/plugins.py, following the same collision-guard pattern asadd_modes()factory pluginsoutput