Repository navigation
🐛 [v6] contribute: a role-delegated task's guidance carries the assigned repo's AGENTS.md and the issue's relevant knowledge - #17315
Conversation
…ned repo's AGENTS.md and the issue's relevant knowledge The role guidance from hivecommons#17310 knew only the role, so it carried no "# Relevant Knowledge" section and always injected the role's primary repository's AGENTS.md and skills, whatever repository the task was in. BuildAgentGuidanceForTask(role, issue) now primes knowledge from the one assigned issue through a side-effect-free core (renderKnowledge) that records no kick summary or primed slugs for the resident agent, and reads AGENTS.md and skills from agentsRepoRoot(issue.Repo), falling back to the primary repo when the task names none. Both callers (role- delegated selection and standby dispatch) pass the task. Resident kicks are byte-identical. Refs hivecommons#17310 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[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 |
Review follow-ups (below
|
There was a problem hiding this comment.
Docs-currency pass at ac7feb9. The new "What a contributor receives in a role" text matches the code (extractKeywords uses labels + title words, kick_priming.go:529-554; roleGuidance.instructionsRepo falls back to primary, role_guidance.go:30-39), and the moved templates.go:341-346 cite lands on the filterByLane block. Two small advisories, neither blocking:
-
src/docs/agents-md.md:30-31now describes only one of two paths. It still says "The kick reads the primary repo'sAGENTS.md", with no mention that a role-guidance render (templates.goagentsRepoRoot(guidance.instructionsRepo(primaryRepo))) reads the assigned task's repo. An operator reading the AGENTS.md page to learn which repo's file is injected will not find the new rule.never another repo's. A resident kick reads the **primary repo's** `AGENTS.md`, since that is the repo the kick's instructions are about. A contributor's role guidance reads the **assigned task's repo** instead (falling back to primary when the task names none); see [What a contributor receives in a role](contributor-trust-and-roles.md#what-a-contributor-receives-in-a-role). -
src/docs/contributor-trust-and-roles.md:136lists the lookup order as "project.checkouts_dirfirst, then the GitHub copy", skipping thepolicies.local_dirstep thatagentsRepoRoottries in between (kick_priming.go:45-52; the PR body lists all three). Since the sentence says "the same way as for a resident kick", consider either adding the middle step or linking toagents-md.md, which already documents the full order.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Security perspective (read at head Checked: One advisory (low, non-blocking):
--- a/src/pkg/scheduler/kick_priming.go
+++ b/src/pkg/scheduler/kick_priming.go
@@ func (s *Scheduler) primeKnowledgeStats(agentName string, issues []github.Issue) knowledgeInjection {
- inj, slugs := s.renderKnowledge(primer, cfg, agentName, issues[:limit])
+ inj, slugs := s.renderKnowledge(primer, cfg, agentName, issues[:limit], true)
@@ func (s *Scheduler) primeKnowledgeForTask(agentName string, task github.Issue) knowledgeInjection {
- inj, _ := s.renderKnowledge(primer, cfg, agentName, []github.Issue{task})
+ // A contributor is not the resident agent: unreviewed drafts stay resident-only.
+ inj, _ := s.renderKnowledge(primer, cfg, agentName, []github.Issue{task}, false)
@@
-func (s *Scheduler) renderKnowledge(primer *knowledge.Primer, cfg *config.Config, agentName string, issues []github.Issue) (knowledgeInjection, []string) {
+func (s *Scheduler) renderKnowledge(primer *knowledge.Primer, cfg *config.Config, agentName string, issues []github.Issue, allowDrafts bool) (knowledgeInjection, []string) {
@@
- if knowledge.ListsDraft(sc.IncludeStates) {
+ if allowDrafts && knowledge.ListsDraft(sc.IncludeStates) {
agentScope.DraftAuthors = kickDraftAuthors(cfg, agentName)
}(If drafts are intended for contributors too, a sentence in the doc line above would settle it.) Evidence bundle `#17315ac7feb9` sha256:ab005046548cc22a20c2432712f6fb247bf057d7dc0f3b06de500f5dee1081cc — download from the dashboard or `hivectl review evidence #17315`. |
|
Quality test-review @ac7feb9 — the behaviour change ships with tests that fail without it; no gap to file.
Not blocking, FYI only: the dashboard tests check 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Summary
A contributor acting as an agent role now gets two things that #17310 left out of the role guidance. The first is the
# Relevant Knowledgesection, primed from their one assigned issue. The second is theAGENTS.mdand skills of the repository that issue is in. Before this change, the guidance had no knowledge section at all, and it always carried the role's primary repository'sAGENTS.md, whatever repository the task was in. Priming for a contributor records nothing for the resident agent. Resident kicks are byte-identical (the #17310 goldens still pass).Refs #17310
What went wrong
#17310 swapped the resident agent's whole kick for the role's guidance (
Scheduler.BuildAgentGuidance(role)). The guidance knew only the role, not the task, so two parts of the role prompt were wrong:AGENTS.mdand skills were read fromagentsRepoRoot(primaryRepo). On the projectbluefin hive, kylerankin acting as scanner worked on Hive acceptance infrastructure: automate Utah boot and runtime evidence before landing system changes projectbluefin/common#1614 and on finpilot#636. Both prompts carried the instructions of scanner's primary repository, not those ofcommonorfinpilot.What changes
Scheduler.BuildAgentGuidanceForTask(role, task github.Issue)takes the assigned issue: its repository, number, title, body and labels.BuildAgentGuidance(role)stays, as the form with no task.roleKickPrompt(role, task)builds the issue from what each caller already holds. For a role-delegated assignment (contribute_select.go), that is the chosen candidate's repository, number, title, body and labels. For standby dispatch (contribute_standby_dispatch.go), it is the ready-queue item's repository, number, title and labels.primeKnowledgeStatsis split:renderKnowledgeis the shared core. It runs the query, the role's knowledge scope, the kick context and the byte cap. It records nothing.primeKnowledgeStats, records the kick summary and primed slugs exactly as before.primeKnowledgeForTaskcalls only the core.The query itself has no usage counter to skip:
PrimeForKickreads usage counts for ranking but never writes them. The only per-agent state it touches is the cap-log dedupe key, which only picks a log level.AGENTS.mdand skills come from the task's repository. They are read fromagentsRepoRoot(task.Repo). That uses the same sources as a resident kick (acheckouts_dircheckout, thenpolicies.local_dir, then the GitHub copy viaSetAgentsMdFetcher) and the same size caps. If the task names no repository, the primary repository is used, as today.${WRITING_GUIDE}already renders in guidance mode. A test now pins it.Files
src/pkg/scheduler/role_guidance.go:BuildAgentGuidanceForTask, and theroleGuidancevalue that carries the task into the render.src/pkg/scheduler/templates.go:substituteTemplatetakes*roleGuidanceinstead of a bool (nil means a resident kick). It primes from the task and picks the instructions repository.src/pkg/scheduler/kick_priming.go:renderKnowledge(the core) andprimeKnowledgeForTask.src/pkg/dashboard/contribute_agent_roles.go,contribute_select.go,contribute_standby_dispatch.go,deps.go: the task is passed through, and the interface method becomesBuildAgentGuidanceForTask.src/docs/contributor-trust-and-roles.md: "What a contributor receives in a role" now covers both points.src/docs/labels-and-control-signals/reference.md: one line cite moved by 3 lines.changelog.d/fixed-role-guidance-task-knowledge.md.Tests
New tests. Each one failed on the v6 tip (a5c5117) and passes here:
TestBuildAgentGuidanceForTaskCarriesTaskRepoAndIssueKnowledge(scheduler; scanner and quality). For a task indocs(not the primary repoconsole), the guidance has# Relevant Knowledgewith the fact matching the issue,docs'AGENTS.mdand notconsole's, and the writing guide. It has none of the resident-only text from 🐛 [v6] contribute: a role-delegated task carries the role's guidance, not the resident agent's work list #17310's list. The resident agent gets no kick summary, no primed slugs and no classified journeys. On the tip, with a shim that ignores the task: missing Relevant Knowledge, missing the task fact, missing the task repo'sAGENTS.md, and it carried the primary repo's. Forcing the guidance path onto the recording primer makes the kick-summary and primed-slugs assertions fail, so they catch what they should.TestRoleDelegatedTaskGuidanceCarriesTaskRepoAndIssueKnowledge(dashboard; scanner and quality, throughselectTask) andTestStandbyDispatchGuidanceCarriesTaskRepoAndIssueKnowledge(dashboard, throughAutoDispatchStandby). Both check for the task repo'sAGENTS.md, the issue's knowledge and no primary-repoAGENTS.md. They reuse 🐛 [v6] contribute: a role-delegated task carries the role's guidance, not the resident agent's work list #17310's counting scheduler and its banned-text list (MERGE-ELIGIBLE, CI-FAILING, ACTIONABLE ISSUES, ACTIONABLE PRs, hive-merge, Begin now, RED MAIN …), so there are no resident kicks and no classified journeys. On the tip, both fail on the same four assertions.TestBuildAgentGuidanceForTaskWithoutRepoFallsBackToPrimarypins the fallback (it passes on the tip too, by design).TestResidentKickGoldensUnchangedand 🐛 [v6] contribute: a role-delegated task carries the role's guidance, not the resident agent's work list #17310's guidance tests still pass.Full runs:
go test ./pkg/dashboard/... ./pkg/scheduler/... ./pkg/policies/...,go veton the same packages,check-docs-citations.py,check-docs-links.py.🤖 Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1