Feature design: PR-comment-driven agent revisions (/agent revise) #173
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens#173
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Reviewers can post a comment on an agent-opened PR to send the PR back through the agentic flow with their feedback as additional context. Closes the loop between PR review and the next iteration without requiring a new issue or a manual re-trigger.
This issue is a design doc, not an implementation. Phasing at the bottom calls out an MVP slice that's useful on its own.
What the user does
/agent revise <feedback>— same slash-command idiom GitHub already conditions everyone to./agent retry verification,/agent rerun,/agent abort,/agent revert revision N— same dispatch path, different intent flag.@romaine-life-app revise: <feedback>for people who type mentions.Why slash command vs. label vs. any-comment: labels are per-PR (clutters the label space, hard to attach feedback text); any-comment fires on every benign drive-by remark; slash command is explicit and conventional.
Trigger / dispatch (glimmung-side)
New webhook subscription:
issue_comment(created) on PRs, pluspull_request_reviewfor review-comment-as-trigger.Glimmung handler:
/repos/{owner}/{repo}/collaborators/{login}/permission). Otherwise post a permission-denied reply and stop.romaine-life-app[bot](don't accidentally hijack human PRs)./agent reviseruns for this PR. Cap at 5 by default; configurable per-issue labelagent-max-revisions:N.lease_id,host,pr_number,pr_head_sha,issue_number,comment_id,comment_body,comment_author,revision_index,mode: revise.Workflow architecture (revise vs from-scratch)
Two real options:
issue-agent-revise.yaml. Clean separation, originalissue-agent.yamlstays simple, but prompt logic duplicates across files.issue-agent.yamlwithmode: initial|reviseinput. One entry point, branches on mode. Recommended: phases stay co-located, easier to keep prompts in sync.Recommend B with a
modeinput and per-phase mode-aware behavior. The phases are doing fundamentally the same job (plan, implement, verify) — just with different priors.New phase: Triage (revise mode only)
Before re-doing any of the three real phases, a small ~30s phase classifies the comment.
Reads: the issue, the PR diff, the comment body, prior verification artifacts.
Writes
issue-agent-triage.json:Wrapper reads this and skips the phases that aren't required. So a "tighten this assertion" comment doesn't have to redo implementation; a "you missed this case" comment skips to plan-delta.
If
intent: reject_feedback, the agent posts a reply explaining why (e.g. "the comment asks for behavior outside the original issue's scope; please file a new issue") and stops without modifying anything.Phase deltas (vs from-scratch)
Each existing phase grows a "revise" branch:
issue-agent-test-plan.json, modifies only what triage says is impacted (typically: add an evidence item, tighten anexpected_text). Most revisions don't need this phase at all.A revise run that modifies implementation produces ONE additional commit on the existing PR branch. Reviewer sees the diff incrementally.
Wrapper additions
<!-- romaine-life-app:revise-reply -->) so the webhook handler can ignore them.Cross-cutting
-revNso historical runs don't collide. Original issue gets cross-posted: "Revision N applied to PR #170, status: pass" — only on revisions that materially change the PR (suppress forclarify/reject_feedback)./agent revert revision Nresets the PR branch to the commit just before revision N and force-pushes (with a reply explaining what was undone). Branch protection on main means this only affects the agent's own branch.Risks
Implementation-delta vs from-scratch-overwrite. If the agent re-implements from scratch on revise it might delete other reviewer-friendly aspects of the existing diff. Forcing it to read the existing PR and produce a patch on top is harder for the LLM than "do the issue from scratch" — needs deliberate prompt design and possibly a wrapper-side check that the new commit is genuinely additive (file-line overlap with the existing commit) rather than a wholesale rewrite.
Webhook race conditions. Two reviewers comment within seconds; both pass the cooldown check before either lease is allocated. Glimmung needs to serialize lease allocation per-PR, not just per-host.
Slash-command spoofing. A non-collaborator could post
/agent revisein a fork-PR comment. The author-permission check covers this, but the failure mode (denied reply) needs to be polite and not noisy.Phasing / effort estimate
The MVP is useful on its own — most "tighten this assertion" / "you missed case X" feedback is well-handled by a from-scratch re-run on the existing branch. The polish layers (triage, delta-mode, budget caps) earn their cost only when revisions become routine.
Decisions to make before starting
/agent reviseor use/romaine reviseto match the App name?run-issue-agent-phases.ps1or split out).pull_request_reviewevents or onlyissue_comment.Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.