Skip to content

Triage: a defined team mapping is exhaustive - #339

Merged
theletterf merged 4 commits into
mainfrom
triage-team-mapping-exhaustive
Sep 15, 2026
Merged

theletterf merged 4 commits into
mainfrom
triage-team-mapping-exhaustive

Conversation

@theletterf

@theletterf theletterf commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

While rewriting the docs-content team mapping down to three teams (elastic/docs-content#8297), I hit a gap in Step 3 of the triage prompt that the caller-side fix could only paper over.

Step 3 closes the board-metadata taxonomy:

Board metadata. Only when the instructions define such labels … If the instructions define none, select none; do not infer a board taxonomy from label names alone.

But it leaves the team taxonomy open:

Team. Cross-reference .github/CODEOWNERS and the instructions with the menu to find the owning team's label.

For board metadata the instructions are the sole authority. For team, CODEOWNERS is an independent authority. So @elastic/docs-engineering in CODEOWNERS plus Team:DocsEng on the label menu is a perfectly legitimate match that no instruction ever authorized — and a repo that has deliberately narrowed its team set has no way to say "not that one."

I think the asymmetry is unintentional rather than deliberate, so this makes the two rules consistent. When the instructions define a team mapping, the mapping is exhaustive: never select a team label it does not name, and select no team label when CODEOWNERS names a team the mapping does not map.

Blast radius

Deliberately narrow. The rule binds only when the instructions define a team mapping, so repos without one are untouched:

Caller Team mapping? Effect
docs-content (docs-triage.yml, docs-ai-menu.yml) yes, after #8297 mapping becomes binding
docs-content-internal (same two) yes, after elastic/docs-content-internal#1794 mapping becomes binding
docs-eng-team (docs-triage.yml, docs-auto-triage.yml) no — type taxonomy only unchanged
oblt-aw (docs-aw-ai-menu.yml) no unchanged
docs-actions-test-caller no unchanged

Applied to both issue-triage and issue-auto-triage, which carried the identical rule. Prompt-only: the lock diff is the metadata hash plus one GH_AW_PROMPT_CONTENT line, with no frontmatter change. Locks recompiled with the pinned gh-aw v0.88.7, no warnings.

Why it is worth doing even though the caller fix works

I shipped the docs-content mapping with three overlapping prose guardrails — a "never select a retired team label" sentence naming all seven, a CODEOWNERS-team-to-label resolution table, and a "never substitute a retired label" sentence. A five-issue sandbox battery passed clean, so the prose works today. But it is prose, on Haiku, and the enumeration names seven labels that will be wrong the moment someone adds an eighth.

With this rule in place, the per-repo files can drop the enumeration entirely and just list the teams they do use.

Testing

The sandbox is currently sitting in an ablated state on purpose: bare three-row mapping, no prose guardrails, and Team:DocsEng / Team:Ingest / Team:Projects left on the menu as decoys. That is the ideal test bed for this rule specifically. I am pointing test-manual-triage.yml at this branch and re-running the two leak-path issues — a CI build crash that CODEOWNERS routes to @elastic/docs-engineering, and a get-started issue it routes to @elastic/core-docs. If they come back with no team label using only the bare mapping, that isolates this change as the cause.

I will post the run IDs and requested labels here before marking this ready.

🤖 Generated with Claude Code

Related to #398

Step 3 closed the board-metadata taxonomy ("if the instructions define
none, select none") but left the team taxonomy open, treating CODEOWNERS
as an independent authority. A team label on the menu could therefore be
selected because CODEOWNERS pointed at the owning GitHub team, with no
instruction authorizing it.

Make the two rules consistent: when the instructions define a team
mapping, never select a team label the mapping does not name, and select
no team label when CODEOWNERS names a team the mapping does not map.

Repos with no team mapping are unaffected, so docs-eng-team, oblt-aw,
and docs-actions-test-caller keep their current behavior.

Applied to both issue-triage and issue-auto-triage, which shared the
identical rule. Prompt-only change; locks recompiled with gh-aw v0.88.7.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@theletterf

Copy link
Copy Markdown
Member Author

Sandbox A/B: the rule changes behavior

Tested as an A/B in elastic/docs-actions-sandbox. Both arms ran the same deliberately minimal instructions — a bare three-row team mapping, with the retired-label prose and the CODEOWNERS resolution table removed, so the only thing that could stop a wrong pick was the workflow itself. Team:DocsEng, Team:Ingest, and Team:Projects stayed on the label menu as decoys. The only variable between arms was this branch.

Each run was classified from its own aw-prompts/prompt.txt (was the rule present?) and agent-stdio.log (did the agent actually fetch the decoys?). Runs whose menu came back without the decoys prove nothing and were discarded.

Arm Usable Leaked a retired label
Treatment — this branch 2 0
Control — @v1 3 1 (Team:DocsEng)

Control leak, run 34962563018, on "Nightly docs build workflow silently skips the link checker step" (.github/workflows/ → @elastic/docs-engineering). Requested ["triaged","bug","Team:DocsEng"]. Its reasoning is the useful part:

Looking at the triage-instructions, I don't see a direct mapping for "Team:docs-engineering" … None of these match docs-engineering. However, looking at the CODEOWNERS file: /.github/workflows/ → @elastic/docs-engineering. But the triage-instructions only defines: Team:SKI, Team:Admin, Team:Developer.
The safe-outputs allows these team labels: Team:Admin, Team:Developer, Team:DocsEng, Team:Experience, Team:Ingest, Team:SKI, Team:Projects. Team:DocsEng is the appropriate …

It reached the right conclusion — the mapping does not cover docs-engineering — and then overrode it, using the safe-outputs allow-list as a competing authority. That is a third side door I had not considered when I opened this: not CODEOWNERS, not the repository label list, but the safe-outputs config surfaced in the prompt. This rule closes it, because it makes the mapping exhaustive rather than any particular menu.

Treatment passes for contrast — decoys plainly on the menu, no team label applied:

  • 34961374303, nav-rendering issue: Team:DocsEng ×35, Team:Ingest ×9, Team:Projects ×5 in the log → ["triaged","bug"]
  • 34962031844, get-started issue: Team:DocsEng ×11, Team:Projects ×5 → ["triaged","documentation"]

The second is the sharper one: a get-started issue is exactly what the old six-team mapping routed to Team:Projects, and that label was on its menu five times.

Honest limits

Small n — 2 treatment and 3 control usable samples, one observed leak. This shows the rule prevents a leak that demonstrably happens without it; it does not establish a leak rate. Four of six treatment runs were discarded because the agent never fetched the decoys, which is the same underlying flakiness described in the issue linked below.

Corrections to this PR's original description

  • I claimed the sandbox was "the ideal test bed" and that a clean run would isolate this change as the cause. That was too strong: whether the decoys enter the menu at all is stochastic, so it only holds for runs where the log proves they did. That is why runs are now screened before counting.
  • My first attempt at this test read as a clean pass and was worthless — the decoys were never fetched in that run. Verifying the mechanism fired is now part of the procedure.

I also want to flag that the caller-side fix in elastic/docs-content#8297 is not made redundant by this. Its resolution table was cited by name by the agent in run 34952784103 as its reason to omit the label, and it works today against the released v1. This rule is what lets that file later drop the retired-label enumeration, which is its most drift-prone part.

Marking ready for review.

@theletterf
theletterf marked this pull request as ready for review September 15, 2026 11:25
@theletterf
theletterf requested a review from a team as a code owner September 15, 2026 11:25
@theletterf
theletterf requested a review from akira28 September 15, 2026 11:25

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — no actionable issues found in this PR.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Fixes #340. Step 1 asked the agent to list the repository's labels and
treat the result as the menu. Across nine sandbox runs it did that four
different ways: full enumeration, partial confirmation, inference from
other issues' labels, and reading the safe-outputs config. One of those
menus contained a label that does not exist in the repository.

Move the fetch out of the agent. A pre-agent step runs gh label list and
writes the result to /tmp/gh-aw/agent/label-menu.txt, one name per line.
Step 1 now reads that file, forbids rebuilding the menu any other way,
and falls back to the GitHub read tools only if the file is missing.

Applied to both issue-triage and issue-auto-triage. Compiled with gh-aw
v0.88.7, zero warnings.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@theletterf

Copy link
Copy Markdown
Member Author

Second commit (7c1bf80): fix for #340

The A/B above burned four of six treatment runs because the agent never fetched the decoy labels. #340 documents why: Step 1 asked the agent to enumerate the repository's labels, and it did that four different ways across nine runs, one of which produced a menu containing a label that does not exist in the repo.

This commit moves the fetch out of the agent entirely. A pre-agent step in the agent job runs gh label list --limit 500 and writes the names to /tmp/gh-aw/agent/label-menu.txt. Step 1 now reads that file, names the three wrong strategies explicitly — other issues' labels, the safe-outputs config, memory — and forbids them, with a fallback to the GitHub read tools only if the file is missing or empty.

Why a file and not prompt interpolation: gh-aw renders the prompt in the activation job, but custom steps: run in the agent job, so a step output cannot reach the prompt. A file written in the agent job before the CLI starts can. Read is already in the agent's allowed tools, and /tmp/gh-aw/agent/ is the compiler's own recommended temp root — it warned on plain /tmp/ and I followed it.

Blast radius: every triage and auto-triage caller, since the step runs unconditionally. It needs only issues: read on github.token, which every caller already grants. Fail-safe: if the step fails, the fallback restores today's behavior.

Both READMEs updated. Testing in the sandbox next — success criterion is every run's log showing the file read and the full menu, no discards.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread .github/workflows/gh-aw-issue-triage.md Resolved
@theletterf

Copy link
Copy Markdown
Member Author

Sandbox results for the #340 fix (commit 7c1bf80)

Four runs on this branch — two manual (/triage on #124 and #125 with labels stripped first), two auto (issues: opened on #135 and #136). Both callers pointed at @triage-team-mapping-exhaustive; instructions were the full shipped docs-content text.

Run Path Step output Menu file read list_label called All 6 Team:* visible Requested labels
34964213814 manual, CI crash Resolved 33 labels 1× 0 yes triaged, bug, priority:high
34964217706 manual, get-started Resolved 33 labels 1× 0 yes triaged, bug, priority:high
34964220095 auto, Discover 9.2 regression Resolved 33 labels 1× 0 yes triaged, bug, Team:SKI, priority:high, release:9.2
34964223023 auto, snapshot readonly Resolved 33 labels 1× 0 yes triaged, documentation, Team:Admin

Zero discards. Before this commit, four of six treatment runs had to be thrown out because the agent never loaded the decoy labels; here every run read the complete 33-label menu via exactly one Read call and made no GitHub label API calls at all. Routing was correct in all four: the two infra/get-started issues got no team label, the Kibana issue went to Team:SKI (plus release:9.2, which the body names), and the snapshot issue to Team:Admin.

Menu-file read and list_label counts come from tool_use blocks in each run's agent-stdio.log, not substring matches — a naive grep for list_label hits the tool manifest and is a false positive.

Both sandbox callers are back on @v1. Companion registry PR: elastic/docs-ai-tools#11.

@theletterf theletterf self-assigned this Sep 15, 2026
@theletterf theletterf added the fix label Sep 15, 2026
Review caught that gh label list --limit 500 would hand the agent a
non-empty but truncated menu on repositories with more than 500 labels,
while Step 1 promises the file is complete and skips the fallback
whenever it is non-empty. Use gh api --paginate so every page is read.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@theletterf

Copy link
Copy Markdown
Member Author

Sandbox check for bf3b457 (the pagination change), manual /triage on sandbox #126 with labels stripped first — run 34965715434: step logged Resolved 33 labels, agent made exactly one Read of /tmp/gh-aw/agent/label-menu.txt and zero label API calls, all six Team:* labels visible in the log, requested ["triaged","bug","priority:high"] for a CI issue (correctly no team). Same behavior as before the switch; the export path change is transparent to the agent. Sandbox caller restored to @v1.

Review caught that "any existing label is eligible" contradicted the
new exhaustive team-mapping rule in Step 3.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@theletterf
theletterf merged commit 346049c into main Sep 15, 2026
8 of 9 checks passed
@theletterf
theletterf deleted the triage-team-mapping-exhaustive branch September 15, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant