Skip to content

fix: allow plugin-registered agent roles in factory agent CLI - #1267

Draft
shivchander wants to merge 2 commits into
mainfrom
fix/1260-plugin-agent-roles
Draft

fix: allow plugin-registered agent roles in factory agent CLI#1267
shivchander wants to merge 2 commits into
mainfrom
fix/1260-plugin-agent-roles

Conversation

@shivchander

Copy link
Copy Markdown
Collaborator

Closes #1260

Changes

  • Add BUILTIN_AGENT_ROLES frozenset in factory/cli/_parser_groups.py as the single source of truth for built-in roles
  • Remove hardcoded choices from the argparse role argument — argparse no longer rejects unknown roles at parse time
  • Add dynamic validation in cmd_agent() that checks the role against BUILTIN_AGENT_ROLES | plugin_registry.agent_roles, returning a clear error with valid role list
  • Add agent_roles field and add_agent_roles() method to PluginRegistry in factory/plugins.py, following the same collision-guard pattern as add_modes()
  • Show registered plugin agent roles in factory plugins output

shivchander and others added 2 commits August 14, 2026 16:28
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>
@github-actions

Copy link
Copy Markdown

Sentrux Quality Report

Absolute

Scanning ....
[scan] git ls-files: 609 total, 597 kept, 12 dropped (ext:12, meta:0, big:0)
[build_project_map] 597 files, 102 unique dirs, 94 cache misses, 2.6ms
[resolve] 1091 resolved, 1537 unresolved (of 2628 total specs)
[resolve_imports] project_map 2.7ms, suffix_idx 0.9ms, suffix_resolve 11.8ms, total 15.4ms
[build_graphs] 597 files | maps 1.7ms, imports 15.5ms, calls+inherit 4.3ms, total 21.6ms | 1090 import, 8622 call, 11 inherit edges
sentrux check — 3 rules checked

Quality: 4694

✗ [Error] max_cc: 3 function(s) exceed max cyclomatic complexity of 30
    factory/cli/_ceo_helpers.py:_validate_ceo_flags (cc=43)
    factory/cli/_ceo_helpers.py:_execute_ceo (cc=43)
    factory/cli/run.py:cmd_run (cc=32)

✗ 1 violation(s) found

Diff (vs base branch)

Scanning ....
[scan] git ls-files: 609 total, 597 kept, 12 dropped (ext:12, meta:0, big:0)
[build_project_map] 597 files, 102 unique dirs, 94 cache misses, 2.5ms
[resolve] 1091 resolved, 1537 unresolved (of 2628 total specs)
[resolve_imports] project_map 2.7ms, suffix_idx 0.9ms, suffix_resolve 11.7ms, total 15.2ms
[build_graphs] 597 files | maps 1.8ms, imports 15.4ms, calls+inherit 4.9ms, total 22.2ms | 1090 import, 8622 call, 11 inherit edges
sentrux gate — structural regression check

Quality:      4790 -> 4694
Coupling:     0.79 → 0.79
Cycles:       3 → 3
God files:    3 → 3

Distance from Main Sequence: 0.38

✓ No degradation detected

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 39.13043% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.29%. Comparing base (4129ba2) to head (1b58e3f).

Files with missing lines Patch % Lines
factory/plugins.py 18.18% 9 Missing ⚠️
factory/cli/agents.py 57.14% 2 Missing and 1 partial ⚠️
factory/cli/_main.py 0.00% 2 Missing ⚠️

❌ 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Plugin agent roles rejected by factory agent CLI choices

1 participant