Skip to content

Add AI review workflow - #1998

Open
svarlamov wants to merge 1 commit into
mainfrom
agent/ai-review-command
Open

Add AI review workflow#1998
svarlamov wants to merge 1 commit into
mainfrom
agent/ai-review-command

Conversation

@svarlamov

@svarlamov svarlamov commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • add ./ai review <pr-number> [additional-prompt] on top of the existing PR worktree checkout flow
  • invoke the selected harness with /review PR#<number> while preserving an optional prompt verbatim
  • add --heavy [N] for tiled tmux review sessions with N Codex and N Claude agents; bare --heavy defaults to two of each and N is limited to 1-3
  • add focused unit coverage for parsing, prompts, shared checkout dispatch, harness arguments, tmux pane counts, and whitespace preservation

Validation

  • python3 -m unittest discover -s tests -p "test_*.py"
  • task fmt
  • task lint
  • task test
  • live detached tmux smoke test confirming four panes start in the target worktree

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@svarlamov
svarlamov marked this pull request as ready for review July 28, 2026 13:33

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread scripts/ai
Comment on lines +312 to +323
for harness in harnesses[1:]:
command = build_harness_command(harness, prompt=prompt)
run([
"tmux",
"split-window",
"-d",
"-c",
worktree_dir,
shlex.join(command),
])

run(["tmux", "select-layout", "tiled"])

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.

🟡 Requesting the maximum number of review agents can abort with a pane error

New review panes are all carved out of the same starting pane (tmux split-window -d at scripts/ai:314-321) before the tiled layout is applied, so each split halves that one pane and a large request can fail with a "no space for new pane" error that crashes the command.

Impact: Running the heavy review with the highest allowed agent count can abort partway on normally-sized terminals, leaving a half-built set of panes instead of the requested reviewers.

Why repeatedly splitting one pane runs out of space

Because each tmux split-window uses -d, the active pane never changes, so every split targets the original pane 0. With reviewer_count=3 there are 6 agents and 5 sequential splits of pane 0, halving its height each time. On a typical ~50-line terminal this reaches a sub-1-line pane and tmux returns a non-zero exit, which run(...) (scripts/ai:314, check=True via scripts/ai:18) turns into an uncaught CalledProcessError. select-layout tiled is only invoked once after the loop (scripts/ai:323), so it cannot relieve the pressure during splitting. Re-tiling inside the loop (or splitting the smallest/last pane) would avoid the failure.

Prompt for agents
In open_heavy_review (scripts/ai), the loop creates every extra pane with `tmux split-window -d`, which always targets the still-active original pane. Because the active pane never changes, all splits repeatedly halve pane 0, and for the maximum allowed reviewer_count (3 -> 6 panes -> 5 splits) the pane becomes too small and tmux exits non-zero, raising an uncaught CalledProcessError. Consider re-running `tmux select-layout tiled` inside the loop after each split so panes are redistributed evenly before the next split, ensuring enough room for all requested panes regardless of count.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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