Skip to content

🐛 [v6] PR attribution: a PR drops out of "PRs by model" when any line follows the hive trailer #19364

Closed

Description

@Danathar

Target: v6.

Target branch: v6. Open the PR with --base v6. Citations are path:line on v6 @ e912f7c (release 6.52.4), plus the function name, so the pointers still work after the lines drift.

Executive summary

The hive works out which AI model wrote a PR by reading the attribution trailer in the PR body (— hive: agent=… backend=… model=…). The parser accepts the trailer only when it is the last non-empty line of the body. Any line after it makes the PR disappear from PRs by model, Most effective models, and the rework and cost figures built on them.

That happens a lot, and the hive causes some of it itself. On projectbluefin, 112 of 707 trailer-carrying PRs opened since 2026-10-20 (16%) are dropped this way. The most common lines after the trailer are Refs #N, Closes #N, the Claude Code 🤖 Generated with … line, and the hive's own <!-- hive:issue-link-fixed --> marker.

The fix: find the trailer even when known footer lines follow it, and make the hive stop appending its own marker after the trailer.

Problem

ParseAttributionTrailer walks the body from the end, skips blank lines, and looks only at the first non-blank line it meets. If that line does not start with a trailer prefix, it returns "no trailer". A PR body with any line after the trailer is therefore unattributed, even though the trailer is right there.

The parser does strip the identity footer first (--- + 🐝 **Hive Agent**: …), so that footer is not the problem. Everything else after the trailer is.

Evidence

Scan of every PR in the 20 projectbluefin repos created since 2026-10-20, reading the last — hive: line in each body and comparing it with the parser's rule. Of 707 PRs with a trailer, 112 have a non-blank line after it (identity footer excluded). What that line was:

Line after the trailer PRs
Refs #N (with or without a note) 46
<!-- hive:issue-link-fixed --> 22
Closes #N 14
🤖 Generated with [Claude Code]… 11
Fixes #N 2
Free text (agent prose, URLs) ~17

By model: Claude Opus 5.5 loses 47 PRs, GPT-6.1 Sol 31, Ornith 15, GPT-6.1 Terra 7.

Concrete examples (all recent enough that nothing else hides them):

Root cause

  1. Parser: src/pkg/github/attribution.go:468 ParseAttributionTrailer. The loop at :473-482 breaks on the first non-blank line from the end, whether or not it is a trailer.
  2. The hive breaks its own trailers: src/pkg/github/pr_issue_link.go:398 rewriteRefsIssueLinkToClosing appends "\n\n" + issueLinkFixedMarker at the very end of the body, after the trailer. Every PR this repair touches becomes unattributed.

Wanted behavior

  • A PR whose trailer is followed only by footer lines is still attributed. Footer lines are: closing or reference keywords (Refs, Ref, Closes, Fixes, Resolves, Part of, any case, with #N or owner/repo#N, optional note text after); HTML comments (<!-- … -->); and the Claude Code 🤖 Generated with line.
  • rewriteRefsIssueLinkToClosing puts its marker above the attribution trailer when there is one, so the trailer stays at the end.
  • A trailer quoted in the middle of prose is still not taken as the PR's own attribution. That is why the parser is strict today; keep it strict for anything that is not a known footer line.

Acceptance criteria

  • ParseAttributionTrailer returns the trailer's metadata when the trailer is followed by any mix of the footer lines listed above, and by the identity footer.
  • It still returns false when the trailer is followed by an ordinary prose line or a code block.
  • When a body has two trailer lines, the last one wins (same as today).
  • rewriteRefsIssueLinkToClosing output keeps the trailer as the last line before any identity footer, with the marker placed above it. A body with no trailer keeps today's output.
  • Existing attribution tests pass unchanged.

Test plan

  • Add cases to src/pkg/github/attribution_test.go (or a new attribution_footer_lines_test.go): one per footer type above, a mixed tail, the identity footer after a footer line, prose after the trailer (stays unattributed), and two trailers.
  • Add cases to src/pkg/github/pr_issue_link_test.go for rewriteRefsIssueLinkToClosing with and without a trailer.
  • Run go test ./src/pkg/github/... in CI. Per AGENTS.md, do not run local go test/go build; gofmt -l only.

Out of scope

  • The 14-day closed-PR lookback that also hides PRs from the same card. That is a separate issue (linked below).
  • Changing the trailer format, or rewriting existing PR bodies on GitHub. Fixing the parser re-attributes old PRs on the next enumeration.

Related: #18713 / #18739 (coverage disclosure on the same card).

Sibling issue (closed-PR lookback): #19365

Activity

  1. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Nov 20, 2026
  2. hivecommons-hive commented on Nov 20, 2026

    @hivecommons-hive
    Contributor

    🔒 Claimed by @kellyaa (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply /unclaim to release, or /claim to take it over if you outrank the holder.

    Claim history
    • 2026-11-20 04:18 UTC — claimed by kellyaa (contributor on hive hosted-available-oke-11-placeholder-r05x)
  3. Danathar commented on Nov 20, 2026

    @Danathar
    ContributorAuthor

    Fixed by #19366 (#19366), merged into v6 at c06e742. The PR body lacked a closing keyword, so closing by hand. #19367 (extra regression cases on top of it) stays open on its own.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.hive/claimed-by-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions