Repository navigation
✨ feat(ownership): CLOSE an agent finding whose cited lines are gone from main - #16843
Conversation
…from main Follow-up to hivecommons#16831. Review-backlog findings cite permalinks pinned to a commit (projectbluefin/testsuite#1085: SKILL.md:163). For a filter-refused agent finding the enumeration reads the cited lines at that SHA and the file on the default branch; when every citation's lines (>=16 chars, as in hivecommons#16693) are gone, the row records RepoWorkIssue.CitedLinesGone and the dashboard offers CLOSE (cited_lines_gone). Bounded: 3 refreshes per repo per pass, 6h TTL, pinned-SHA content cached; read failures are unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
@Danathar this PR is back in your court ( Review asks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (7 waiting): fixes are handed out before new work as soon as you have capacity. |
Signed-off-by: Danathar <Danathar@users.noreply.github.com> # Conflicts: # src/pkg/dashboard/ownership.go # src/pkg/dashboard/ownership_11565_test.go # src/pkg/hiveadvisor/human_gate.go
There was a problem hiding this comment.
Test review (quality lane) — read at head 2cf1db2 (currently conflicts with v6, so this will need a rebase anyway). The heuristic is well fenced: every-citation-must-be-gone, min-line-length, budget, 6h cache, read-failure-as-unknown each have a test, and the ownership verb is a human-gated CLOSE offer rather than an automatic close.
The one branch without a test is the most consequential one: citedRefGone returns gone=true when the default-branch read is errCitedNotFound (the fake repo serves 404 for missing keys, but no test cites a file that exists at the pinned SHA and is absent on main). That path also fires when a file is renamed/moved with the cited lines intact, which is the false-positive this feature most needs to avoid offering. Please add a case for it in TestCitedLinesGoneBudgetAndFailures (pinned present, main 404 → gone == "path:N"), and consider whether a rename should rather be "unknown" (e.g. only treat 404 as gone when the body's permalink path also 404s at the current default-branch tree listing, or when no other file on main contains the evidence lines). Non-blocking as an offer, but worth deciding before the heuristic is trusted.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
@Danathar this PR is back in your court ( Failing checks:
Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path. Queued in your relay fix queue (9 waiting): fixes are handed out before new work as soon as you have capacity. |
There was a problem hiding this comment.
Correctness review (read at head aa3e3dd).
Deterministic "unknown" citations burn the per-repo budget every pass and are never cached — src/pkg/github/issue_cited_lines.go:197-234
citedLinesGone decrements *budget (line 213) before calling citedRefGone, and when citedRefGone returns known == false it returns without writing c.citedLines.results[key] (lines 217-223). That is right for a transient read failure, but two of the !known paths are permanent:
- cited lines too short to be evidence (
len(evidence) == 0, line 186) — the pinned content is cached forever inatSHA, so the answer can never change, yet the row consumes one of the 3citedMaxChecksPerReporefreshes on every enumeration pass; - a 404 at the pinned SHA (line 173 →
errCitedNotFound→return false, false). This is more common than it looks: GitHub's own line permalinks for Markdown files are…/SKILL.md?plain=1#L163, andcitedPermalinkRE's path group[^\s#)>\]]+(line 28) capturesSKILL.md?plain=1as the path. go-github escapes?in the contents path, so the read 404s forever — one GET plus one budget unit per pass, never resolved. The motivating testsuite#1085 happens to use a bare#L163, but any agent that copies a permalink from the UI on a.mdfile hits this.
Consequence: with ≥3 such rows listed before the others in a repo, fetchIssues (client.go:2147-2149) never gets to refresh any later finding, so CLOSE is never offered for them. TestCitedLinesGoneBudgetAndFailures covers the short-evidence case only for the first call, not that it keeps costing budget.
Suggested fix — strip the query from the path and cache permanent unknowns as gone: "" (they still refresh after citedTTL):
--- a/src/pkg/github/issue_cited_lines.go
+++ b/src/pkg/github/issue_cited_lines.go
@@ func citedRefs(body, owner, repo string) []citedRef {
- r := citedRef{path: m[4], sha: m[3], first: first, last: last}
+ path := m[4]
+ if i := strings.IndexByte(path, '?'); i >= 0 { // `SKILL.md?plain=1#L163`
+ path = path[:i]
+ }
+ r := citedRef{path: path, sha: m[3], first: first, last: last}
@@ func (c *Client) citedRefGone(ctx context.Context, owner, repo string, ref citedRef) (gone, ok bool) {
content, err := c.readCitedFile(ctx, owner, repo, ref.path, ref.sha)
+ if errors.Is(err, errCitedNotFound) {
+ // Pinned content can never appear: a settled "not gone".
+ return false, true
+ }
if err != nil {
return false, false
}
@@
evidence := citedEvidenceLines(old, ref.first, ref.last)
if len(evidence) == 0 {
- return false, false
+ // Pinned content is immutable, so this never changes: settle it.
+ return false, true
}With that, both cases land in results via the existing !isGone branch and stop consuming budget until the TTL expires. (If you prefer to keep them distinguishable from "still present", a third return value or a sentinel in citedResult works too; the important part is that they are written to results.)
— hive: agent=adjudicator-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Style review (head Duplicate helper — and delete lines 246-253 ( Advisory, no change needed: the PR body's Files table lists Review findings from Security perspective — no blocker. Read the diff and the surrounding code at head Checked and fine:
One low-severity resource note (in-scope, non-blocking):
- atSHA map[string]string
+ // atSHA holds the evidence lines read at a pinned SHA (immutable).
+ atSHA map[string][]string
...
- key := owner + "/" + repo + "@" + ref.sha + ":" + ref.path
+ key := owner + "/" + repo + "@" + ref.sha + ":" + ref.display()
c.citedLines.mu.Lock()
- old, cached := c.citedLines.atSHA[key]
+ evidence, cached := c.citedLines.atSHA[key]
c.citedLines.mu.Unlock()
if !cached {
content, err := c.readCitedFile(ctx, owner, repo, ref.path, ref.sha)
if err != nil {
return false, false
}
- old = content
+ evidence = citedEvidenceLines(content, ref.first, ref.last)
c.citedLines.mu.Lock()
if c.citedLines.atSHA == nil {
- c.citedLines.atSHA = map[string]string{}
+ c.citedLines.atSHA = map[string][]string{}
}
- c.citedLines.atSHA[key] = old
+ c.citedLines.atSHA[key] = evidence
c.citedLines.mu.Unlock()
}
- evidence := citedEvidenceLines(old, ref.first, ref.last)
if len(evidence) == 0 {Review findings from Read The check itself looks correct to me. The things I specifically verified:
One ordering question (low), for a maintainer:
Not a blocker; everything else I read matches the PR body and the dashboard.md rows. Review findings from Read the diff against the tree at the PR head ( Two notes, neither blocking:
Note the PR carries stage 080-awaiting-merge-admission → 072-returned-to-contributor: conflicting Evidence bundle `#16843fdd9a73` sha256:dd38ae505ac202627d6f8f8beaf2238df4991ac726d774492744dc5018e640d6 — download from the dashboard or `hivectl review evidence #16843`. |
Signed-off-by: Danathar <Danathar@users.noreply.github.com> # Conflicts: # src/docs/scale-envelope.md # src/pkg/github/client.go
…Es a rename Hive review on hivecommons#16843: - quality: a file gone from main is unknown, not gone (a rename keeps the lines); test pinned-present/main-404. - correctness: a pinned-SHA 404 or evidence too short is settled once and costs no further read or budget; `?query` is stripped from permalink paths (`SKILL.md?plain=1#L163`). - style: reuse hasAgentLaneLabel. - security: cache only the evidence lines (16-400 chars) at a pinned SHA, bounded at 1024 citations, never whole files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
Thanks for the reviews. All four are addressed in 6447144, on top of a v6 merge (82fbfdd) that resolves the conflicts with #16811.
I broke the changed logic in 9 ways and the tests caught all 9. github, dashboard, hiveadvisor, writeback and adminmcp tests pass, as do dashboard-gen-check and the docs references.
|
There was a problem hiding this comment.
Read issue_cited_lines.go against the v6 tree (hasAgentLaneLabel at review_priority.go:182, parkLandedMinLine at issue_park_recheck_landed.go:35, go-github v72 GetContents/GetContent). The decision logic is conservative in the right directions — a missing path at the pinned SHA, a file gone from main, and short/long lines all settle to "not gone" — and the ownership wiring only populates citedLinesGone on the !Admits branch (client.go:2152-2154), so step (8b) in decideIssueOwnership cannot fire for an admitted issue. Looks correct to me, with one low finding:
A permanent read error is treated as transient and re-spends the per-repo budget every pass. readCitedFile returns fc.GetContent() (issue_cited_lines.go:195); for a file over 1 MB go-github's GetContent returns unsupported content encoding: none on every call (repos_contents.go:94-95 in v72). citedRefGone maps any non-404 error to settled=false (:215-216, :230), and citedLinesGone then returns without storeCitedResult, so nothing is cached. The pass has already done *budget-- (:269) with citedMaxChecksPerRepo = 3 (:43). One agent finding citing a large generated file therefore consumes a third of the repository's budget on every enumeration forever, and the other findings behind it in iteration order wait proportionally longer. Consider settling a GetContent encoding error as "no evidence" (it is as permanent as a 404), or caching an unsettled result with a shorter TTL.
Not a defect, just a note for the reader: the result cache is keyed on owner/repo#N (:248) for citedTTL = 6h, so a body edit that adds or changes a citation is not noticed for up to six hours. That seems like an acceptable trade for a close-recommendation surface.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Executive summary
An agent finding that the issue filter keeps off the queues now becomes
CLOSEwhen every line it cites is gone from the default branch, instead of waiting to be admitted (#16831) or triaged. The review backlog cites its evidence as a permalink pinned to a commit. projectbluefin/testsuite#1085 is an example:`docs/skills/test-authoring/gnome/SKILL.md:163` (https://github.com/projectbluefin/testsuite/blob/20f3aa8…/…/SKILL.md#L163), about a fallback the guide no longer described.The enumeration reads the cited lines at the pinned commit and the same file on the default branch. When none of them is still there, it records the citation on the issue's work row, and the dashboard offers
CLOSEwith reasoncited_lines_gone. Ownership itself still makes no GitHub calls.What
TRIAGE(L≤5) / ADMIT (#16831) / outsideCLOSEcited_lines_gone: "The cited lines no longer match main (path:163) — close it, or admit it if the finding still holds"How
pkg/github/issue_cited_lines.go, the check:citedRefsparses same-repository permalinks at a full SHA (/blob/<sha40>/<path>#L<a>[-L<b>]), taking up to 3 per issue and up to 20 lines per citation. Links to a branch, or into other repositories, are ignored.citedRefGonetakes the cited lines at that SHA and keeps the trimmed lines of 16 to 400 characters. 16 is the same evidence threshold as the park re-check's landed detection (🐛 fix(park-recheck): say when a parked fix already landed; offer /fixed #16693). The citation is gone only when none of those lines is still a line of the file on the default branch.?query(SKILL.md?plain=1#L163, from GitHub's UI).citedLinesGonerecords the first citation only when every citation is gone.Cost:
agent/<role>label.Wiring:
fetchIssuessetsRepoWorkIssue.CitedLinesGoneon the filter-refused row.pkg/dashboard/ownership.goadds rule (8b), after verified-done and before TRIAGE and the filter rows:cited_lines_gone→CLOSE.pkg/hiveadvisorgets the wording, and the reason-code count test is bumped.Files
src/pkg/github/issue_cited_lines.go(new)src/pkg/github/client.goCitedLinesGoneon the row, call sitesrc/pkg/dashboard/ownership.gocited_lines_gonesrc/pkg/hiveadvisor/human_gate.gosrc/docs/dashboard.md,scale-envelope.md, changelogTests
TestEnumerationRecordsCitedLinesGoneEnumerateActionableon a testsuite#1085-shaped finding: gone, still present, file deleted, person's issue, admitted; a second pass within the TTL reads nothingTestCitedLinesGoneBudgetAndFailuresTestCitedLinesGoneNeedsEveryCitationGoneTestCitedRefsParsesPermalinks?plain=1stripped from the pathTestCitedLinesRenamedFileIsNotGone,TestCitedEvidenceCacheIsBounded,TestCitedEvidenceLinesBoundsTestCitedLinesGoneOffersClose,TestRepoOwnershipClosesStaleFindingRowgo testgithub, dashboard, hiveadvisor, writeback (ratchet), adminmcpcheck-docs-citations.pyscale-envelope.md:37re-anchored after the newclient.golines)Notes
github.IssueFilterReasonwith identical text, and both bump the reason-code count, so whichever merges second needs a one-line count fix.path:linewithout a permalink has no pinned content to compare against, so it decides nothing.issueCitedPaths(close-on-merge, 🐛hive/likely-donemarks issues whose fix PR covered only part of the finding #11931) extracts paths for a different purpose and is not reused.approved-direction) whose lines are gone also getsCLOSE. A maintainer who still wants the work can admit it; the reason says so.🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1