Repository navigation
feat: add self-contained broker-backed issue swarm flow - #664
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0fd496b707
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const reviews = await settleAll(lenses.map(async lens => { | ||
| const result = await f.agent(`review-${issue}-${round}-${lens}`, { | ||
| transport: 'broker', cli, cwd, skills: ['adversarial-review'], keepAlive: false, | ||
| permissions: { accessPreset: 'readonly' }, timeout: options.timeout ?? '30m', |
There was a problem hiding this comment.
Remove the unsupported broker permissions option
For every non-empty swarm, the first review fails before the reviewer starts because the broker path explicitly rejects any defined options.permissions in packages/sdk/src/authored-broker.ts. This call therefore throws agent_cli_unresolved, leaving the newly opened PR for human attention and preventing any lane from obtaining a GO verdict. Remove this option for broker reviewers or add broker support for it.
Useful? React with 👍 / 👎.
| if (!lane.agentName) throw new Error('Broker did not return implementer agentName'); | ||
| const prs = JSON.parse(await f.run(`gh pr list --repo ${shellWord(repo)} --state open --head ${shellWord(lane.branch)} --json number`)); | ||
| if (!Array.isArray(prs) || prs.length !== 1 || !Number.isSafeInteger(prs[0]?.number) || prs[0].number < 1) throw new Error(`Expected one open PR for ${lane.branch}`); | ||
| lane.pr = prs[0].number; |
There was a problem hiding this comment.
PR lookup drops owner and slash
High Severity
Every lane branch is issue-swarm…/issue-N, but the open-PR lookup passes that ref to gh pr list --head without the owner: prefix GitHub's list API requires. A slash ref does not match owner:ref, so the lookup returns no PR and the lane fails after the implementer has already opened one.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0fd496b. Configure here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Session-Id: 01a135d2-3108-7c01-88be-f3119fa7e51f Session-Id: 01a135d2-3108-7c01-88be-f3119fa7e51f Session-Id: 01a135d2-3108-7c01-88be-f3119fa7e51f Session-Id: 01a135d2-3108-7c01-88be-f3119fa7e51f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Session-Id: 01a135d2-3108-7c01-88be-f3119fa7e51f Session-Id: 01a135d2-3108-7c01-88be-f3119fa7e51f
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Session-Id: 01a135d2-3108-7c01-88be-f3119fa7e51f
1652e01 to
6cd6aaf
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6cd6aaf. Configure here.
| } | ||
|
|
||
| const now = async (f: Ctx): Promise<number> => { | ||
| const raw = (await f.run('node -p Date.now()', { timeout: '5s' })).trim(); |
There was a problem hiding this comment.
Journaled clock command is shell-invalid
High Severity
now runs node -p Date.now() through f.run, which executes under /bin/sh -c. Unquoted () is a shell syntax error, so the command never prints a timestamp. After implementers and reviewers finish, deadline setup throws a journal step failure instead of entering the monitor or completing with last-observed status. Tests compare the literal string and never execute it in a shell.
Reviewed by Cursor Bugbot for commit 6cd6aaf. Configure here.
Co-authored-by: Will Washburn <willwashburn@users.noreply.github.com>
The file dependency still named 2.0.50 after main's release commits landed through the broker branch. Co-authored-by: Will Washburn <willwashburn@users.noreply.github.com>
[Medium impact] The flow can create and update pull requests in the operator's selected repository. The PR should not merge until monitoring can start and parallel issue lanes can resume safely.
|
| } | ||
|
|
||
| const now = async (f: Ctx): Promise<number> => { | ||
| const raw = (await f.run('node -p Date.now()', { timeout: '5s' })).trim(); |
There was a problem hiding this comment.
now() runs node -p Date.now() without quoting the expression. /bin/sh rejects the parentheses before Node starts, so every run with matching issues fails when it starts monitoring—even when all PRs are ready. Use node -p 'Date.now()' and add a test that executes the generated command.
| const raw = (await f.run('node -p Date.now()', { timeout: '5s' })).trim(); | |
| const raw = (await f.run("node -p 'Date.now()'", { timeout: '5s' })).trim(); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: examples/issue-swarm/issue-swarm.flow.ts
Line: 257
Comment:
**Monitoring never starts**
`now()` runs `node -p Date.now()` without quoting the expression. `/bin/sh` rejects the parentheses before Node starts, so every run with matching issues fails when it starts monitoring—even when all PRs are ready. Use `node -p 'Date.now()'` and add a test that executes the generated command.
```suggestion
const raw = (await f.run("node -p 'Date.now()'", { timeout: '5s' })).trim();
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| await settleAll(lanes.map(async lane => { | ||
| await f.run(`git worktree add -b ${shellWord(lane.branch)} ${shellWord(lane.cwd)} ${shellWord(base)}`, { timeout: '2m' }); | ||
| const result = await f.agent(`implement-${lane.issue.number}`, { |
There was a problem hiding this comment.
Parallel lanes can break resume
Each parallel issue lane makes several journaled calls after separate awaits, but the SDK assigns step IDs from one shared counter. If issue 2 finishes first during the original run and issue 1 finishes first during resume, their next calls receive different IDs. The SDK then rejects the resumed run with an admission conflict or serial_replay_order_mismatch. Agent names do not provide stable step IDs.
Give each lane its own durable child flow, or otherwise keep journaled call order stable across resume.
Prompt To Fix With AI
This is a comment left during a code review.
Path: examples/issue-swarm/issue-swarm.flow.ts
Line: 312-314
Comment:
**Parallel lanes can break resume**
Each parallel issue lane makes several journaled calls after separate awaits, but the SDK assigns step IDs from one shared counter. If issue 2 finishes first during the original run and issue 1 finishes first during resume, their next calls receive different IDs. The SDK then rejects the resumed run with an admission conflict or `serial_replay_order_mismatch`. Agent names do not provide stable step IDs.
Give each lane its own durable child flow, or otherwise keep journaled call order stable across resume.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Co-authored-by: Will Washburn <willwashburn@users.noreply.github.com>
Co-authored-by: Will Washburn <willwashburn@users.noreply.github.com>


The self-contained
issue-swarmflow turns labeled GitHub issues into worktrees and persistent broker implementers, opens PRs, and runs three adversarial review lenses. Exact-head GO verdicts gate readiness; findings and monitored CI/conflict/review-thread repairs return to the owning implementer through bounded messages. Sessions release before worktree cleanup; dirty worktrees remain for human recovery. The flow never merges.Stacked on #663. Base:
feat/agent-broker-sessions. Onlyexamples/issue-swarm/changes in this PR. The source deploys as-is and stays readable in the online editor.The README documents inputs, prerequisites, manual deployment, review-round limits, monitor deadlines, and cleanup. All tests use fakes; no live broker, PTY, agent harness, or GitHub mutation was exercised.
The monitor waits for pending checks and unknown mergeability, sends actionable findings only, and refreshes after repairs. Recorded dirty-worktree refusal reports human attention; actual step failures propagate after cleanup. Empty issue bodies normalize to empty text.
Validation at head
6cd6aafb, stacked on broker030245f6(repository root unless noted):Exit 0.
Exit 0.
Test command (working directory
examples/issue-swarm):node --experimental-strip-types --test --test-reporter=spec tests/*.test.tsCaptured output (exit 0):
The branch lookup uses the documented
gh pr list --head <branch>syntax.<owner>:<branch>is unsupported by GitHub CLI. Read-only confirmation:🤖 Generated with Claude Code
Note
Low Risk
New example-only code under
examples/issue-swarm/with no core package changes; runtime risk is limited to operators who deploy the flow and grant broker agents push/PR-comment access.Overview
Adds a new
examples/issue-swarmexample: a self-contained@relayflows/surfaceflow that turns labeled open GitHub issues into parallel implementation lanes (git worktrees, broker implementers withpr-comments), opens PRs, and runs threeadversarial-reviewlenses per round.Review GO/NO-GO JSON must match the current head; NO-GO findings route back to the same implementer via
f.messagewhen review rounds remain. A bounded monitor polls PR state (paginated checks, mergeability, unresolved threads) and triggers repairs without merging. Outcomes usesuccessvsneeds_human; implementers are **f.release**d before non-forced worktree cleanup.The package includes README,
issue-swarm.flow.ts(input validation,capturePr/blockers, orchestration), and 27 fake-context tests (flow, GitHub helpers, deployable single-file source).Reviewed by Cursor Bugbot for commit 6cd6aaf. Bugbot is set up for automated code reviews on this repo. Configure here.
Agent Relay sessions
codexsession01a135d2· opened viagh pr create· last active 2026-10-13