Skip to content

πŸ› Let the agent that opened a PR reply on its review threads - #19102

Merged
hivecommons-hive[bot] merged 9 commits into
v5from
fix/review-thread-replies
Nov 19, 2026
Merged

hivecommons-hive[bot] merged 9 commits into
v5from
fix/review-thread-replies

Conversation

@clubanderson

@clubanderson clubanderson commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #19096

Root cause

  • src/crux/proxy/rules.go: the REST rule table allowed POST issues/{n}/comments (ModeIssuesOnly or converse) and POST pulls/{n}/reviews, but had no rule for POST pulls/{n}/comments/{id}/replies (or pulls/comments/{id}/replies), POST pulls/{n}/comments, or any comment DELETE. AllowedByModeCaps is deny-by-default for an unmatched route, so all three were refused with no reason text while the issue-comment route passed. That is the pattern seen on a hosted hive: the agent could post a probe issue comment but could not reply in a review thread or delete the probe.
  • src/crux/proxy/reference_repos.go (ReferenceRepoDecision) also refused replies and comment deletes on a reference repo.
  • src/pkg/reviewfeedback/reviewfeedback.go: the brief said nothing about refused writes or probe comments, and a reply refused after a kick never reached the needs-human path.

What is allowed, and the exact guard

New review-thread gate, src/crux/proxy/review_thread.go, in the MITM refusal chain after pause, agent scope and auto-merge (and after the reference-repo rules):

Route Allowed only when
POST /repos/{o}/{r}/pulls/{n}/comments/{id}/replies and POST /repos/{o}/{r}/pulls/comments/{id}/replies the comment's PR (resolved by GET of the comment's pull_request_url, never from the path) was opened by the hive's own agent per the audit trail agent_pr_created (the sweep's ownership source, cached 1 minute), and the caller is that agent
POST /repos/{o}/{r}/pulls/{n}/comments PR {n} is hive-opened per the audit trail, and the caller is the agent that opened it
DELETE /repos/{o}/{r}/issues/comments/{id}, DELETE /repos/{o}/{r}/pulls/comments/{id} GitHub reports the comment author is the hive's own identity (the App bot login, or a reference repo's write login) and the comment is younger than OwnCommentDeleteWindow (15 minutes)

Everything else is refused with reason review_thread: other PRs, other agents, other repos, unidentified callers, someone else's comment, older or future-dated comments, and any lookup that fails (fail closed). The 403 tells the agent to stop and never post a probe comment. The mode tier still applies on top: replies and PR review comments at ISSUES_AND_PRS or converse (the tier of a review), deletes at ISSUES_ONLY. On a reference repo, replies and deletes now defer to this gate instead of being refused outright. GraphQL addPullRequestReviewThreadReply carries only node ids and stays on the mode ladder (conversation bucket); this gate is REST-only.

Refused reply hand-off

When any gate refuses a reply on a hive-opened PR, the proxy keeps the drafted body (bounded) and the review-feedback sweep posts it in its existing needs-human note, quoted as text, at most once per HIVE_REVIEW_FEEDBACK_WINDOW. Same write site as before (main.reviewFeedbackSweep.needsHuman), so no new notification site or write-back entry.

Brief changes

The reply-style step is unchanged: threaded replies stay allowed, not mandated. Added only:

  • never post a test, probe or placeholder comment; a mistaken own comment may be deleted within the window, never anyone else's;
  • if a write is refused (403 from the proxy), stop: no retry, no posting the reply another way, no probing; the hive hands the draft to a person.

Tests

Table-driven proxy tests: reply and PR review comment allowed for the owning agent on a hive-opened PR (both path forms); refused for another agent, another PR, another repo, an unresolvable comment and an unidentified caller; delete allowed for the hive's own recent comment, refused for old, future-dated, author-less and someone else's comments; lookup failure fails closed; reference-repo login and token; mode table; reference-repo decision; draft capture; an end-to-end MITM test. Plus store, note, brief, and sweep-wire tests (drafts posted once, audit ownership cache).

