fix(orchestrator): detect '# Plan' heading to prevent duplicate in PR body#9
Open
Maxtanh-Meta wants to merge 11 commits into
Open
fix(orchestrator): detect '# Plan' heading to prevent duplicate in PR body#9Maxtanh-Meta wants to merge 11 commits into
Maxtanh-Meta wants to merge 11 commits into
Conversation
Previously, the reviewer only posted a comment on rejection. This makes the approval path equally visible — operators and issue authors can see why the reviewer approved and that the gate was evaluated, without needing to check orchestrator logs.
After a PR is created, run the configured reviewer agent on the actual code diff (not just the plan). The reviewer evaluates the implementation for bugs, style issues, missing error handling, test coverage gaps, and security concerns, then posts its findings as a comment on the PR. This is a best-effort step — if the reviewer fails or is not configured, the PR is still created and labeled normally. The code review is informational and does not block the PR. The reviewer reuses the existing reviewer infrastructure (same provider, same timeout config) but with a code-review-specific prompt that includes the full diff against the base branch.
buildPRBody unconditionally prepended '## Plan' before job.PlanText, but the planning agent often includes its own '## Plan' heading in the markdown output. This resulted in duplicate headings in PR descriptions. Now checks if PlanText already starts with '## Plan' before adding one.
Without this fetch, when multiple jobs run sequentially and earlier PRs get merged between runs, origin/<base> becomes stale. The three-dot diff (origin/main...HEAD) then includes commits from previously-merged PRs, causing the reviewer to flag unrelated changes. Observed on XF-APAC/one-minute-games PR #50: the code review saw README changes from PR #49 (issue #38) because origin/main hadn't been updated since that PR was merged.
… 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
fix(orchestrator): deduplicate '## Plan' heading in PR body
feat: add post-PR code review using the reviewer agent
feat: post issue comment when reviewer approves a plan
feat(orchestrator): add single-cycle PR revision on CHANGES_REQUESTED review
Author
Code Review (via Codex)Overall: Approve with suggestions Real Issue
word := strings.TrimSpace(stripped)
return strings.EqualFold(word, "Plan") || strings.HasPrefix(strings.ToLower(word), "plan\n") || strings.HasPrefix(strings.ToLower(word), "plan ")
Suggested simplification: lower := strings.ToLower(word)
return lower == "plan" || strings.HasPrefix(lower, "plan ")This correctly handles Minor Notes
VerdictThe fix is correct and the test coverage is good. The dead branch in |
… body The agent sometimes outputs '# Plan' (H1) instead of '## Plan' (H2). The previous fix (PR logosc#3) only checked for '## Plan' prefix, so an H1 heading still caused buildPRBody to prepend its own '## Plan', resulting in duplicate headings like: ## Plan # Plan ## Issue Context... Replace the simple HasPrefix check with a hasPlanHeading() helper that detects plan headings at any markdown level (#, ##, ###, etc.). Fixes: https://github.com/XF-APAC/one-minute-games/pull/54
7533440 to
43e5270
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the duplicate plan heading bug seen in XF-APAC/one-minute-games#54.
The agent sometimes outputs
# Plan(H1) instead of## Plan(H2). The previous fix (PR #3, commit 647d3fb) only checked for the## Planprefix, so an H1 heading still causedbuildPRBodyto prepend its own## Plan, producing:Fix
Replace the simple
strings.HasPrefix(planText, "## Plan")check with ahasPlanHeading()helper that detects plan headings at any markdown level (#,##,###, etc.). The helper:#+ characters followed by a spacePlan(case-insensitive)Test
Added a test case for the
# Plan(H1) variant to the existingTestBuildPRBodyNoDuplicatePlanHeadingtest.