Skip to content

🐛 fix(github): recognise the hive's own unpark replies when it posts as an unconfigured login - #17512

Open
hanthor wants to merge 2 commits into
v5from
fix/unpark-reply-own-login
Open

hanthor wants to merge 2 commits into
v5from
fix/unpark-reply-own-login

Conversation

@hanthor

@hanthor hanthor commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Bug: the un-park sweep posts the same reply to one /hive command on every sweep when the hive posts as a GitHub login its configured identity doesn't name.
  • Cause:
    • answeredUnparkCommentIDs counts a hive:unpark-reply marker only when markerAuthorTrusted accepts the comment's author.
    • An App installed under its own slug, with no github.app_slug set, falls back to DefaultGitHubAppSlug (hivecommons-hive). Because the identity names that slug, knowsOwnAccounts() is true.
    • The hive's real <slug>[bot] login is never in the identity, and an App installation token cannot call GET /user, so each sweep sees its own reply as untrusted, treats the command as unanswered and replies again.
  • Fix:
    • New learnSelfLogin records the author GitHub returns when the client creates an un-park reply, a notice or a label-approval comment. That author is the account the token posts as.
    • isHiveAccount already accepts cachedSelfLogin(), so the hive's own markers count from the next sweep on.
    • A marker pasted by any other account still does not count. For a PAT the learned login is the same one GET /user returns.

Evidence from a live hive (tuna-os)

The hive's own replies all carry the same marker, id=6582313529, which points at the one maintainer comment it keeps answering:

Issue Bot replies Per day since 11-02
tuna-os/Tavern#299 320 15-58
tuna-os/corral#607 325 16-58
tuna-os/corral#634 323 15-58
tuna-os/bluefin-cli#295 323 15-58

The flood stopped at 2026-11-09 16:13 UTC only because the issues were un-parked by hand on 11-10; the code path is unchanged on v5.

On v6 the repeated reply is the project.ai_author refusal (renderUnparkAIAuthorRefusal). The trust check that loops is the same on v5, where /hive help shows it (see test).

Related issues

Refs #11313

Not superseded by #11711: that PR (096c5c7, merged 10-13) is already in this branch's original 11-10 base, and the loop above ran on top of it. It added label-driven approval; it does not teach the hive a login its identity doesn't name.

Testing

  • New regression test TestSweepIssueUnparkCommandsAnswersOnceWhenPostingAsUnconfiguredLogin:
    • The fake server reports a comment author (postAuthor) different from the configured AppLogin; the test runs three sweeps.
    • Fails on v5: command 11 answered 3 times over 3 sweeps, want once. Passes with the fix.
  • On the original 11-10 base: go test ./pkg/github/... -count=1, go build ./..., go vet ./pkg/github/ and gofmt were clean.
  • After merging current v5 into the branch (no conflicts): gofmt -l and check-changelog-fragment.sh are clean; CI is the verdict for the Go tests.

Limits

  • One extra reply per restart: the learned login lives in memory, so after a restart the first reply to an already-answered command can be posted once more. Setting github.app_slug to the App's real slug avoids it; reading the slug from GET /app at boot would close it in code.
  • Other marker writers: markers posted through CreateIssueComment (claim ledger, scanner notes, not-agent-work notes) don't teach the login yet. Danathar will follow up with that as a separate v5 PR after this one merges, so this PR's commits stay hanthor's for the squash sign-off check.
  • No v6 changes: v6 carries the same postUnparkReply, CreateIssueComment and trust check, so the fix should reach v6 through v6-topup.

Contributor checklist

  • Changelog: changelog.d/fixed-unpark-reply-own-login.md
  • Targets v5
  • Title uses the emoji convention
  • DCO sign-off
  • No secrets or runtime state

Fix and evidence by hanthor; brought up to date with v5 (a merge commit, no conflicts) by Danathar.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…as an unconfigured login

The un-park sweep only believes a hive:unpark-reply / hive:label-approval
marker when the comment's author is one of the hive's own accounts
(markerAuthorTrusted, #11313). An App installed under its
own slug with no github.app_slug set falls back to the public default
slug, so the hive's real <slug>[bot] login was never among those accounts:
every sweep saw the command as unanswered and replied again.

A live tuna-os hive posted 320+ identical replies on each of four issues
(40-58 a day) this way.

Record the author GitHub returns when the client creates an un-park reply,
notice or label-approval comment. That author is by definition the
account the token posts as, so isHiveAccount now matches it through the
existing cachedSelfLogin check. A marker pasted by any other account still
does not count.

Signed-off-by: James Reilly <jreilly1821@gmail.com>
@kubestellar-prow kubestellar-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Nov 10, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hanthor for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 10, 2026
@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

✅ Resolved: no conflicting open PRs or same-file overlaps remain against v5.

@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing (advisory)

No surviving mutants in changed files (or the run hit its time budget before reporting any).

Advisory only; this job never blocks the PR (#17349).

hivecommons-hive Bot pushed a commit that referenced this pull request Nov 15, 2026
…ct (#18281)

native-queue-policy went red on #17512, #18273, #18275 and #18278 and the
scanner filed it as one shared-CI incident (#18280). The gate was right
every time: #17512 is a draft carrying do-not-merge/work-in-progress,
#18273 and #18275 have probot DCO action_required, and #18278 has
changelog-fragment-guard failure. The defect was the surface. A red
provider was thrown as a bare `Error('DCO: action_required')` and printed
as "Unhandled error" with a stack trace, which reads like a broken workflow.

evidenceForHead and assertProwDCO now throw a ProviderVerdict naming the
provider, its conclusion, the head, and that this is a per-PR verdict and
not a shared CI incident. The evidence-wait step reports it with a job
summary and core.setFailed instead of rethrowing. The conclusion stays
failure: this is a required check.

Hive-Run: #18280
Hive-Plan: shared-ci incident triage
Hive-Spec: native-queue-policy#provider-verdict
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@clubanderson

Copy link
Copy Markdown
Member

Hi @hanthor, checking in on this one. It has been a draft since Nov 10 with no updates since. Are you still planning to finish it? If so, mark it ready for review when it's done and we'll get it through. If it's no longer needed (for example if a later change already covers the unpark-reply case), please close it. If we don't hear back in about a week we'll close it so the queue stays clean, and you're welcome to reopen anytime. Thanks!

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive recommends: close #17512 as superseded: #11313 was already fixed by merged PR #11711 (096c5c7); owner to confirm

Rationale: issue #11313 is closed and merged PR #11711 (096c5c7) closed it, so #17512 has nothing left to deliver; it is closed as superseded, not adopted (#15289); a person pushed it themselves, so the hive asks them to close it. stage/085-needs-decision stays.

Hive decided: Recommended only; a person confirms.
Why: The issue was already fixed by a merged PR; closed as superseded.
What happens next: Nothing by itself. The item stays parked until a person decides it: approve it, give direction, or close it from the Activity Monitor.

Decided by the hive at @clubanderson's request as the owner's delegate under the owner-delegate policy (rule already-fixed).

Brings the branch up to date with v5 (1095 commits). No conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 19, 2026
@Danathar
Danathar marked this pull request as ready for review November 19, 2026 17:52
@kubestellar-prow kubestellar-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 19, 2026
@Danathar
Danathar force-pushed the fix/unpark-reply-own-login branch from e7eb4eb to 75eda2f Compare November 19, 2026 17:57
@kubestellar-prow kubestellar-prow Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants