Skip to content

feat(orchestrator): add single-cycle PR revision on CHANGES_REQUESTED review#8

Open
Maxtanh-Meta wants to merge 1 commit into
logosc:mainfrom
Maxtanh-Meta:feat/pr-revision-flow
Open

feat(orchestrator): add single-cycle PR revision on CHANGES_REQUESTED review#8
Maxtanh-Meta wants to merge 1 commit into
logosc:mainfrom
Maxtanh-Meta:feat/pr-revision-flow

Conversation

@Maxtanh-Meta

Copy link
Copy Markdown

Summary

When a human submits a CHANGES_REQUESTED review on a symphony-go PR, the orchestrator now detects it via polling and runs a single revision cycle on the existing branch — updating the PR in place instead of closing and reopening.

How it works

  1. PollPRRevisions (new tick step after PollApprovals) scans pr_ready jobs for fresh CHANGES_REQUESTED reviews submitted after job.UpdatedAt
  2. runPRRevision drives the implementation agent with a revision prompt containing the original issue, approved plan, and reviewer feedback
  3. The agent's changes are committed and pushed to the same branch (no new PR)
  4. Job.RevisionAttempted = true — only one revision cycle runs per PR; subsequent reviews are left for human follow-up

Design decisions

  • Single cycle only: Avoids infinite revision loops. After one revision attempt, the job stays terminal (pr_ready)
  • Reuses existing infrastructure: Same worktree, same branch, same implementation agent runner
  • Non-destructive: Labels unchanged, PR stays open, no close/reopen
  • Staleness guard: Reviews submitted before job.UpdatedAt are ignored (prevents acting on old feedback)
  • Self-bot filter: Reviews from ignored users (bot accounts) are skipped via isIgnoredApprovalUser

Changes

  • internal/github/github.go — Add PRReview type + ListPRReviews to Client interface
  • internal/github/fake.go — Add SeedPRReview + ListPRReviews to InMemoryFake
  • internal/types/types.go — Add RevisionAttempted field to Job
  • internal/orchestrator/loop.go — Call PollPRRevisions in tick
  • internal/orchestrator/revision.go (new) — Polling + execution logic
  • internal/orchestrator/revision_test.go (new) — 3 test cases

Tests

All 3 new tests pass:

  • TestPollPRRevisions_HappyPath — full revision cycle commits + pushes
  • TestPollPRRevisions_RevisionAttemptedSkips — second revision blocked
  • TestPollPRRevisions_StaleReviewIgnored — old reviews ignored

… review

When a human submits a CHANGES_REQUESTED review on a symphony-go PR,
the orchestrator now detects it via polling and runs a single revision
cycle on the existing branch/worktree:

1. PollPRRevisions (new tick step) scans pr_ready jobs for fresh
   CHANGES_REQUESTED reviews submitted after the job's UpdatedAt.
2. runPRRevision drives the implementation agent with a revision prompt
   containing the original issue, approved plan, and review feedback.
3. The agent's changes are committed and pushed to the same branch,
   updating the PR in place (no close/reopen cycle).
4. Job.RevisionAttempted is set to true — only one revision cycle runs
   per PR, subsequent reviews are left for human follow-up.

Changes:
- internal/github: add PRReview type, ListPRReviews to Client interface
- internal/github/fake: add SeedPRReview + ListPRReviews
- internal/types: add RevisionAttempted field to Job
- internal/orchestrator/loop: call PollPRRevisions in tick
- internal/orchestrator/revision.go (new): polling + execution logic
- internal/orchestrator/revision_test.go (new): 3 test cases
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