[scanner] fix: make repo AGENTS.md outrank hive prompt conventions (InjectionText precedence, base-branch + PR-title deference) - #7171
Closed
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
Hive agents opened PRs that died on other repos' gates — wrong base branch on repos using a promotion model, [lane]-prefixed titles on repos enforcing Conventional Commits — because the repo's AGENTS.md arrived in the kick as undifferentiated prose while hive's conflicting instructions carried imperatives and self-check steps. Nothing said which wins, so agents followed hive. Three changes: - agentsmd.InjectionText now opens the injected block with an explicit precedence statement: for repository-local conventions (PR base branch, title format, commit style, review workflow) the repo's own rules override any conflicting hive instruction in the same prompt. - Both base-branch wordings in buildTaskPromptBodyForAccess defer to the branch the repository's AGENTS.md/CONTRIBUTING names as the PR target; the default-branch resolution becomes the fallback for repos that state no rule. The 'do not use the branch you find' clause is kept, and an explicitly task-named branch (release lines) is not overridden. - Every policy template with a hardcoded '[<lane>] fix:' PR title gains a deference note: hive's house style applies only when the target repo has no title convention; the [lane] prefix is load-bearing for ISSUE routing (classify), never for PR titles. src/policies/ copies kept in sync with the embedded defaults, as the policies tests require. Fixes #7159 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
Contributor
|
[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 |
Contributor
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Member
hivecommons-hive
Bot
deleted the
scanner/fix-7159-agentsmd-precedence
branch
September 16, 2026 14:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
Cluster:
src/pkg/agentsmd/agentsmd.go(InjectionText+injectionPrecedence),src/pkg/dashboard/contribute_ws.go(buildTaskPromptBodyForAccessbase wording), and the PR-title sections of the policy templates undersrc/pkg/policies/defaults/+ their syncedsrc/policies/copies. Disjoint from open PRs #7147/#7150/#7152/#7155/#7157.Agents followed hive's imperative prompt text over the target repo's own AGENTS.md and died on the repo's gates (bluefin base-branch gate, common/review conventional-title gates). Three changes:
# Repository Agent Instructions (AGENTS.md)block now opens by stating that for repository-local conventions (PR base branch, PR title format, commit style, review workflow) the repo's rules OVERRIDE any conflicting hive instruction in the same prompt. One site covers every kick.buildTaskPromptBodyForAccessnow defer to a PR target branch named by the repo's AGENTS.md/CONTRIBUTING;defaultBranchRefresolution becomes the fallback. The load-bearing "do not use the branch you find" clause (🐛 bug: the contributor task prompt never names a base branch, so one branch-specific issue redirects every later PR in a session #5729) is kept, and a branch the task itself names (release lines) is not overridden.[lane]PR-title deference — each template with a hardcoded--title "[<lane>] fix: …"gains a note: house style only for repos with no title convention; the prefix is load-bearing for ISSUE routing (classify), never PR titles (intent.Classifynever reads it). Kept rather than removed so behavior on hive's own repos is unchanged.Tests: new precedence assertion in
TestInjectionText;TestBuildTaskPrompt_FallbackWordingCarriesTheFullProcedureupdated (placeholder nowupstream/<base-branch>+ AGENTS.md-deference assertion).go test ./pkg/agentsmd/ ./pkg/policies/ ./pkg/scheduler/and the dashboard prompt tests pass;src/policies/copies re-synced as the policies embed-equality test requires.Closes #7159
Filed by scanner agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=scanner backend=copilot model=claude-fable-5