Skip to content

Address PR Comments (#4) - #8

Draft
ableinc wants to merge 1 commit into
mainfrom
agent/issue-4-address-pr-comments
Draft

Address PR Comments (#4)#8
ableinc wants to merge 1 commit into
mainfrom
agent/issue-4-address-pr-comments

Conversation

@ableinc

@ableinc ableinc commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Closes #4

What the agent did

Clean working tree, all tests pass. The work is committed on agent/issue-4-address-pr-comments.

Summary

Implemented issue #4 following the approved plan: the daemon now watches its own open pull requests for @coding-agent mentions and acts on them.

Config (internal/config/config.go, config.example.json): new github.pr_comments block (mention handle, reactions, allowed authors/associations, search limit, max age), validated and defaulted so an old config without the block still loads.

GitHub client (internal/gh/gh.go): CurrentLogin, SearchPRs, ViewPR (extended PullRequest), PRComments (merges issue + review comments), PRReviewBodies, React, CommentOnPR.

Store (internal/store/store.go): migration 5 adds runs.kind and a pr_comment_tasks table tracking each triggering comment through acked → done/failed with its own attempt-based back-off; IssueHistory now excludes PR-comment runs so they never affect an issue's retry schedule.

Orchestrator (internal/orchestrator/prcomments.go, new): mentionsAgent (word-boundary, quote- and fence-aware matching), pendingMentions (author/age/dedup filtering, including recovery of comments stranded "acked" by a crash), tickPRComments/workPRComments/executePRComments/handlePRCommentFailure mirroring the issue lifecycle — ack immediately, checkout the PR's own branch, run Claude, push+verify only if there's a code change, reply and react done, or fail with the ack left in place and a per-comment back-off. Wired into tick() ahead of issue discovery, sharing the same capacity budget. Added markerPRComment, PR-comment prompt builders, and reply/failure comment builders.

Discord: PRCommentsAddressed notification.

Tests: new prcomments_test.go, report_test.go, plus additions to gh_test.go, store_test.go, config_test.go, prompt_test.go covering the mention matcher, pending-comment filtering, migration idempotency, task lifecycle, React/SearchPRs/PRComments argv, and config validation/back-compat.

README: new "Responding to PR comments" section, config table rows, safety-boundary bullets, and a kind note on /runs.

One deliberate deviation from the plan's literal wording: the plan says pending-comment filtering applies to "unseen or a failed task whose back-off has elapsed," but I also treat a stranded acked task (crash between the 👀 and the run) as retryable — otherwise the crash-recovery scenario the plan's own verification steps call for would never happen, since an acked comment would match neither "unseen" nor "failed." This is covered by TestPendingMentionsRetriesStrandedAck.

All packages build, vet, and pass go test ./... (the sandbox's ThreadSanitizer doesn't support this ARM64 kernel's VMA layout, so -race couldn't be run — unrelated to this change).

Verification

Tests failed (make test). This PR is a draft — the failure is reported rather than hidden, so you can judge whether the change is salvageable.

Test output (tail)
go test -race ./...
make: go: No such file or directory
make: *** [Makefile:99: test] Error 127

Changes

README.md                                |  80 +++-
 config.example.json                      |  12 +-
 internal/config/config.go                |  60 +++
 internal/config/config_test.go           |  46 +++
 internal/discord/notifier.go             |  22 ++
 internal/gh/gh.go                        | 215 ++++++++++-
 internal/gh/gh_test.go                   |  95 +++++
 internal/orchestrator/loop.go            |  10 +
 internal/orchestrator/phase.go           |   7 +-
 internal/orchestrator/prcomments.go      | 609 +++++++++++++++++++++++++++++++
 internal/orchestrator/prcomments_test.go | 146 ++++++++
 internal/orchestrator/prompt.go          |  92 +++++
 internal/orchestrator/prompt_test.go     |  36 ++
 internal/orchestrator/report.go          |  62 ++++
 internal/orchestrator/report_test.go     |  60 +++
 internal/store/store.go                  | 180 +++++++--
 internal/store/store_test.go             | 119 ++++++
 17 files changed, 1814 insertions(+), 37 deletions(-)

Opened automatically by coding-agent-loop (run 8ff203c4-9aad-4aca-a119-6c1154030178, attempt 2, model claude-sonnet-5, cost $5.2008, session 329f7864-c052-48e1-8fd9-1416a8febc04). Nothing here has been reviewed by a human yet.

…ction, address them, confirm

Watches the daemon's own open pull requests for @coding-agent mentions in
conversation and review comments, reacts with 👀 on pickup, addresses the
feedback on the PR's own branch (or answers in prose when it's a question),
pushes and verifies if there's a code change, and reacts with 👍 once done.

Only ever acts on PRs it opened itself, on a workspace.branch_prefix branch,
and only for commenters with OWNER/MEMBER/COLLABORATOR association or an
explicit allowlist. Adds github.pr_comments config, a runs.kind column and
pr_comment_tasks table (SQLite migration 5) to track each comment through
ack -> done/failed with its own retry back-off, and reuses the existing
claim/lease machinery since GitHub numbers PRs in the same sequence as issues.
@ableinc ableinc mentioned this pull request Aug 22, 2026
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.

Address PR Comments

1 participant