Skip to content

Navigation Menu

Sign in
Sign up

feat(orchestrator): goal-level coordination step (P2-ii-a) - #1128

Draft
najmuzzaman-mohammad wants to merge 1 commit into
deepagents/09-review-hardening from
deepagents/10-goal-coordinate
Draft

feat(orchestrator): goal-level coordination step (P2-ii-a) #1128
najmuzzaman-mohammad wants to merge 1 commit into
deepagents/09-review-hardening from
deepagents/10-goal-coordinate

Conversation

@najmuzzaman-mohammad

@najmuzzaman-mohammad najmuzzaman-mohammad commented Jun 26, 2026

Copy link
Copy Markdown
Owner

P2-ii-a — Goal-level coordination step (stacked on #1127)

Wires the P2-i coordination kernel into a live goal-level step. A goal decomposes into ordered tasks and runs through LangGraph, one slice closer to the P2-ii gate.

Trigger (your pick): rides the existing dispatch loop. A goal (a top-level task that has children) becoming executable coordinates its children instead of dispatching the parent as a single turn. A leaf still takes the P1b single-task /run path. Single ownership either way.

Wire shape (new)

CoordinateRequest{schema_version, goal_id, children[]}CoordinationPlan{goal_id, actions{task_id→action}, ready[], cycle?} — with extra="forbid" + server-side schema_version validation (the P2-0 discipline, so a half-landed field on the new shape fails loud).

Orchestrator (Python)

  • coordination.py coordinate(graph) → per-child action + ready batch + cycle path. A dependency cycle ⇒ every child BLOCK and the path surfaced (deadlocked decomposition, never a runnable plan).
  • POST /coordinate — pure (no harness/checkpointer) over TaskGraph.from_broker_records.

Broker (Go)

  • taskIsGoal (top-level + has children) routes to coordinateGoalViaOrchestrator.
  • Sends depends_on = DependsOn ∪ BlockedOn so the kernel's release rule matches the broker's unblock cascade (which sweeps both; orchestratorRecord omits them).
  • Applies the plan: STARTTransitionLifecycle(running) (the notify loop dispatches it next tick), DISPATCH → single-task /run now, BLOCK/IDLE/AWAIT → leave, UNKNOWN/cycle → fail loud and act on nothing. Per-goal single-flight (distinct key space), panic-recover, shutdown-aware ctx — reuses the P2-0 guards.
  • DispatchClient.Coordinate; postStep refactored to share postRaw.

Verification

  • pytest green (+ coordinate kernel + endpoint cases: serial / parallel / cycle / rejected-upstream).
  • Live smoke SMOKE OK/coordinate returns {c1: start, c2: block}, ready [c1].
  • go vet + golangci-lint clean; internal/team + internal/provider green under -race, including a real-client /coordinate E2E through the broker (child enumeration → real DispatchClient → real HTTP → START transition). Only the pre-existing env-only TestBrokerAuthRejectsUnauthenticated fails (gbrain on local PATH; green in CI).

Next (P2-ii-b): decompose-turn classification — a planning turn's team_task create calls → child specs (the CEO decompose node), feeding the children this PR coordinates.

🤖 Generated with Claude Code

...s children and apply a per-child action plan (P2-ii-a)
Wires the P2-i coordination kernel into a live goal-level step. A "goal" is a
top-level task that has children (the broker has no goal/epic struct — children
carry ParentIssueID); when one becomes executable, the broker coordinates its
children instead of dispatching the parent as a single agent turn.
Wire shape (new): CoordinateRequest{schema_version, goal_id, children[]} ->
CoordinationPlan{goal_id, actions{task_id->action}, ready[], cycle?}. extra="forbid"
+ server-side schema_version validation, matching the P2-0 contract discipline.
Orchestrator (Python):
- coordination.py `coordinate(graph)` -> CoordinationResult: per-child action,
 the ready batch, and a cycle path. A dependency cycle is a deadlocked
 decomposition: every child BLOCKs and the path is surfaced so the broker fails
 loud rather than running an unrunnable plan.
- service.py `POST /coordinate`: pure (no harness, no checkpointer) over
 TaskGraph.from_broker_records.
Broker (Go) — rides the existing dispatch loop (the chosen trigger):
- sendTaskUpdate routes a goal (taskIsGoal: top-level + has children) to
 coordinateGoalViaOrchestrator; a leaf still takes the single-task /run path.
- coordinateGoalViaOrchestrator enumerates children and sends
 depends_on = DependsOn ∪ BlockedOn, so the kernel's release rule matches the
 broker's unblock cascade (which sweeps both — orchestratorRecord omits them).
- applyCoordinationPlan: START -> TransitionLifecycle(running) (the notify loop
 dispatches it next tick); DISPATCH -> single-task /run now; BLOCK/IDLE/AWAIT ->
 leave; UNKNOWN/cycle -> fail loud, act on nothing. Per-goal single-flight in a
 key space distinct from per-task dispatch; panic-recover + shutdown-aware ctx
 reuse the P2-0 guards.
- provider.DispatchClient.Coordinate over POST /coordinate; postStep refactored to
 share postRaw with the new endpoint.
Tests: pytest +coordinate cases (serial/parallel/cycle/rejected-upstream + the
endpoint); Go provider Coordinate decode/validation/cycle; broker apply-plan,
union-deps, cycle-does-nothing, taskIsGoal; a real-client /coordinate E2E through
the broker. Live smoke adds a /coordinate assertion. pytest green; go vet +
golangci-lint clean; team/provider suites green under -race (except the
pre-existing env-only TestBrokerAuthRejectsUnauthenticated — gbrain on PATH).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6a80d9c4-6794-4aa3-afdc-3ca46136e756

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deepagents/10-goal-coordinate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /