Skip to content

refactor(ticket-186): extract MultiAgentOrchestrator.run stages into focused helpers (STARTER-619) - #371

Merged
ifuri-validator-agent[bot] merged 1 commit into
mainfrom
ticket/186-multi-agent-run-complexity
Sep 20, 2026
Merged

ifuri-validator-agent[bot] merged 1 commit into
mainfrom
ticket/186-multi-agent-run-complexity

Conversation

@tom-sapletta-com

Copy link
Copy Markdown
Contributor

Extract the run() stages (GitHub sync, queue collection, dry-run plan, worker reaping, backlog promotion, worker spawn) from MultiAgentOrchestrator.run (src/koru/multi_agent.py, CC 31 → below limit 15) into focused private helpers. Behavior unchanged; no public API change.

Ticket: ticket-186 (workstream: application, workflow state: PUBLICATION).
Planfile source: STARTER-619 (code2llm high-CC method).

Validation evidence (branch ticket/186-multi-agent-run-complexity, base origin/main = 52c5a3a2): recorded in project/ticket-186/README.md on the branch — code2llm CC re-run under 15, tests/test_multi_agent.py passes unmodified, ruff check/format clean, ./project/governance-check.sh --base origin/main passes.

…elpers (STARTER-619)

code2llm flagged MultiAgentOrchestrator.run at CC=31 (limit 15). Extract
behavior-preserving private helpers for each orchestration stage (GitHub
sync, queue collection, dry-run plan, worker reaping, backlog promotion,
worker spawn); run() now only orchestrates and accounts, CC 32 -> 9 by
AST recount. No public API, output, exit-code or scheduling change;
tests/test_multi_agent.py and tests/test_cli_auto.py pass unmodified.

@ifuri-validator-agent ifuri-validator-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validator approval after policy checks for exact head 11ecdd7502aad46ee7a4d5743a2eabd85f63810e.

Ticket: ticket-186
Correlation ID: local-semcod-koru-pr-371-ticket-186
Model: zai/glm-5.3
Reviewed diff chunks: 2
Advisory LLM verdict: APPROVE
Advisory summary: Reviewed all 2 diff chunk(s). Behavior-preserving decomposition of MultiAgentOrchestrator.run into single-responsibility private helpers (_sync_github_issues, _collect_pending_tasks, _print_dry_run_plan, _reap_finished_workers, _promote_backlog_task, _try_spawn_next_worker). No public API or CLI changes. Required checks (onedev/local-verify, standard packs / conformance) pass per the protected assessment. Ticket intent metadata and allowed paths align with the changed files. This is chunk 1 of 2; remaining diff reviewed separately. | Chunk 2 of a complexity-reduction refactor extracting run() stages (_reap_finished_workers, _try_spawn_next_worker, _sync_github_issues, _collect_pending_tasks, _print_dry_run_plan, spawn helper) from MultiAgentOrchestrator. Logic is preserved: worker reaping, timeout termination, one-worker-per-project invariant, capacity limiting, backlog promotion (not visible in this chunk but referenced via build_worker_command path), and exit code semantics (0 only when failed_count == 0). Spawn failure now returns (True, 1) so the loop continues without sleeping, matching the pre-refactor flow of attempting at most one spawn per iteration. Required protected checks (onedev/local-verify, standard packs / conformance) pass; no failed tests reported.
Advisory findings: none
The LLM output above is advisory and was not used as the approval trust root.
Semantic review prerequisite: not_required; policy 676cb4516bbfed2a000e40b9b1b6e4a430ecc761ec546aeb53d721a1905cfdd7.

Actual PR impact radar

Exact range: 52c5a3a2f8158553770ea98c0b2e9b5fb7972cd7...11ecdd7502aad46ee7a4d5743a2eabd85f63810e
Change digest: 2079735e0754f7cedd26985597f2f69c8de46c87119952393d475a6a87526bf0
Score: 64/100 (L), estimated 73 min, split recommended: true
Affected services/components: repository-wide/unclassified

