Update spawn-issues to event-driven pattern

Replace polling loop with task-notification based orchestration.
Background tasks send notifications when complete - no need to poll.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-10 01:03:08 +01:00
parent 392228a34f
commit c27659f1dd

View File

@@ -137,22 +137,24 @@ Process:
Work autonomously. If blocked, note it in PR description and report status as partial/failed. Work autonomously. If blocked, note it in PR description and report status as partial/failed.
``` ```
### Step 4: Poll and Pipeline ### Step 4: Event-Driven Pipeline
Run a polling loop until all issues reach a terminal state (approved, failed, or max iterations): **Do NOT poll.** Wait for `<task-notification>` messages that arrive automatically when background tasks complete.
When a notification arrives:
1. Read the output file to get the result
2. Parse the result and print status update
3. Spawn the next stage (reviewer/fixer) in background
4. Continue waiting for more notifications
``` ```
while any issue not in terminal state: On <task-notification> for task_id X:
for each issue: - Find which issue this task belongs to
check TaskOutput (block=false) for current task - Read output file, parse result
- Print status update
if task completed: - If not terminal state, spawn next agent in background
parse result - Update issue state
print status update - If all issues terminal, print final summary
start next step (spawn next agent)
update issue state
brief pause before next poll iteration
``` ```
**State transitions:** **State transitions:**
@@ -164,7 +166,7 @@ implementing → (worker done) → reviewing → (approved) → DONE
→ (worker failed) → FAILED → (worker failed) → FAILED
``` ```
**On each completion, print status:** **On each notification, print status:**
``` ```
[#42] Worker completed → PR #55 created, starting review [#42] Worker completed → PR #55 created, starting review