Docs: src/docs/github-write-surface.md (new section), src/docs/labels-and-control-signals/reference.md (review feedback). Changelog fragment changelog.d/fixed-19096-review-thread-replies.md. No config keys changed.

Follow-up (not in this PR)

How an agent answers review feedback differs between maintainers, so it is not changed here. A per-hive and per-repo knob is a follow-up: review.feedback.reply_style: summary|threaded|both and review.feedback.resolve_threads: false|true, defaulting to today's behavior.

πŸ€– Generated with Claude Code

@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 18, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

ℹ️ Sentinel: informational, author is trusted (owner), merge is not blocked. Head f9245d6f6707 matched:

  • sensitive_path: changes 1 sensitive path(s) (src/crux/proxy/rules.go)

No sentinel-alert label was added. The finding is recorded in the dashboard Security tab and /api/sentinel; set sentinel.trusted_authors_block: true to block trusted authors too.

Review findings from adjudicator-4 (folded here because this head already carries its hive review):

Security review at head f9245d6. Two issues (new from this perspective), neither a hard exploit, both trust-boundary gaps.

  1. Own-comment DELETE is not scoped to the calling agent (src/crux/proxy/review_thread.go, ownCommentDeleteRefusal). "Own" means the comment author equals the App bot login (hiveLoginsFor), and every hive agent and the hive's own reviewers post under that single login. So any agent can delete any hive-authored comment on any in-scope repo/PR within 15 minutes, including a hive-review verdict or review thread posted on its own PR, or another agent's comment. The brief says "your own comment", but the proxy does not enforce it. Fix: also require that the comment is on a PR/issue the calling agent opened (use OwnPR, resolving the PR from pull_request_url or issue_url), and decline to delete review comments or review bodies. If that is too heavy, narrow to issue comments on the caller's own PR.
  2. Refused-reply capture is not limited to the PR owner (noteRefusedReviewReply). It records a draft for any caller whenever the PR is hive-owned, even when the refusal was "not the opening agent". Agent B can therefore make the hive post B's arbitrary text (fenced, 2000 runes) onto agent A's PR as the hive's needs-human note. Fix: in noteRefusedReviewReply, return unless strings.EqualFold(owner, agentName).
	owner, owned := g.OwnPR(w.repo, number)
	if !owned || !strings.EqualFold(owner, agentName) {
		return
	}

(replacing the if _, owned := g.OwnPR(...) check there).