Machine-readable radar JSONL and SVG
{"actual_change":{"additions":276,"base_sha":"52c5a3a2f8158553770ea98c0b2e9b5fb7972cd7","binary_files":0,"categories":{"code":1,"configuration":1,"docs":1},"change_digest":"2079735e0754f7cedd26985597f2f69c8de46c87119952393d475a6a87526bf0","comparison":"52c5a3a2f8158553770ea98c0b2e9b5fb7972cd7...11ecdd7502aad46ee7a4d5743a2eabd85f63810e","deletions":95,"file_count":3,"files":["project/ticket-186/README.md","project/ticket-186/intent.json","src/koru/multi_agent.py"],"head_sha":"11ecdd7502aad46ee7a4d5743a2eabd85f63810e","service_count":0,"services":[]},"assessment_mode":"observed-pr","axes":{"coupling":5,"delivery":3,"scope":4,"uncertainty":3,"validation":1},"complexity":"L","confidence":0.9,"diagnostics":["RADAR-ACCEPTANCE-MISSING","RADAR-BUDGET-EXCEEDED"],"estimate":{"budget_minutes":30,"minutes":73,"within_budget":false},"impact":{"components":["check","origin","project","src/koru","tests","ticket"],"files":["check/format","origin/main","project/governance-check.sh","project/ticket-186/README.md","project/ticket-186/intent.json","src/koru/multi_agent.py","tests/test_multi_agent.py","ticket/186-multi-agent-run-complexity"],"public_interfaces":[],"runtime_dependencies":0},"schema":"subactor.ticket-radar/v1","score":64,"split":{"parts":[{"estimated_minutes":11,"name":"Implement check","scope":["check"]},{"estimated_minutes":11,"name":"Implement origin","scope":["origin"]},{"estimated_minutes":11,"name":"Implement project","scope":["project"]},{"estimated_minutes":11,"name":"Implement src/koru","scope":["src/koru"]},{"estimated_minutes":11,"name":"Implement tests","scope":["tests"]},{"estimated_minutes":15,"name":"Validate and project to trackers","scope":["tests","planfile","github/gitlab/jira projections"]}],"reason":"estimated_minutes_exceed_budget","recommended":true},"standards":[{"id":"wellmanifest/dsl","revision":"6c60fc4e0dd1f1bb74f46a7745e28019908d1203","version":"0.1.0-dev"},{"id":"wellmanifest/ticket-lifecycle","revision":"5bf581907a87b46a13a73e6c033d3abe4d9a306f","version":"0.1.0-dev"},{"id":"wellmanifest/git-lifecycle","revision":"7d77d4b7af57e69bc75c3a0290b3a4805c5c4438","version":"0.2.0-dev"},{"id":"wellmanifest/logs","revision":"48c284ef7a069055c0bcb6b900147ce5e65f8b43","version":"0.3.0"}],"ticket_ref":"ticket-186"}
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128" role="img"><title>ticket-186: refactor(ticket-186): extract MultiAgentOrchestrator.run stages into focused helpers (STARTER-619)</title><rect width="128" height="128" rx="12" fill="#f8fafc"/><g stroke-width="1"><polygon points="64,55 72,61 69,71 59,71 56,61" fill="none" stroke="#d7dde5"/><polygon points="64,47 80,59 74,78 54,78 48,59" fill="none" stroke="#d7dde5"/><polygon points="64,38 89,56 79,85 49,85 39,56" fill="none" stroke="#d7dde5"/><polygon points="64,30 97,53 84,92 44,92 31,53" fill="none" stroke="#d7dde5"/><polygon points="64,21 105,51 89,99 39,99 23,51" fill="none" stroke="#d7dde5"/><line x1="64" y1="64" x2="64" y2="21" stroke="#aab4c0"/><line x1="64" y1="64" x2="105" y2="51" stroke="#aab4c0"/><line x1="64" y1="64" x2="89" y2="99" stroke="#aab4c0"/><line x1="64" y1="64" x2="39" y2="99" stroke="#aab4c0"/><line x1="64" y1="64" x2="23" y2="51" stroke="#aab4c0"/></g><polygon points="64,30 105,51 79,85 59,71 39,56" fill="#fb923c" fill-opacity="0.45" stroke="#c2410c" stroke-width="2"/><circle cx="64" cy="64" r="3" fill="#c2410c"/><g font-family="sans-serif" font-size="7" fill="#334155"><text x="64" y="11" text-anchor="middle">SCO</text><text x="114" y="48" text-anchor="middle">COU</text><text x="95" y="107" text-anchor="middle">UNC</text><text x="33" y="107" text-anchor="middle">VAL</text><text x="14" y="48" text-anchor="middle">DEL</text></g><text x="64" y="124" text-anchor="middle" font-family="sans-serif" font-size="8" fill="#0f172a">L · 73m</text></svg>
Merge will be attempted after this approval when explicitly authorized. ## Decision record (recomputable)
DECISION D-186-3917
TICKET ticket-186
HEAD_SHA 11ecdd7502aad46ee7a4d5743a2eabd85f63810e
CORRELATION_ID local-semcod-koru-pr-371-ticket-186
ACTOR agent:ifuri-validator-agent[bot]
APPLIED_RULE P-CORE-015
INPUT author_login = "tom-sapletta-com"
INPUT observed_checks = ["governance / remote lifecycle=PASS","standard packs / conformance=PASS","governance / enforce=PASS","onedev/local-verify=PASS"]
INPUT required_checks = ["onedev/local-verify","standard packs / conformance"]
INPUT required_checks_source = "protected registry + GitHub applied rules (env/request)"
INPUT reviewer_login = "ifuri-validator-agent[bot]"
INPUT semantic_review_assessment = {"schema":"subactor.validator/semantic-review-assessment/v1","subject":{"repository":"semcod/koru","pull_request":371,"head_sha":"11ecdd7502aad46ee7a4d5743a2eabd85f63810e","base_sha":"52c5a3a2f8158553770ea98c0b2e9b5fb7972cd7","diff_sha256":"8588d10825278f35f5a0f631a9aca3932658b98af86af14c0ca67b2c22eaa975"},"policy":{"policy_schema":"subactor.validator/semantic-review-policy/v1","policy_version":1,"policy_sha256":"676cb4516bbfed2a000e40b9b1b6e4a430ecc761ec546aeb53d721a1905cfdd7","required":false,"critical_paths":[],"observed_paths":["project/ticket-186/README.md","project/ticket-186/intent.json","src/koru/multi_agent.py"]},"grounding":"full-diff-not-per-finding-proof","execution_authority":false,"status":"not_required","reason":null,"review_sha256":null,"unresolved":[]}
INPUT superseded_checks = ["smoke"]
INPUT ticket_radar_receipt = {"schema":"subactor.ticket-radar/v1","base_sha":"52c5a3a2f8158553770ea98c0b2e9b5fb7972cd7","head_sha":"11ecdd7502aad46ee7a4d5743a2eabd85f63810e","change_digest":"2079735e0754f7cedd26985597f2f69c8de46c87119952393d475a6a87526bf0","score":64,"complexity":"L","estimated_minutes":73,"split_recommended":true,"services":[],"authority":"ADVISORY","promotion":"FORBIDDEN"}
VERDICT APPROVE AUTHORITY DETERMINISTIC
REJECTED REQUEST_CHANGES BECAUSE NO_UNSAFE_CHANGE_REASON_FOUND
ADVISORY llm_verdict = "APPROVE" MODEL "zai/glm-5.3"
ASSERT VERDICT_AUTHORITY != "ADVISORY"

@ifuri-validator-agent
ifuri-validator-agent Bot merged commit 24d901b into main Sep 20, 2026
5 checks passed
@ifuri-validator-agent
ifuri-validator-agent Bot deleted the ticket/186-multi-agent-run-complexity branch September 20, 2026 04:29
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.

1 participant