Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/pkg/agentsmd/agentsmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
//
// ---
// skills:
// - go-testing
// - pr-etiquette
// - go-testing
// - pr-etiquette
// ---
//
// 2. Inline skill sections: any section whose heading is "## Skill: <name>"
Expand Down Expand Up @@ -80,6 +80,19 @@ const (
// mirroring the "# Relevant Knowledge" convention used by the Primer.
injectionHeader = "# Repository Agent Instructions (AGENTS.md)"

// injectionPrecedence states which rules win when the repository's own
// instructions and hive's built-in prompt disagree. Without it the repo's
// AGENTS.md arrived as undifferentiated prose while hive's conflicting
// instructions carried imperatives and self-check steps, so agents followed
// hive and failed the repo's own gates — wrong PR base branch, rejected PR
// title format (hivecommons/hive#7159). The repository knows its own
// conventions; hive's wording on those subjects is a default, not a rule.
injectionPrecedence = "These are the repository's own rules. For repository-local conventions " +
"— PR base branch, PR title format, commit style, review workflow — they OVERRIDE any " +
"conflicting instruction elsewhere in this prompt, including hive's own defaults and " +
"self-check steps. When they conflict, follow AGENTS.md and treat the hive wording as " +
"the fallback for repositories that state no rule."

// injectionSkillsHeader titles the resolved-skills subsection.
injectionSkillsHeader = "## Requested Skills"
)
Expand Down Expand Up @@ -345,6 +358,8 @@ func (c *AgentsConfig) InjectionText(requestedSkills []string) string {
var b strings.Builder
b.WriteString(injectionHeader)
b.WriteString("\n\n")
b.WriteString(injectionPrecedence)
b.WriteString("\n\n")
if body := strings.TrimSpace(c.Body); body != "" {
b.WriteString(body)
b.WriteString("\n")
Expand Down
6 changes: 6 additions & 0 deletions src/pkg/agentsmd/agentsmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ func TestInjectionText(t *testing.T) {
if !strings.Contains(out, injectionSkillsHeader) {
t.Errorf("missing skills subheader: %q", out)
}
// #7159: the injected block must say the repo's rules outrank hive's own
// conflicting prompt text; without it agents followed hive's imperatives
// into the repo's failing gates (wrong PR base, rejected title format).
if !strings.Contains(out, injectionPrecedence) {
t.Errorf("missing precedence statement: %q", out)
}

// Explicit empty slice -> body only, no skills section.
bodyOnly := cfg.InjectionText([]string{})
Expand Down
5 changes: 4 additions & 1 deletion src/pkg/dashboard/contribute_task_base_branch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ func TestBuildTaskPrompt_FallbackWordingCarriesTheFullProcedure(t *testing.T) {
for _, want := range []string{
"defaultBranchRef",
"git fetch upstream",
"git checkout -b <your-branch> upstream/<default-branch>",
"git checkout -b <your-branch> upstream/<base-branch>",
"confirm the PR's base",
// #7159: the repository's own contributor rules outrank hive's
// default-branch guess; the fallback wording must say so.
"AGENTS.md or CONTRIBUTING",
} {
if !strings.Contains(prompt, want) {
t.Errorf("fallback wording is missing %q; got: %q", want, prompt)
Expand Down
20 changes: 15 additions & 5 deletions src/pkg/dashboard/contribute_ws.go
Original file line number Diff line number Diff line change
Expand Up @@ -5762,18 +5762,28 @@ func buildTaskPromptBodyForAccess(repoFull, issueRef, title, sourceHint, baseBra
// trustworthy substitute — the upstream repository's own default
// branch, read from the clone rather than from whatever the last task
// left behind — and keep the "do not use the branch you find" clause,
// which is the load-bearing half in both wordings.
// which is the load-bearing half in both wordings. The default branch
// is still only hive's guess about the repo's conventions: a repo on a
// promotion model (default = released line, PRs land on an integration
// branch) states its real target in AGENTS.md/CONTRIBUTING, and that
// statement outranks the guess (hivecommons/hive#7159).
"Do not assume the branch the checkout is currently on is the right base: it may "+
"be left over from a previous task. Resolve %s's own default branch "+
"('gh repo view %s --json defaultBranchRef'), run 'git fetch upstream', and "+
"be left over from a previous task. If the repository's own contributor rules "+
"(AGENTS.md or CONTRIBUTING) name the branch PRs must target, use that branch — "+
"the repository's rule outranks the default below. Otherwise resolve %s's own "+
"default branch ('gh repo view %s --json defaultBranchRef'). Then run "+
"'git fetch upstream', and "+
"start your work branch from it with "+
"'git checkout -b <your-branch> upstream/<default-branch>'. Open the PR "+
"'git checkout -b <your-branch> upstream/<base-branch>'. Open the PR "+
"against the same branch, and confirm the PR's base is that branch before "+
"you report done. ",
repoFull, repoFull)
if b := strings.TrimSpace(baseBranch); b != "" {
baseHint = fmt.Sprintf(
"Base this work on the '%s' branch of %s. The checkout may be left on a "+
"Base this work on the '%s' branch of %s. If this task did not itself name "+
"that branch and the repository's own contributor rules (AGENTS.md or "+
"CONTRIBUTING) require PRs to target a different branch, the repository's "+
"rule wins — substitute its branch throughout. The checkout may be left on a "+
"DIFFERENT branch by a previous task, so do not use whatever branch you "+
"find there: run 'git fetch upstream' and start your work branch from the "+
"base with 'git checkout -b <your-branch> upstream/%s'. Open the PR against "+
Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/architect-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "architecture"
```

The `[architect]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[architect]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Architect can PR: package reorganization, interface extraction, dependency inversion, dead code removal.
Architect must NEVER: merge any PR, make feature additions or behavior changes.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/architect-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "architecture,hold"
```

The `[architect]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[architect]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Architect can PR: package reorganization, interface extraction, dependency inversion, dead code removal.
Architect must NEVER: merge any PR, remove `hold` label, make feature additions or behavior changes.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/ci-maintainer-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "ci"
```

The `[ci-maintainer]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[ci-maintainer]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

CI Maintainer can PR: `.github/workflows/*.yml` changes, dependency pinning, runner config, coverage gates.
CI Maintainer must NEVER: merge any PR, modify production source code.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/ci-maintainer-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "ci,hold"
```

The `[ci-maintainer]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[ci-maintainer]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

CI Maintainer can PR: dependency pinning, runner config, coverage gates, and composite
actions under `.github/actions/`.
CI Maintainer can NOT PR `.github/workflows/*.yml` in this mode: its
Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/guide-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "documentation"
```

The `[guide]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[guide]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Guide can PR: README updates, CONTRIBUTING improvements, architecture docs, getting-started guides, API docs.
Guide must NEVER: merge any PR, create PRs that touch source code.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/guide-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "documentation,hold"
```

The `[guide]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[guide]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Guide can PR: README updates, CONTRIBUTING improvements, architecture docs, getting-started guides, API docs.
Guide must NEVER: merge any PR, remove `hold` label, create PRs that touch source code.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/outreach-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "community,outreach,hold"
```

The `[outreach]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[outreach]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Outreach can PR: ADOPTERS.md, blog post drafts, case studies, partnership docs, contributor guides, event proposals.
Outreach must NEVER: remove a hold label, merge any PR, make regulatory/compliance claims, invent roadmap commitments, contact external parties directly, or open PRs on external repos without explicit instruction.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/quality-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "quality,testing"
```

The `[quality]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[quality]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Quality can PR: new unit tests, test fixtures/helpers, CI workflow improvements, coverage reporting config.
Quality must NEVER: merge any PR, create PRs for production code or non-testing changes.

Expand Down
1 change: 1 addition & 0 deletions src/pkg/policies/defaults/quality-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Closes #<issue-number> (ask: does merging this PR leave anything for issue #<iss
--label "quality,testing,hold"
```

The `[quality]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[quality]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

### What quality can PR
- New unit tests for uncovered functions
Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/scanner-automerge.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Steps:
13. Return immediately — do NOT wait for CI, do NOT merge, do NOT run build or lint
```

The `[scanner]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[scanner]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

**Launch ALL agents in a single batch** — do not wait for one to complete before launching the next. Aim for 4-8 agents running simultaneously.

After dispatching all agents, proceed to the final merge sweep.
Expand Down
1 change: 1 addition & 0 deletions src/pkg/policies/defaults/scanner-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ hive-open-pr --repo "$HIVE_REPO" \
--issues <issue-number>
```

The `[scanner]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[scanner]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

## Writing Beads

Expand Down
1 change: 1 addition & 0 deletions src/pkg/policies/defaults/scanner-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "hold"
```

The `[scanner]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[scanner]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

## Writing Beads

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/sec-check-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "security"
```

The `[sec-check]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[sec-check]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Sec-Check can PR: dependency version bumps for CVEs, removing hardcoded secrets, RBAC config fixes, unsafe pattern removal.
Sec-Check must NEVER: merge any PR, expose secret values in PR descriptions.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/sec-check-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ hive-open-pr --repo "<org>/<target-repo>" \
--label "security,hold"
```

The `[sec-check]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[sec-check]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Sec-Check can PR: dependency version bumps for CVEs, removing hardcoded secrets, RBAC config fixes, unsafe pattern removal.
Sec-Check can NOT PR a fix that lives in `.github/workflows/*.yml`: an ISSUES_AND_PRS
token is minted at the `contributor` tier, which does not carry the Workflows
Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/strategist-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "roadmap"
```

The `[strategist]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[strategist]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Strategist can PR: ROADMAP.md, milestone planning docs, contribution strategy docs.
Strategist must NEVER: merge any PR, implement features or write source code.

Expand Down
2 changes: 2 additions & 0 deletions src/pkg/policies/defaults/strategist-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "roadmap,hold"
```

The `[strategist]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[strategist]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Strategist can PR: ROADMAP.md, milestone planning docs, contribution strategy docs.
Strategist must NEVER: merge any PR, remove `hold` label, implement features or write source code.

Expand Down
2 changes: 2 additions & 0 deletions src/policies/architect-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "architecture"
```

The `[architect]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[architect]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Architect can PR: package reorganization, interface extraction, dependency inversion, dead code removal.
Architect must NEVER: merge any PR, make feature additions or behavior changes.

Expand Down
2 changes: 2 additions & 0 deletions src/policies/architect-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "architecture,hold"
```

The `[architect]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[architect]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Architect can PR: package reorganization, interface extraction, dependency inversion, dead code removal.
Architect must NEVER: merge any PR, remove `hold` label, make feature additions or behavior changes.

Expand Down
2 changes: 2 additions & 0 deletions src/policies/ci-maintainer-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "ci"
```

The `[ci-maintainer]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[ci-maintainer]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

CI Maintainer can PR: `.github/workflows/*.yml` changes, dependency pinning, runner config, coverage gates.
CI Maintainer must NEVER: merge any PR, modify production source code.

Expand Down
2 changes: 2 additions & 0 deletions src/policies/ci-maintainer-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "ci,hold"
```

The `[ci-maintainer]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[ci-maintainer]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

CI Maintainer can PR: dependency pinning, runner config, coverage gates, and composite
actions under `.github/actions/`.
CI Maintainer can NOT PR `.github/workflows/*.yml` in this mode: its
Expand Down
2 changes: 2 additions & 0 deletions src/policies/guide-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "documentation"
```

The `[guide]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[guide]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Guide can PR: README updates, CONTRIBUTING improvements, architecture docs, getting-started guides, API docs.
Guide must NEVER: merge any PR, create PRs that touch source code.

Expand Down
2 changes: 2 additions & 0 deletions src/policies/guide-holdgated.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ hive-open-pr --repo "$HIVE_REPO" \
--label "documentation,hold"
```

The `[guide]` PR title above is hive's house style, used when the target repository states no convention of its own. If the repository enforces a PR title format (a Conventional Commits gate, or a rule in its AGENTS.md/CONTRIBUTING), follow the repository's format and drop the `[guide]` prefix — the prefix is load-bearing only for ISSUE titles (lane routing), never for PR titles.

Guide can PR: README updates, CONTRIBUTING improvements, architecture docs, getting-started guides, API docs.
Guide must NEVER: merge any PR, remove `hold` label, create PRs that touch source code.

Expand Down
Loading
Loading