shep

PR comment loop

Spec 124. Review comments on the pull request a feature opened are read, stored and addressed in rounds; shep replies on GitHub. User guide: docs/guides/pr-comments.md.

Model

tsp/domain/entities/pr-comment.tsp:

Tables pr_comments and pr_comment_rounds, two spaces columns (migration 156).

Pure rules in domain/shared/pr-comments.ts: #shep mention detection, isAutoAddressed, the reply marker (<!-- shep:pr-comment-reply -->) and isShepReply, reply text with the commit, the quote for conversation replies, the 30-minute round budget and abandonment.

GitHub

IPullRequestCommentService, implemented by GhPullRequestCommentService (infrastructure/services/git/), runs gh in the feature’s worktree with the space environment:

Call gh
list api --paginate repos/{owner}/{repo}/pulls/{n}/comments, .../issues/{n}/comments, .../pulls/{n}/reviews (--jq '.[]') plus GraphQL reviewThreads(first: 100) for thread ids and resolution
reply GraphQL addPullRequestReviewThreadReply (inline with a thread), REST pulls/{n}/comments/{id}/replies (inline without), REST issues/{n}/comments (others)
resolve GraphQL resolveReviewThread

Use cases (application/use-cases/pr-comments/)

Daemon

src/presentation/cli/commands/background-sync.ts starts the same background sync in _serve (shep start) and shep ui: retention, tracker sync, PrSyncWatcher (previously only in shep ui), and the PR comment watcher (IntervalTask, every two minutes, never overlapping).

Surfaces

Surface Entry point
CLI shep feat comments, shep feat address-comments, shep space config --pr-comments / --resolve-threads
Web Review comments section in the Merge Review tab (components/features/pr-comments/), actions in app/actions/pr-comments.ts; space agent settings form
DI infrastructure/di/modules/register-pr-comments.ts