Skip to content

feat(pst:ready): v2 tournament repair protocol -- 3 parallel strategies, Opus judge#70

Merged
pstaylor-patrick merged 2 commits into
mainfrom
worktree-agent-ae7649b79db79431c
Jun 21, 2026
Merged

feat(pst:ready): v2 tournament repair protocol -- 3 parallel strategies, Opus judge#70
pstaylor-patrick merged 2 commits into
mainfrom
worktree-agent-ae7649b79db79431c

Conversation

@pstaylor-patrick

Copy link
Copy Markdown
Owner

Summary

  • Redesigns pst:ready to add a best-of-N tournament at the repair phase
  • Three parallel foreground Sonnet agents (Conservative / Structural / Review-first) each attempt PR repair in isolated PR-repo sub-worktrees
  • Foreground Opus judge scores on commit-graph cleanliness, CI attempts consumed, and open review threads; winner cherry-picked back onto working branch
  • Preserves all existing phases (workspace setup, settling loop, PR refresh, test-plan validation, open/summarize, dispatcher)

Tournament protocol details

  • Phase T setup: creates 3 git worktree add sub-worktrees of the PR repo (not the skills repo) before spawning agents
  • Agents: foreground (not background), same-turn so synchronization is implicit
  • No-push constraint: each strategy is explicitly forbidden from pushing to remote; the orchestrator handles the single push after cherry-picking the winner
  • Result block: HEAD_SHA, CI_ATTEMPTS, OPEN_THREADS, DIFF_STAT, and capped diff (500 lines) so the judge has real data for all three scoring axes
  • Cherry-pick fallback: git cherry-pick --abort + git reset --hard $WINNER_SHA (not git apply, which fails for the same reason cherry-pick does)
  • Resume checkpointing: each strategy result appended to progress file as it completes; resume re-spawns only missing strategies

Adversarial review

Two rounds:

  • Round 1 (initial v2): 7 findings -- shared $WORK_DIR, strategies pushing to remote, wrong git apply fallback, unbounded diff, Opus judge background contradiction, judge missing CI/thread data, no tournament checkpoint
  • All 7 resolved in commit 8d5f90d

Test plan

  • /pst:ready <PR-URL> on a PR with failing CI: tournament gate appears, 3 sub-worktrees created, agents run in parallel
  • All 3 strategies blocked: skill halts with reason report, no push
  • Single agent succeeds: judge step skipped, winner cherry-picked directly
  • Cherry-pick conflict: falls back to git reset --hard $WINNER_SHA
  • --dry-run: skips gate, logs "would run tournament N=3"
  • --no-settle: settling loop skipped after cherry-pick

🤖 Generated with Claude Code

https://claude.ai/code/session_019BCr5Qxi8jXnG2Rr7zdkw1

pstaylor-patrick and others added 2 commits June 21, 2026 06:40
Add best-of-N tournament to the repair phase. Three parallel foreground
Sonnet agents (Conservative/Structural/Review-first) each attempt to
bring the PR to ready-state in isolated sub-worktrees. Background Opus
judge scores on commit-graph cleanliness, CI attempts, and review
residuals. Winner's commits cherry-picked onto working branch before
final push.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Opus judge is foreground (background+await was contradictory)
- Tournament agents get isolated PR-repo sub-worktrees; isolation:worktree
  removed from Agent calls (was isolating skills repo, not PR repo)
- Agents explicitly forbidden from pushing; local-only constraint stated
- Result block extended: CI_ATTEMPTS, OPEN_THREADS, capped diff (500 lines),
  diff-stat for judge commit-graph scoring
- Cherry-pick fallback replaced: git cherry-pick --abort + git reset --hard
  (git apply fails for identical reason cherry-pick fails)
- Tournament results checkpointed per-strategy so resume skips completed agents

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pstaylor-patrick pstaylor-patrick merged commit 7873fc0 into main Jun 21, 2026
1 check passed
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