Skip to content

πŸ› Create a governor issue in every repo of a multi-repo hive - #18534

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
fix/18448-governor-issue-per-repo
Nov 16, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
fix/18448-governor-issue-per-repo

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #18448

Root cause

The pinned advisory (governor) issue was only ever ensured for one repo. The boot ensure, the eval-cycle re-ensure (ensurePinnedAdvisoryIssue), the App reinit / primary-change paths and the digest post all key on advisory.PrimaryRepo(cfg) (the configured primary, or project.repos[0]). No code path ever iterated the rest of project.repos, so in a two-repo hive the second repo never got an issue.

Fix

  • advisory.ManagedRepos(cfg): primary first, then every project.repos entry, deduplicated (bare vs org-qualified, case-insensitive).
  • ensureSecondaryAdvisoryIssues (new, cmd/hive/advisory_repo_issues.go) runs every eval cycle next to the primary ensure: each non-primary repo without a resolved issue is ensured via EnsureAdvisoryIssue, which reuses an existing issue by title/label (or reopens a closed one) before creating, so restarts never duplicate. Numbers are stored per repo in advisoryIssues. Repos added in Settings are picked up on the next cycle with no restart.
  • No write access / Issues disabled / repo moved or archived: logged, raised as a per-repo dashboard warning (advisory-repo-issue:<repo> system alert), and backed off for an hour; other repos are unaffected. Transient errors retry next cycle with no alert. Paused repos are skipped quietly. Alerts clear once the repo resolves or leaves project.repos.
  • The rendered digest is also posted to each secondary repo's issue, paced per repo by the existing post gate. Secondary failures never touch the primary's hub-facing digest error or the App banner.
  • The primary path is unchanged.

Tests

  • cmd/hive/advisory_repo_issues_test.go: multi-repo creation, idempotency across cycles and restart, repo added later, no-write-access (alert, backoff, recovery clears alert), transient retry, Issues-disabled and paused, stale alert cleanup, secondary digest posting.
  • pkg/github/advisory_multi_repo_test.go: stateful fake GitHub; two repos each get one issue, and a fresh client reuses both.
  • pkg/advisory/policy_managed_repos_test.go: ManagedRepos ordering and dedupe.

πŸ€– Generated with Claude Code

The pinned advisory (governor) issue was only ever ensured for the primary
repo: the boot ensure, the per-cycle re-ensure and the digest post all keyed
on advisory.PrimaryRepo, so every other repo in project.repos never got one.

Ensure every non-primary managed repo each eval cycle until it resolves
(repos added in Settings included), store the number per repo, post the same
digest to each, and surface repos the hive cannot write to as per-repo
dashboard warnings with an hourly retry.

Fixes #18448

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 16, 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 clubanderson 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

@clubanderson

Copy link
Copy Markdown
Member Author

@nate-double-u FYI, this is the fix for #18448 (governor issue missing in multi-repo hives).

@kubestellar-prow kubestellar-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 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

5 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/cmd/hive/advisory_repo_issues.go 192 ARITHMETIC_BASE
src/cmd/hive/advisory_repo_issues.go 244 CONDITIONALS_NEGATION
src/cmd/hive/advisory_repo_issues.go 251 CONDITIONALS_NEGATION
src/cmd/hive/advisory_repo_issues.go 254 CONDITIONALS_NEGATION
src/cmd/hive/advisory_repo_issues.go 257 CONDITIONALS_NEGATION

Verdict: uncovered (#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.

Read the diff (new advisory_repo_issues.go, the two main_eval_cycle.go call sites, advisory.ManagedRepos). The mechanism looks correct to me: ManagedRepos dedupes bare/org-qualified spellings and keeps primary first, advisorySecondaryRepos drops index 0, the ensure loop skips resolved repos and backs off refused ones, and the tests cover restart reuse and the no-write-access alert path.

One open question I could not settle from the diff (not a defect I can cite): postAdvisoryDigestToSecondaryRepos (advisory_repo_issues.go, called at main_eval_cycle.go ~L1621) posts the same rendered digest β€” all agents' open advisory beads β€” to every repo in project.repos. If a hive mixes a private repo with a public one, bead text derived from the private repo would be written into a public issue. If the digest is already scoped per repo, or the repos are required to share visibility, this is moot; otherwise a maintainer may want to decide whether the secondary post should be limited to same-visibility repos.

Looks otherwise correct; I did not run anything.

β€” hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive
hivecommons-hive Bot merged commit 8f0a2f6 into v5 Nov 16, 2026
88 of 92 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/18448-governor-issue-per-repo branch November 16, 2026 23:11
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Evidence bundle `#185344a9819d` sha256:70971994a5e6c6d3d3a373c2983ef9f2021b8cbcf1a5fe973027374fd16ed55d β€” download from the dashboard or `hivectl review evidence #18534`.

clubanderson added a commit that referenced this pull request Nov 17, 2026
A candidate build opened a "[governor] 🐝 Hive Advisory Report" in every
repo of project.repos. Commit 8f0a2f6 (#18534) added
ensureSecondaryAdvisoryIssues and postAdvisoryDigestToSecondaryRepos,
wired into runEvalCycle, which ensured (and so created) an advisory
issue in every non-primary managed repo each eval cycle and posted the
digest to each.

Remove the per-repo ensure and digest post and ManagedRepos, so only
project.primary_repo is ever ensured or posted to. The single report is
still resolved by title and the hive/advisory label before any create,
so a restart reuses the open report.

Tests pin the primary-only rule for multi-repo and standalone configs,
restart idempotency at the cycle seam and at the client (both title
spellings, zero creates, zero edits), and an AST guard that fails if an
advisory writer is wired a second time or called inside a loop.

Fixes #18568

Signed-off-by: Andy Anderson <andy@clubanderson.com>
hivecommons-hive Bot pushed a commit that referenced this pull request Nov 17, 2026
)

A candidate build opened a "[governor] 🐝 Hive Advisory Report" in every
repo of project.repos. Commit 8f0a2f6 (#18534) added
ensureSecondaryAdvisoryIssues and postAdvisoryDigestToSecondaryRepos,
wired into runEvalCycle, which ensured (and so created) an advisory
issue in every non-primary managed repo each eval cycle and posted the
digest to each.

Remove the per-repo ensure and digest post and ManagedRepos, so only
project.primary_repo is ever ensured or posted to. The single report is
still resolved by title and the hive/advisory label before any create,
so a restart reuses the open report.

Tests pin the primary-only rule for multi-repo and standalone configs,
restart idempotency at the cycle seam and at the client (both title
spellings, zero creates, zero edits), and an AST guard that fails if an
advisory writer is wired a second time or called inside a loop.

Fixes #18568

Signed-off-by: Andy Anderson <andy@clubanderson.com>
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› bug: In multi-repo hives, governor issue not created in all repos

1 participant