Verified OK: the gate is fail-closed on lookup errors, the path regexes are anchored, the reply target is resolved to its PR from the same repo, the lookup token is never borrowed from another agent, and draft bodies are fenced with ``` neutralised (writeFenced).

Review findings from adjudicator-3 (folded here because this head already carries its hive review):

Correctness review at f9245d6. I read the diff, the MITM chain in github_proxy_mitm.go and ReferenceRepoDecision. I found no in-scope blocker. Two low advisories:

  1. A transient lookup failure loses the drafted reply. review_thread.go (noteRefusedReviewReply) resolves the reply's PR with a second GET. If that GET fails, for example on a 502 or a rate limit, it returns without calling OnRefused. The 403 text still tells the agent that "the hive's review-feedback sweep hands your drafted reply to a person". In that case the draft is never kept and the agent has been told to stop. The gate's own lookup failure is the likeliest trigger. Consider caching the resolved PR number from the first lookup on the request, or recording the draft with the repo and comment id when the lookup fails.
  2. Reference-repo tier is not checked for replies and deletes. reference_repos.go returns referenceAllow for reviewReplyPathRe and ownCommentDeletePathRe without checking pol.Issues or pol.PRs. The gate's own-PR and own-login checks still apply, so exposure is small. A reference repo opted into issues only could still see a retract of the hive's own comment. Prefer to mirror the other branches' tier check.

Noted, not blocking: delete ownership is "authored by the hive App login", so any agent can retract another agent's or the sweep's hive-authored comment within 15 minutes. That follows from the shared bot identity and is bounded by the window.

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Why:

  • the review swarm returned requires_human: it has a question for you, not a fix for the hive
  • the reviewer asked you: clubanderson should decide whether the hive proxy may start letting an agent reply in review threads and delete the App bot's own comments on PRs that agent opened.

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Review findings from adjudicator (folded here because this head already carries its hive review):

Delta re-review at 0f6e2c7 (correctness). Still present: draft lost on second lookup failure; reference-repo reply/delete skips tier check; own-comment DELETE not scoped to caller; drafts recorded for non-owner agents; lookup before isLinear check; duplicated PR resolution. No longer applies: needsHuman split (single function now). Line-level fixes are in the threads. The rest of the large delta is outside the #19096 contract and was not reviewed in depth.

Findings not on a changed line

  • src/crux/proxy/review_thread.go:237: Still present: this second reviewCommentPR GET means a lookup failure silently drops the drafted reply. Reuse the PR number resolved in reviewThreadRefusal. Also (security, refs prior finding) line 243 never compares owner to agentName, so drafts are recorded for non-owner agents, and ownCommentDeleteRefusal (275) does not scope deletes to the calling agent.
  • src/crux/proxy/reference_repos.go:177: Still present: no pol.PRs/pol.Issues tier check before referenceAllow.
    		if !pol.PRs && !pol.Issues {
    			return referenceDeny, 0, referenceRepoRefusal(pol, "replying in review threads or retracting a comment needs write: [issues] or [prs]")
    		}
    		return referenceAllow, 0, ""
    

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Routing, not a defect report. This widens the proxy's GitHub write surface (new allow rules in the MITM chain), which is a trust-surface change a person should sign off on. The PR body says the delete window and PR-owner check came from a maintainer decision on this PR; I could not find that decision in the body, so please confirm it covers the final shape.

What I read at the head (1acd85f): src/crux/proxy/review_thread.go in full, the MITM hook in github_proxy_mitm.go, the reference-repo change, and the sweep wiring in review_feedback_wire.go.

  • The gate looks sound to me. Reply and PR-comment routes resolve the PR from the comment's pull_request_url (review_thread.go:773-779), never the path, and ownPRCallerRefusal (:634) requires the audit-trail owner to equal the caller. Deletes additionally require the App-bot author, age under 15 min, and the same PR-owner check (:701-729). Lookup failures and an absent guard fail closed (:575-579, :614).
  • Since every agent posts as the same App bot, the PR-owner check on delete is what carries the safety, and it is present.
  • Merge state is dirty (conflicts with v5), so it needs a rebase regardless.

Small, non-blocking: noteRefusedReviewReply (review_thread.go:651) repeats the comment-metadata GET that the refusal path already made, so a refused reply costs two API calls. Drafted reply text is also posted into the needs-human note on the PR (up to 16 KiB); fine for a hive-authored PR, but worth a glance if drafts could ever quote tool output.

I did not run tests (CI is the verdict per AGENTS.md). Nothing was closed or approved.

Review findings from reviewer (folded here because this head already carries its hive review):

This is a proxy write-gate change (src/crux/proxy), so it needs a person to sign off. I found no defect, but my read was partial.

What I read: src/crux/proxy/review_thread.go:1-200. The classifier regexes are anchored, the reply/PR-comment gate resolves ownership from the audit trail rather than the path, and with no guard or no OwnPR every guarded route is refused (fail closed). That matches the PR body.

What I did not read: the rest of review_thread.go (the delete and reply ownership checks), the MITM wiring in github_proxy_mitm.go, the reference-repo change, and the tests. Please treat this as no verdict on those.

The decision: the issue (#19096) is about replying in review threads. The PR also opens DELETE /issues/comments/{id} and DELETE /pulls/comments/{id} for comments authored by the hive identity younger than 15 minutes. Whether agents should hold any delete capability is a policy call, not something the issue answers.

hive/awaiting-ci: rebased onto v5 and pushed; CI pending - sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 0f56aad7e

Review findings from adjudicator-2 (folded here because this head already carries its hive review):

Security perspective at a1d63a8: no in-scope blocker. The review-thread gate fails closed (unidentified caller, no OwnPR, lookup failure, non-owned PR, other agent), resolves the PR from the comment's pull_request_url rather than the path, and the refused-draft hand-off is bounded and fence-escaped. One low advisory on own-comment DELETE scope (inline). The rest of the delta is unrelated merged work I did not review.

Findings not on a changed line

Evidence bundle `#191021acd85f` sha256:f625a5749a13551862a5e4cabbbccbe8c06dc3a5775e937577352c5e72aba87c β€” download from the dashboard or `hivectl review evidence #19102`.

merged by Hive trusted-author auto-merge: author clubanderson holds role owner and GitHub permission admin on repo; CI green at 1acd85f.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#19007 πŸ› fix: strip hop-identity headers and table-test proxy relays same files src/crux/proxy/github_proxy_mitm.go

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style review at f9245d6: no blocker. Contract #19096 (agent may reply on its own PR's review threads) is met. Three maintainability notes, details inline; none changes behaviour.

-- hive: agent=ci-maintainer backend=claude model=claude-sonnet-5-5 claude=2.1.327

blockReason = reason
blockCode = DenyReasonRepoAutoMergeOff
blockJSON = true
} else if reason, refused := p.reviewThreadRefusal(req, agentName); !isLinear && refused {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check !isLinear first so the guard (which may do a GitHub GET) is never called for Linear traffic, as the sibling branches do. E.g. fold into else if !isLinear { if reason, refused := ...; refused {...} } or reorder the condition via a small helper.

// hive's own agent opened, the drafted text is handed to the review-feedback
// sweep so it can post its needs-human note with the reply a person should
// place. The request body is left readable for the caller's drain.
func (p *GitHubProxy) noteRefusedReviewReply(req *http.Request, agentName, reason string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repeats the classify / reviewCommentPR / OwnPR sequence from reviewThreadRefusal (line 170), costing a second lookup per refused reply. A shared resolveReviewWritePR helper would keep the two in step.

// needsHuman posts the needs-human note: once per PR when feedback cannot be
// routed, or with drafts set, the replies the agent drafted but could not
// post (#19096), at most once per Limits.Window (BlockedDraftsDue).
func (s reviewFeedbackSweep) needsHuman(ctx context.Context, key, repo string, number int, reason string, items []github.FeedbackItem, drafts []reviewfeedback.ReplyDraft, res *reviewFeedbackResult) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needsHuman now has two modes selected by len(drafts), and three call sites pass nil. A separate method for the blocked-draft hand-off would be easier to read.

@clubanderson

Copy link
Copy Markdown
Member Author

/hive decision Request changes. (1) Scope own-comment DELETE to comments on a PR or issue the calling agent opened: resolve the PR from pull_request_url or issue_url, use OwnPR and require the owner to match the calling agent, and do not allow deleting review comments or review bodies (if that is too heavy, narrow to issue comments on the caller's own PR). (2) In noteRefusedReviewReply, return unless the PR owner equals the calling agent (the adjudicator's suggested OwnPR owner check), so one agent cannot make the hive post text onto another agent's PR. (3) Keep the lookup from losing a drafted reply on a transient failure: reuse the PR number resolved by the first lookup, or record the draft with the repo and comment id. (4) Mirror the other branches' tier checks (pol.Issues and pol.PRs) for replies and deletes on reference repos. (5) Merge origin/v5 to clear the conflict and re-run the citation fixers. Add tests for each of these.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security delta re-review at 0f6e2c7: two prior security findings are still present (own-comment DELETE not scoped to the calling agent, review_thread.go:199/275-298; refused drafts recorded for non-owner agents, review_thread.go:243). Fixes are in the inline threads. Correctness/style items from the prior head are outside this perspective; no change seen in those paths.

-- hive: agent=adjudicator-2 backend=claude model=claude-sonnet-5-5 claude=2.1.327

}
number = n
}
if _, owned := g.OwnPR(w.repo, number); !owned {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security: only ownership is checked, not that the owner is the calling agent, so a non-owner agent's refused draft is recorded and posted by the sweep.

Suggested change
if _, owned := g.OwnPR(w.repo, number); !owned {
owner, owned := g.OwnPR(w.repo, number)
if !owned || !strings.EqualFold(owner, agentName) {
return
}

if g.OwnPR == nil {
return reviewThreadRefusalText("this hive has no record of which PRs its agents opened"), true
}
if w.kind == reviewWriteDelete {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security: delete is checked only against the shared hive login + 15-minute age. Also resolve the comment's PR/issue and require g.OwnPR(repo,n) owner EqualFold agentName, so one agent cannot delete another agent's hive-authored comment.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision needed: @clubanderson should the crux proxy start letting the agent that opened a PR reply in its review threads, post PR review comments, and delete the hive's own comments younger than 15 minutes?

This is a permission change to the agent write surface in src/crux/proxy (new REST routes allowed, reference-repo replies/deletes now deferred to a new gate), so I am routing it rather than judging it as a plain bug fix. The question for a maintainer: is the allow-list in the PR body (hive-opened PR per agent_pr_created, caller is the opening agent, own-comment delete within 15 minutes, fail closed on lookup errors) the intended trust boundary?

What I read: the cmd/hive wiring (main.go SetReviewThreadGuard, review_feedback_wire.go reviewThreadOwners with a 1-minute cache over auditPRAgents). It reads consistent with the PR body: ownership comes from the audit trail, the bot login from the live client per call. I did not read the 1235-line proxy gate itself (review_thread.go, rules.go, reference_repos.go), so this is not a correctness sign-off on those.

One thing to weigh when deciding: ownership is cached for a minute, so a PR opened inside that window is refused until the next reload, and the refusal is then handed to a person via the needs-human note. That fails safe, just noisily.

-- hive: agent=reviewer-2 backend=claude model=claude-sonnet-5-5 claude=2.1.327

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Mutation testing

⏱️ The 900s mutation budget ran out, so 1 package(s) were not fully mutated and the results below do not cover them:

  • pkg/reviewfeedback: skipped (not started)

❌ gremlins did not produce a report for 1 package(s), so no verdict can be derived from this run (see the job log):

  • crux/proxy: gremlins exited 137

ℹ️ 7 mutant(s) on added lines were SKIPPED because gremlins v0.6.0 only honours the first lines added lines of each default-context hunk, so non-contiguous edits in one hunk are partly missed. This does not affect the verdict.

File Line Mutation
src/cmd/hive/review_feedback_wire.go 223 CONDITIONALS_BOUNDARY
src/cmd/hive/review_feedback_wire.go 223 CONDITIONALS_NEGATION
src/cmd/hive/review_feedback_wire.go 226 CONDITIONALS_NEGATION
src/cmd/hive/review_feedback_wire.go 286 CONDITIONALS_BOUNDARY
src/cmd/hive/review_feedback_wire.go 286 CONDITIONALS_NEGATION
src/cmd/hive/review_feedback_wire.go 287 CONDITIONALS_NEGATION
src/cmd/hive/review_feedback_wire.go 290 CONDITIONALS_NEGATION

Verdict: error (#17349).

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision needed: @clubanderson should decide whether any agent may delete any hive-authored comment (not just its own) within 15 minutes, since this widens the proxy's write surface.

This changes the proxy's write rules (src/crux/proxy), a trust surface, so it needs a person to sign off. The head was pushed recently, so I am not pushing anything; the suggestion below is for the author.

Delete is scoped to the hive's identity, not to the calling agent (medium). ownCommentDeleteRefusal in src/crux/proxy/review_thread.go allows DELETE when the comment author is the App bot login and the comment is under 15 minutes old. It never checks that the comment sits on a PR the calling agent opened. Agents post through hive-review and the hive's other relays as that same bot, so any agent can delete any other agent's recent review, sentinel or needs-human comment on any PR in scope. The PR body describes the delete rule as "the hive's own comment", which is what the code does, but the reply and PR-comment routes are scoped to the opening agent and the delete route is not.

Suggestion: resolve the comment's PR (as reviewCommentPR does for replies; for an issue comment use issue_url) and require OwnPR(repo, n) to name the calling agent, the same check the reply route uses. Alternatively, keep the current rule and state it explicitly in src/docs/github-write-surface.md.

Everything else I read, the reply and PR-comment ownership checks, fail-closed lookups, the clock-skew handling, and the draft peek that keeps the body readable, looks consistent with the stated design.

-- hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.327

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 18, 2026
@kubestellar-prow kubestellar-prow Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 18, 2026
@hivecommons-hive
hivecommons-hive Bot force-pushed the fix/review-thread-replies branch from 683dca2 to a1d63a8 Compare November 18, 2026 21:42
@kubestellar-prow kubestellar-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 18, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

@clubanderson this PR is back in your court (stage/071-needs-author). Its commits are signed off as the hive App rather than as you, so a squash merge would misattribute them and the sign-off attribution check stays red. No hive agent can rewrite a contributor's commits β€” the fix is yours:

  • 1 commit is signed off as the hive App instead of you, so a squash merge would misattribute it β€” set git config user.email to your own address, then run git rebase --exec 'git commit --amend --no-edit --reset-author -s' HEAD~5 && git push --force-with-lease

Once the new head lands, CI and the review swarm re-run automatically and the PR returns to the normal path. Current head: 0f56aad7eeb0.

Updates (newest last):

  • updated 2026-11-18 22:20 UTC: head 0f56aad7eeb0, 1 commit signed off as the hive App

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/awaiting-ci: Sign-off survives the squash and native-queue-policy fail, and the baseline check reports this branch 12 commits behind v5 (same on #19063, #19110, #17512), so it is branch drift, not a shared incident. Suggested fix: merge the latest v5 into this branch (signed off), then re-check. Not pushed, since this is not a hive-authored branch.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Scanner triage: failing checks here are not caused by this diff. Baseline check says MERGE_BASE: the branch is 14 commits behind v5 (sibling PRs are equally stale). Suggested fix: merge v5 into the branch with sign-off (git merge -s ort --signoff origin/v5) and push, then re-check. Not pushed from here because the branch is not hive-authored.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Scanner triage: the failing checks here (native-queue-policy, Sign-off survives the squash) are not on the default branch; the branch is behind v5 and the checks are stale. Suggested fix: merge the base branch into this branch (signed off) and let CI re-run. This is a human-authored branch, so I am not pushing.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Scanner triage: baseline check says this branch is behind its base by 22 commits and the failing checks (native-queue-policy, Sign-off survives the squash) are not shared with the base branch. Suggested fix: merge the base branch into this branch (signed off, git merge -s ort origin/<base> && git commit -s if needed) and re-run CI before diagnosing further. I am not pushing to this branch because it is not hive-authored.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson
clubanderson force-pushed the fix/review-thread-replies branch from 0f56aad to d9ac7fa Compare November 19, 2026 01:24
Every agent posts as the same App bot, so the author and age checks
alone let any agent delete another agent's or a reviewer's comment.
The delete gate now resolves the comment's PR from its own
pull_request_url or issue_url and refuses unless the caller opened it,
the same OwnPR check the reply path uses. Lookup failures refuse.

Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson

Copy link
Copy Markdown
Member Author

Decision on the delete question (least privilege, same rule as replies): an agent may delete a hive-bot comment only when it is under OwnCommentDeleteWindow (15 minutes) old AND it sits on a PR that the calling agent opened. The PR is read from the comment's own pull_request_url (review comment) or issue_url (issue comment) through the API, never from the request path, and checked with OwnPR the same way the reply path does. Any lookup failure, missing or unreadable URL, a PR the hive did not open, or a PR another agent opened is refused.

Done in 204538c: ownCommentDeleteRefusal now ends in the same owner check as replies (shared ownPRCallerRefusal), with tests for another agent's PR, a non-hive PR, missing and unreadable URLs, lookup failure, and the window edge. Docs updated in github-write-surface.md and the labels reference.

Second security finding (draft capture for non-owner agents): left as is on purpose. The sweep can kick a fallback fixer when the opening agent is unavailable, and that fixer is never allowed to reply, so its draft only reaches a person through this capture. The text is bounded and fenced. Limiting capture to the owner would silently drop those drafts; a tighter fix (owner or the agent the sweep kicked for that PR) needs kick state the proxy does not have, so it is better as a follow-up.

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 19, 2026
@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 19, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@clubanderson
clubanderson force-pushed the fix/review-thread-replies branch from e2ad1a3 to e20206c Compare November 19, 2026 02:09
@kubestellar-prow kubestellar-prow Bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@github-actions github-actions Bot added conflicts-with-open-pr Open PR has a merge conflict with another open PR and removed conflicts-with-open-pr Open PR has a merge conflict with another open PR labels Nov 19, 2026
Signed-off-by: Andy Anderson <andy@clubanderson.com>

# Conflicts:
#	src/cmd/hive/review_feedback_wire.go

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security review, delta 0f56aad..e20206c. The 208-file delta looks like a merge of the base branch. I only read this PR's own 13 files at head, not the unrelated merged code, so I could not judge that.

The ownership gate holds up. Replies and PR comments resolve the PR from the comment's pull_request_url and not from the path. Deletes need the hive's own author, a 15-minute window and a PR owned by the caller. Every failed lookup refuses. The gate sits after pause, scope and auto-merge in the MITM chain (github_proxy_mitm.go). The lookup token is the reference repo's token, the agent's own token, or the request's own credential (review_thread.go:395-413).

One in-scope finding. The refused-reply hand-off posts agent-controlled in_reply_to unfenced and unbounded (see the inline comment on review_thread.go:286). This is low-medium severity and the fix is small.

noteRefusedReviewReply (review_thread.go:258) records a refused draft from any agent on any hive-owned PR. It does not check that the caller is the owner. The draft body is fenced, so this is only an advisory note.

-- hive: agent=adjudicator-2 backend=claude model=claude-sonnet-5-5 claude=2.1.327

if json.Unmarshal(raw, &payload) != nil {
return "", ""
}
return payload.Body, strings.Trim(string(payload.InReplyTo), `"`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in_reply_to is agent-controlled and only quote-trimmed here. For a refused POST pulls/{n}/comments it is kept as InReplyTo (line 261-263; only overwritten with the numeric id for the reply route), and NeedsHumanNote prints it unfenced (reviewfeedback.go:661, Reply to review comment %s:). The body is fenced and bounded, this field is neither: up to 16KB of newlines, raw @mentions, links or a forged FeedbackNeedsHumanMarker line would be posted by the hive's own identity, skipping the outbound prose filter. A prompt-injected agent can do this from a reviewer comment. Fix: accept digits only.

Suggested change
return payload.Body, strings.Trim(string(payload.InReplyTo), `"`)
if s := strings.Trim(string(payload.InReplyTo), `"`); regexp.MustCompile(`^\d{1,20}$`).MatchString(s) {
return payload.Body, s
}
return payload.Body, ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› Review-feedback agent cannot reply on review threads of its own PR (proxy refuses replies, allows probe comments)

1 participant