Skip to content

feat(s12_agent): parallel orchestrator with bounded semaphore#200

Merged
CocoRoF merged 1 commit into
mainfrom
feat/llm-backend/d2-subagent-parallel
May 17, 2026
Merged

feat(s12_agent): parallel orchestrator with bounded semaphore#200
CocoRoF merged 1 commit into
mainfrom
feat/llm-backend/d2-subagent-parallel

Conversation

@CocoRoF
Copy link
Copy Markdown
Owner

@CocoRoF CocoRoF commented May 17, 2026

Summary

Phase D2 of the LLM backend upgrade cycle. Sub-agent dispatch now supports mixed serial + parallel groups. Serial requests run first in input order; parallel-marked requests fan out through `asyncio.gather` bounded by a semaphore sized at `min(max_concurrent)` of the involved descriptors.

What's new

  • Two-pass orchestrator: partition by descriptor.parallel → serial first → parallel fan-out.
  • Failure isolation preserved across both paths.
  • `tests/unit/test_subagent_parallel.py` (NEW) — 7 cases covering wall-time budget, max_concurrent cap, mixed-cap min(), serial order preservation, parallel-failure isolation, empty no-op, pure-serial unchanged.

Test plan

  • `pytest tests/unit/test_subagent_parallel.py` — 7 pass
  • Full repo: 3221 passed, 8 skipped, 0 failed

Plan reference: `docs/llm-backend-upgrade-plan/07_rollout_phases.md` (Phase D2).

Phase D2 of the LLM backend upgrade. Sub-agent dispatch now supports
mixed serial + parallel groups. Serial requests run first in input
order; parallel-marked requests fan out through asyncio.gather, with
the group's semaphore sized at min(max_concurrent) of the involved
descriptors.

SubagentTypeOrchestrator.orchestrate
- Two-pass: partition state.delegate_requests by descriptor.parallel,
  dispatch serial sequentially (preserves input order for deterministic
  logging), then fan out the parallel group bounded by asyncio.Semaphore.
- Unknown agent_types and parallel=False go through the serial path.
- Existing failure-isolation contract preserved: one factory crash
  becomes a structured sub_result without aborting siblings.

Tests (tests/unit/test_subagent_parallel.py, NEW)
- 7 cases: wall-time budget proves parallel pair runs concurrently,
  max_concurrent cap respected, mixed-cap group uses min(), serial
  input-order preserved, parallel-failure isolation, empty
  delegate_requests no-op, pure-serial path unchanged from D1.

Full suite: 3221 passed, 8 skipped, 0 failed.

Plan reference: docs/llm-backend-upgrade-plan/07_rollout_phases.md (Phase D2).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CocoRoF CocoRoF merged commit 85b226d into main May 17, 2026
5 of 6 checks passed
@CocoRoF CocoRoF deleted the feat/llm-backend/d2-subagent-parallel branch May 17, 2026 13:26
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