Skip to content

Encourage repository-scoped related-issue search in triage - #202961

Closed
drisspg wants to merge 6 commits into
gh/drisspg/468/basefrom
gh/drisspg/468/head
Closed

drisspg wants to merge 6 commits into
gh/drisspg/468/basefrom
gh/drisspg/468/head

Conversation

@drisspg

@drisspg drisspg commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Human Note

Lets find dup issues

Agent Notes

Why

A useful duplicate search needs room to refine a bad query and inspect the evidence. Keep the
existing GitHub search tool rather than introduce a separate duplicate detector, while preventing
the model from expanding its search into unrelated repositories.

What happens

The workflow owns the repository and source issue. The tool rejects scope overrides and unquoted
OR/grouping before calling GitHub, then filters the response to same-repository issues, excluding
PRs and the source. It returns at most 10 summaries; bodies and comments use the existing read tools.

flowchart TD
    Q["Model chooses a query"] --> G{"Scope checks pass?"}
    G -->|No| E["Reject before calling GitHub"]
    E --> Q
    G -->|Yes| S["Read-only repository-scoped search"]
    S --> F["Filter identities; return at most 10 summaries"]
    F --> M{"Useful candidates?"}
    M -->|No| B["Model can broaden or refine"]
    B --> Q
    M -->|Yes| R["Model reads candidate bodies and comments"]
    R --> P["Use evidence in the triage plan"]
Loading

Query checks and response filtering are enforced in code. Refinement and candidate reads are skill
guidance, not guaranteed model behavior. Search never grants permission to close an issue.

Scenario Outcome
Operator/error/label query in the workflow repository Return candidate summaries for inspection.
Repository override or unquoted OR query Reject it before making a GitHub request.
Empty results or similar titles only Refine or gather context; do not infer absence or duplication.

Same-repository issue text is still untrusted. This reduces external-repository exposure; it is not
prompt-injection immunity or an exhaustive duplicate search.

Test Plan

python3 -m unittest discover -s scripts/issue_triage_pi -v
PI_TEST_RUNTIME="$HOME/.npm-global/lib/node_modules/@earendil-works/pi-coding-agent" node --test .github/pi/tests/github-issue-tools.mjs

The search layer passes 82 Python tests and 4 Node tests. The local Node command uses Pi 1.4.0; pinned-runtime CI is linked below.

Current PyTorch PR test job. The Python suite also runs in triage preparation, before the model.

Validation

Earlier full-stack ciforge CI passed with Pi 0.99.1: 4 search tests and 108 full-stack Python tests.

Read-only replay retrieved previously missed #69512 for #202948 and kept the source open. The model did not read that candidate’s body/comments, so follow-up remains incomplete. This is limited retrieval evidence, not a general recall or prompt-injection-resistance result.

Linked issue or supporting maintainer

Triage-tooling follow-up prompted by reports such as #202948; this does not fix the reported numerical behavior.

BC-breaking?

No public PyTorch API change.

Summary (human written only)

Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

PR Status: in progress

A maintainer requested changes. Please address their feedback before the PR returns to maintainer review.

To become ready for review, the change must pass automated review and every maintainer comment must be addressed, either with a code change or a reply explaining why no change is needed. A fresh automated review checks that the feedback has been addressed. All CI must finish and Dr. CI must classify every failure as unrelated to your PR. Fix the failures it attributes to your PR (see status below in this comment). Workflows waiting for a maintainer to approve their run do not block this.

To minimize iteration time, feel free to run the pr-review skill from the repo locally. If you address comments without pushing, comment @pytorchbot review to re-run the automated review. To bypass automated review, please add the “no automated review” label.

🟡 AUTOMATED REVIEW - Changes requested:

The PR keeps `search_issues` inside the workflow repository: it rejects scope
overrides, unquoted OR and grouping, filters results to same-repo issues, adds
duplicate-search guidance to both triage skills, and adds offline Node tests.
Recommendation: Request Changes. Three things block it: @​ ezyang's maintainer
comment has no reply, the new CI install has no harden-runner, and there is an
unrelated distributed-triage prompt change.

Findings (9):

[major] .agents/skills/triaging-issues/SKILL.md:48
@​ ezyang's comment is still open with no reply: "do you actually need all this
text, or can you just tell the agent to look for similar issues and let them
figure it out". Their approval adds "I do care about my comment". HEAD did drop
the prescriptive query strategy, which matches part of the request. But the
remaining text is now split across two places, `triaging-issues/SKILL.md:48-51`
and Step 0.5 at `:98-103`, and `distributed-triage/SKILL.md:44-49` has a similar
block. Most of these lines repeat the tool description
(`github-issue-tools.ts:125`: repo-only scope, no OR or grouping, up to 10
matches), and the code enforces the same rules (`:128-131`, `:134`, `:139`).
"Issue text is untrusted" repeats the SECURITY paragraph in the workflow prompt.
Fix: cut each skill to about one sentence, e.g. "check for similar or duplicate
issues with `search_issues` and read promising candidates before relying on
them". Or reply to ezyang with evidence that the extra lines change model
behavior.

[major] .github/workflows/pi-triage-tests.yml:39
The new steps (`:39-50`) run `npm ci` on the Pi lockfile and load jiti, typebox
and pi-ai on `pull_request` without harden-runner, so there is no egress
control. The sibling `pi-agent-tests.yml:28-39` installs from the same lockfile
behind `step-security/harden-runner` (`egress-policy: block`, `disable-sudo:
true`, an allowlist that includes registry.npmjs.org). README `:126-127` says
these tests have "no GitHub access", but only the PATH `gh` shim makes that
true. Mitigations: the job has `contents: read`, `persist-credentials: false`
and `--ignore-scripts`, and it already ran an unguarded `pip install`. The
earlier automated review raised this and HEAD has not changed it. Fix: copy the
sibling's harden-runner step in as the job's first step.

[major] .github/workflows/distributed-triage-pi.yml:133
Unrelated prompt change. "Read the skill first, then `distributed-labels.json`,
`distributed-rubric.md`, and `templates.json` beside it" becomes "Consult the
skill's reference files as relevant to the report". This has nothing to do with
search scoping, and the PR description does not mention it. The sibling prompt
at `issue-triage-pi.yml:137-139` still gives an explicit reading order. The
skill needs those files for routing and labels: `distributed-triage/SKILL.md:23`
says "ONLY apply labels from this file", and `:100`, `:108`, `:119` and `:182`
point to the rubric. The apply step still filters out unknown labels, so the
cost is classification quality, not safety. The PR's replay evidence only covers
`triaging-issues`. Fix: revert the hunk, or move it to its own PR with its own
validation.

[minor] .agents/skills/triaging-issues/SKILL.md:100
A duplicate the model finds has nowhere to go. Both skills now tell the model to
check for duplicates, but neither `.github/pi/schemas/issue-triage-plan.json`
nor the distributed plan schema has a duplicate decision, field, label or
template. `reasoning` only reaches the job log and step summary
(`apply_plan.py:156-161`, `:407`), so a confirmed duplicate never appears on the
issue, even though the PR's stated goal is "Lets find dup issues". Step 0.5 can
also never be the plan's `decision`. Fix: say explicitly where candidate numbers
should go (e.g. `reasoning`, and update that field's description), or add an
output that surfaces them. If neither is wanted, state that this is deferred.

(5 more not shown, see the review run)

Reviewed commit: b2de164

Review run

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/202961

Note: Links to docs will display an error until the docs builds have been completed.

❌ 2 Unclassified Failures

As of commit b2de164 with merge base 78def3c (image):

🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:

  • Trust boundary
    • search_issues in .github/pi/extensions/github-issue-tools.ts gains new query rejection and response-identity filtering that scope an LLM tool to TRIAGE_REPO
    • Security and trust-boundary logic for a model-facing tool is never trivial, whatever its tests show
  • Agent steering
    • Both .agents/skills/distributed-triage/SKILL.md and .agents/skills/triaging-issues/SKILL.md add new search and duplicate-judgment instructions for the triage model
    • Changes what an automated agent does on live issues, so it needs a human to sign off
  • CI and workflow plumbing
    • pi-triage-tests.yml adds setup-node and an npm ci install step, and pi-triage-plan.yml binds a new TRIAGE_SOURCE_ISSUE env
    • New non-trivial logic, with a hand-rolled gh fixture harness in .github/pi/tests/github-issue-tools.mjs, falls outside every trivial class

reason: not_trivial
Reviewed commit: 70a78ab (NOT the current head b2de164)

Inference job

🐛 Report a wrong verdict

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
@drisspg drisspg changed the title Add bounded read-only duplicate discovery for triage Encourage repository-scoped related-issue search in triage Nov 2, 2026
[ghstack-poisoned]
[ghstack-poisoned]
@drisspg
drisspg marked this pull request as ready for review November 2, 2026 17:24
@drisspg
drisspg requested a review from a team as a code owner November 2, 2026 17:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T17:26:35.468234Z 70a78ab Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Nov 2, 2026
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Nov 2, 2026
github-actions[bot]

This comment was marked as outdated.

Comment thread .agents/skills/triaging-issues/SKILL.md Resolved

@ezyang ezyang 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.

approving because you shouldn't be blocked but I do care about my comment

[ghstack-poisoned]
@pytorchgreenlight pytorchgreenlight Bot added GL/superseded GreenLight review is superseded by changes and removed GL/human GreenLight marked as needing human review labels Nov 2, 2026
github-actions[bot]

This comment was marked as outdated.

[ghstack-poisoned]

@github-actions github-actions 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.

Automated review of b2de164: changes requested before human review.

The PR keeps search_issues inside the workflow repository: it rejects scope overrides, unquoted OR and grouping, filters results to same-repo issues, adds duplicate-search guidance to both triage skills, and adds offline Node tests. Recommendation: Request Changes. Three things block it: @ ezyang's maintainer comment has no reply, the new CI install has no harden-runner, and there is an unrelated distributed-triage prompt change.

🔴 3 blocking findings are attached to the code below.

⚪ 6 non-blocking findings

For each issue not skipped in Step 0, check for duplicates as part of triage. `search_issues`

A duplicate the model finds has nowhere to go. Both skills now tell the model to check for duplicates, but neither .github/pi/schemas/issue-triage-plan.json nor the distributed plan schema has a duplicate decision, field, label or template. reasoning only reaches the job log and step summary (apply_plan.py:156-161, :407), so a confirmed duplicate never appears on the issue, even though the PR's stated goal is "Lets find dup issues". Step 0.5 can also never be the plan's decision. Fix: say explicitly where candidate numbers should go (e.g. reasoning, and update that field's description), or add an output that surfaces them. If neither is wanted, state that this is deferred.


const syntax = query.replace(/"(?:\\.|[^"\\])*"/g, " ");

(Low confidence) The quoted-phrase regex /"(?:.|\[^"\])*"/g accepts backslash escapes. For "x" OR y" it strips the whole string as one phrase, so the OR check passes. If GitHub issue search does not honor ", GitHub sees the phrase "x" followed by a bare OR. That contradicts README :118-120 ("rejects unquoted OR before calling GitHub"). The identity filter still drops results from other repositories, so the cost is foreign hits filling the 10 slots, not a leak. Fix: use /"\[^"\]*"/g; any leftover `` or " then hits the existing rejection.


const sourceIssue = Number(process.env.TRIAGE_SOURCE_ISSUE ?? 0);

TRIAGE_SOURCE_ISSUE is read without validation. Number(process.env.TRIAGE_SOURCE_ISSUE ?? 0) gives NaN for a non-numeric value, and the exclusion then silently does nothing. TRIAGE_REPO, by contrast, throws on bad input (:69-71). Current callers always pass integers, so this is not reachable today. Fix: throw unless the value is empty or a positive integer, and do the same for TRIAGE_REPLAY_ISSUE at :30.


result.items.slice(0, 10).filter((item: any) => {

Result-limit cleanups (:125, :134, :139). The literal 10 appears three times, while the file names its other limits (MAX_BODY, MAX_COMMENT, MAX_COMMENTS at :24-26). With per_page=10, slice(0, 10) runs before the source and replay issues are removed. A query built from the source issue's own text is likely to match it, so the model often gets 9 results or fewer. repositoryUrl (:141) and the expected html_url prefix (:146) are rebuilt for every item. Fix: add a MAX_SEARCH_RESULTS constant, request a few more than the cap, filter, then slice. Compute both URL prefixes once, next to sourceIssue.


const issue = (number, overrides = {}) => ({

The new tests leave several branches untested. (1) The issue() fixture (:48-57) never sets repository_url, though real search responses always include it. The present-and-matching branch at github-issue-tools.ts:145 is never exercised, so a bug there could make every live search return [] with all tests green. Add repository_url: "(link removed) to the default fixture. (2) No case has a backslash inside quotes (e.g. "x" OR y"), so the escape behavior is not pinned. (3) Parentheses are only tested as '(DTensor OR CUDA)' (:122), which the OR rule also rejects, so removing ()from the grouping regex would leave the test green. Add(DTensor)`. (4) No fixture returns more than 10 items, so the documented cap is never tested.


description: `Search issues only in ${repo} (e.g. "flex attention backward is:open"). Use separate calls instead of OR; repo/org/user qualifiers and grouping are not allowed. Returns up to 10 matches.`,

The query rules are stricter than the tool description says (:125, :129-131). /bORb/i also rejects lowercase or, which GitHub treats as an ordinary term; "DTensor or CUDA" is asserted unsafe at mjs:121, so this is deliberate. Bare (, ) and `` are rejected anywhere outside quotes, yet they are common in PyTorch searches (e.g. torch.cat(), `aten::foo(`, "expected Tensor or tuple"). The `repo|org|user:` check runs on the raw query, so it also rejects a quoted phrase containing `user:`. The description only mentions OR and "grouping", and the error does not tell the model to quote such terms. The model will hit rejections it cannot predict and burn calls retrying. Fix: narrow the checks (uppercase OR only), or document them in the description and error, e.g. "quote terms containing parentheses, backslashes, or the word or".

Please address the findings and push; a new commit normally gets a fresh automated review.

This review is AI-generated and advisory. Each new automated review replaces the previous one.

| `read`, `grep`, `find`, `ls` | This skill's files |
| `submit_result` | The triage plan (required, call once as your last action) |

Search covers titles, bodies, and comments by default, within the workflow's repository.

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.

🔴 @ ezyang's comment is still open with no reply: "do you actually need all this text, or can you just tell the agent to look for similar issues and let them figure it out". Their approval adds "I do care about my comment". HEAD did drop the prescriptive query strategy, which matches part of the request. But the remaining text is now split across two places, triaging-issues/SKILL.md:48-51 and Step 0.5 at :98-103, and distributed-triage/SKILL.md:44-49 has a similar block. Most of these lines repeat the tool description (github-issue-tools.ts:125: repo-only scope, no OR or grouping, up to 10 matches), and the code enforces the same rules (:128-131, :134, :139). "Issue text is untrusted" repeats the SECURITY paragraph in the workflow prompt. Fix: cut each skill to about one sentence, e.g. "check for similar or duplicate issues with search_issues and read promising candidates before relying on them". Or reply to ezyang with evidence that the extra lines change model behavior.

- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4

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.

🔴 The new steps (:39-50) run npm ci on the Pi lockfile and load jiti, typebox and pi-ai on pull_request without harden-runner, so there is no egress control. The sibling pi-agent-tests.yml:28-39 installs from the same lockfile behind step-security/harden-runner (egress-policy: block, disable-sudo: true, an allowlist that includes registry.npmjs.org). README :126-127 says these tests have "no GitHub access", but only the PATH gh shim makes that true. Mitigations: the job has contents: read, persist-credentials: false and --ignore-scripts, and it already ran an unguarded pip install. The earlier automated review raised this and HEAD has not changed it. Fix: copy the sibling's harden-runner step in as the job's first step.

the `oncall: distributed` queue. Read the skill first, then `distributed-labels.json`,
`distributed-rubric.md`, and `templates.json` beside it. Finish by calling
`submit_result` with your plan.
the `oncall: distributed` queue. Consult the skill's reference files as relevant

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.

🔴 Unrelated prompt change. "Read the skill first, then distributed-labels.json, distributed-rubric.md, and templates.json beside it" becomes "Consult the skill's reference files as relevant to the report". This has nothing to do with search scoping, and the PR description does not mention it. The sibling prompt at issue-triage-pi.yml:137-139 still gives an explicit reading order. The skill needs those files for routing and labels: distributed-triage/SKILL.md:23 says "ONLY apply labels from this file", and :100, :108, :119 and :182 point to the rubric. The apply step still filters out unknown labels, so the cost is classification quality, not safety. The PR's replay evidence only covers triaging-issues. Fix: revert the hunk, or move it to its own PR with its own validation.

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #202981

pytorchmergebot pushed a commit that referenced this pull request Nov 3, 2026
## Human Note

Often issues come in that match umbrellas, there are 2 types -> close the sub issue and
put inot the main umbrealla, or open up subissues and link back. This supports both

## Agent Notes

### Why

An umbrella can mean two different things: a place to consolidate repeated reports, or a tracker
whose individual reproducers must stay open. Similarity alone cannot tell the bot which action is
appropriate. Put that decision in a checked-in catalog, separate from the model's match judgment.

### What happens

The model proposes an umbrella issue and a `covered` or `uncertain` match. The trusted apply step
validates the source, target and decision, then uses the catalog's `link` or `close` policy. All
writes go to the source issue; the umbrella body, checklist and existing members are untouched.

```mermaid
flowchart TD
    P["Model proposes umbrella and coverage"] --> V{"Reference permitted?"}
    V -->|No| R["Skip or flag for review; no umbrella close"]
    V -->|Yes| C{"Covered, close-enabled, and no review or information stop?"}
    C -->|No| L["Post fixed reference; keep source open"]
    C -->|Yes| W["Post fixed reference and labels"]
    W --> F{"Fresh source and target checks still allow closing?"}
    F -->|No| O["Do not close; flag review where needed"]
    F -->|Yes| D["Close source as duplicate of the validated umbrella"]
```

| Scenario | Policy |
| --- | --- |
| Covered missing-validation hardening report → #195547 | Close is allowed, subject to the safety checks. This is not permission to dismiss ordinary supported public-API failures. |
| Forward-AD derivative report → #198017 | Link only; keep the individual reproducer open. |
| Lost compiled validation → #197554 | Link only; keep the individual report open. |
| Uncertain coverage, review/priority, or pending information/reproduction | Do not close. |
| Invalid target or conflicting close/transfer decision | No umbrella reference; route to review. |
| Already-routed source outside an eligible bot-owned retry, ineligible source, or non-PT2 oncall redirect | Skip the umbrella action. |

A target-specific bot marker avoids repeated comments. For the PT2 case, a pending-close receipt
lets the bot finish its own interrupted operation after adding its routing label, without treating
ordinary preexisting routing as permission to close. Fresh checks still apply on retry. GitHub's
reads and writes are not an atomic transaction.

### Test Plan

```sh
python3 -m unittest discover -s scripts/issue_triage_pi -v
```

95 Python tests pass, including 13 grouped umbrella tests covering source-only writes, target validation, human stops, and retries. The smaller suite still catches the original PT2 first-close and retry failures.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41384203855/job/125081309383). The Python suite also runs in triage preparation, before the model.

## Validation

[Read-only ciforge replay](https://github.com/pytorch/ciforge/actions/runs/41371417099) proposed closing #201797 into #195547, linking #196694 to #198017 while keeping it open, and keeping #202948 open without an umbrella. Apply was skipped; no issues were changed.

<details>
<summary>Live write-path probe and its limitation</summary>

[Real Actions-token write probe](https://github.com/pytorch/ciforge/actions/runs/41339792819) verified linking and duplicate closure with zero-write retries on disposable fixtures. The job failed its obsolete event-based check; subsequent direct API reads confirmed [#704](https://github.com/pytorch/ciforge/issues/704) has `duplicateOf` pointing to [#702](https://github.com/pytorch/ciforge/issues/702). All fixtures were closed and the temporary probe deployment was removed. No existing PyTorch reports were changed. The later PT2-routing receipt fix is covered by local stateful tests, not this live probe.

</details>

## Linked issue or supporting maintainer

Umbrella policy evidence: #195547, #198017, and #197554. This does not modify their existing members.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: #202962
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: #203124, #202961
pytorchmergebot pushed a commit that referenced this pull request Nov 3, 2026
…202981)

## Human Note

Let agents suggest duplicate issues

## Agent Notes

### Why

Finding a likely duplicate should help the reporter, not silently discard their report. Add a
suggestion-only path for ordinary issues: explain the possible match, ask the reporter to check it,
and leave the final decision to them. This is separate from approved umbrella closure policies.

### What happens

After reading a candidate's body and relevant comments, the model can propose
`possible_duplicate: <issue number>`. The trusted apply step validates the reference and posts fixed
copy linking that issue. It keeps the source open and never writes to the candidate, which may
already be open or closed.

```mermaid
flowchart TD
    M["Model reads candidate and proposes possible_duplicate"] --> V{"Source, target and plan are eligible?"}
    V -->|No| R["No duplicate suggestion; skip or flag review"]
    V -->|Yes| B{"Matching bot suggestion already posted?"}
    B -->|Yes| N["Do not repeat the comment"]
    B -->|No| C["Post fixed linked suggestion"]
    N --> O["Keep source open; finish any pending labels"]
    C --> O
    O --> H["Reporter can confirm the match or explain the difference"]
```

| Scenario | Outcome |
| --- | --- |
| Plausible same underlying bug, with candidate context read | Suggest the linked issue and ask the reporter to confirm. No automatic closure. |
| Similar operator/title, or a report that still reproduces after the candidate's fix | Do not infer a duplicate; keep investigating the new report. |
| Self-reference, foreign/PR/unavailable target, catalog umbrella, or conflicting close/umbrella annotation | No ordinary duplicate suggestion; skip or route to review. |
| Retry after comment succeeded but label writing failed | Do not repost; finish the pending labels. |

The comment asks reporters to move any new reproduction details to the linked issue and close
their own issue **only if it is the same problem**. Otherwise they can explain what differs. The
model supplies neither a URL nor free-form comment text; same-repository links and the wording are
constructed by trusted code. Semantic matching still depends on the model and human judgment.

### Test Plan

```sh
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/issue_triage_pi -v
git diff --check
```

106 Python tests pass, including 11 new suggestion tests. The initial comment test and a closed-source skip-fallback regression failed before their fixes and pass afterward.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41384204576/job/125081314456). The Python suite also runs in triage preparation, before the model.

## Validation

Before test consolidation, [pinned-runtime ciforge CI](https://github.com/pytorch/ciforge/actions/runs/41379809233) passed 119 Python tests and 4 search-tool tests with Pi 0.99.1.

[Read-only ciforge replay](https://github.com/pytorch/ciforge/actions/runs/41379809226) searched and read #200935's body/comments, then proposed it as a possible duplicate of #202764 with no automatic closure. The related-only case stayed open, and the two umbrella controls retained their close/link proposals. Apply was skipped; no comments or issue changes were posted.

The positive candidate's comments explicitly confirmed the duplicate relationship, so this is current-context integration evidence, not a blind accuracy benchmark. The related-only case had empty search results. Real-write behavior for this new suggestion path has not been exercised in ciforge; source-only writes and retries are covered by the local tests.

## Linked issue or supporting maintainer

Triage-tooling follow-up; #202764 and #200935 were used as a confirmed duplicate replay case.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: #202981
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: #203124, #202961, #202962
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
…02961)

## Human Note

Lets find dup issues

## Agent Notes

### Why

A useful duplicate search needs room to refine a bad query and inspect the evidence. Keep the
existing GitHub search tool rather than introduce a separate duplicate detector, while preventing
the model from expanding its search into unrelated repositories.

### What happens

The workflow owns the repository and source issue. The tool rejects scope overrides and unquoted
`OR`/grouping before calling GitHub, then filters the response to same-repository issues, excluding
PRs and the source. It returns at most 10 summaries; bodies and comments use the existing read tools.

```mermaid
flowchart TD
    Q["Model chooses a query"] --> G{"Scope checks pass?"}
    G -->|No| E["Reject before calling GitHub"]
    E --> Q
    G -->|Yes| S["Read-only repository-scoped search"]
    S --> F["Filter identities; return at most 10 summaries"]
    F --> M{"Useful candidates?"}
    M -->|No| B["Model can broaden or refine"]
    B --> Q
    M -->|Yes| R["Model reads candidate bodies and comments"]
    R --> P["Use evidence in the triage plan"]
```

Query checks and response filtering are enforced in code. Refinement and candidate reads are skill
guidance, not guaranteed model behavior. Search never grants permission to close an issue.

| Scenario | Outcome |
| --- | --- |
| Operator/error/label query in the workflow repository | Return candidate summaries for inspection. |
| Repository override or unquoted `OR` query | Reject it before making a GitHub request. |
| Empty results or similar titles only | Refine or gather context; do not infer absence or duplication. |

Same-repository issue text is still untrusted. This reduces external-repository exposure; it is not
prompt-injection immunity or an exhaustive duplicate search.

### Test Plan

```sh
python3 -m unittest discover -s scripts/issue_triage_pi -v
PI_TEST_RUNTIME="$HOME/.npm-global/lib/node_modules/@earendil-works/pi-coding-agent" node --test .github/pi/tests/github-issue-tools.mjs
```

The search layer passes 82 Python tests and 4 Node tests. The local Node command uses Pi 1.4.0; pinned-runtime CI is linked below.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41381389439/job/125072767834). The Python suite also runs in triage preparation, before the model.

## Validation

[Earlier full-stack ciforge CI](https://github.com/pytorch/ciforge/actions/runs/41371417559) passed with Pi 0.99.1: 4 search tests and 108 full-stack Python tests.

[Read-only replay](https://github.com/pytorch/ciforge/actions/runs/41371417099) retrieved previously missed pytorch#69512 for pytorch#202948 and kept the source open. The model did not read that candidate’s body/comments, so follow-up remains incomplete. This is limited retrieval evidence, not a general recall or prompt-injection-resistance result.

## Linked issue or supporting maintainer

Triage-tooling follow-up prompted by reports such as pytorch#202948; this does not fix the reported numerical behavior.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: pytorch#202961
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: pytorch#203124
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
## Human Note

Often issues come in that match umbrellas, there are 2 types -> close the sub issue and
put inot the main umbrealla, or open up subissues and link back. This supports both

## Agent Notes

### Why

An umbrella can mean two different things: a place to consolidate repeated reports, or a tracker
whose individual reproducers must stay open. Similarity alone cannot tell the bot which action is
appropriate. Put that decision in a checked-in catalog, separate from the model's match judgment.

### What happens

The model proposes an umbrella issue and a `covered` or `uncertain` match. The trusted apply step
validates the source, target and decision, then uses the catalog's `link` or `close` policy. All
writes go to the source issue; the umbrella body, checklist and existing members are untouched.

```mermaid
flowchart TD
    P["Model proposes umbrella and coverage"] --> V{"Reference permitted?"}
    V -->|No| R["Skip or flag for review; no umbrella close"]
    V -->|Yes| C{"Covered, close-enabled, and no review or information stop?"}
    C -->|No| L["Post fixed reference; keep source open"]
    C -->|Yes| W["Post fixed reference and labels"]
    W --> F{"Fresh source and target checks still allow closing?"}
    F -->|No| O["Do not close; flag review where needed"]
    F -->|Yes| D["Close source as duplicate of the validated umbrella"]
```

| Scenario | Policy |
| --- | --- |
| Covered missing-validation hardening report → pytorch#195547 | Close is allowed, subject to the safety checks. This is not permission to dismiss ordinary supported public-API failures. |
| Forward-AD derivative report → pytorch#198017 | Link only; keep the individual reproducer open. |
| Lost compiled validation → pytorch#197554 | Link only; keep the individual report open. |
| Uncertain coverage, review/priority, or pending information/reproduction | Do not close. |
| Invalid target or conflicting close/transfer decision | No umbrella reference; route to review. |
| Already-routed source outside an eligible bot-owned retry, ineligible source, or non-PT2 oncall redirect | Skip the umbrella action. |

A target-specific bot marker avoids repeated comments. For the PT2 case, a pending-close receipt
lets the bot finish its own interrupted operation after adding its routing label, without treating
ordinary preexisting routing as permission to close. Fresh checks still apply on retry. GitHub's
reads and writes are not an atomic transaction.

### Test Plan

```sh
python3 -m unittest discover -s scripts/issue_triage_pi -v
```

95 Python tests pass, including 13 grouped umbrella tests covering source-only writes, target validation, human stops, and retries. The smaller suite still catches the original PT2 first-close and retry failures.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41384203855/job/125081309383). The Python suite also runs in triage preparation, before the model.

## Validation

[Read-only ciforge replay](https://github.com/pytorch/ciforge/actions/runs/41371417099) proposed closing pytorch#201797 into pytorch#195547, linking pytorch#196694 to pytorch#198017 while keeping it open, and keeping pytorch#202948 open without an umbrella. Apply was skipped; no issues were changed.

<details>
<summary>Live write-path probe and its limitation</summary>

[Real Actions-token write probe](https://github.com/pytorch/ciforge/actions/runs/41339792819) verified linking and duplicate closure with zero-write retries on disposable fixtures. The job failed its obsolete event-based check; subsequent direct API reads confirmed [pytorch#704](https://github.com/pytorch/ciforge/issues/704) has `duplicateOf` pointing to [pytorch#702](https://github.com/pytorch/ciforge/issues/702). All fixtures were closed and the temporary probe deployment was removed. No existing PyTorch reports were changed. The later PT2-routing receipt fix is covered by local stateful tests, not this live probe.

</details>

## Linked issue or supporting maintainer

Umbrella policy evidence: pytorch#195547, pytorch#198017, and pytorch#197554. This does not modify their existing members.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: pytorch#202962
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: pytorch#203124, pytorch#202961
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 5, 2026
…ytorch#202981)

## Human Note

Let agents suggest duplicate issues

## Agent Notes

### Why

Finding a likely duplicate should help the reporter, not silently discard their report. Add a
suggestion-only path for ordinary issues: explain the possible match, ask the reporter to check it,
and leave the final decision to them. This is separate from approved umbrella closure policies.

### What happens

After reading a candidate's body and relevant comments, the model can propose
`possible_duplicate: <issue number>`. The trusted apply step validates the reference and posts fixed
copy linking that issue. It keeps the source open and never writes to the candidate, which may
already be open or closed.

```mermaid
flowchart TD
    M["Model reads candidate and proposes possible_duplicate"] --> V{"Source, target and plan are eligible?"}
    V -->|No| R["No duplicate suggestion; skip or flag review"]
    V -->|Yes| B{"Matching bot suggestion already posted?"}
    B -->|Yes| N["Do not repeat the comment"]
    B -->|No| C["Post fixed linked suggestion"]
    N --> O["Keep source open; finish any pending labels"]
    C --> O
    O --> H["Reporter can confirm the match or explain the difference"]
```

| Scenario | Outcome |
| --- | --- |
| Plausible same underlying bug, with candidate context read | Suggest the linked issue and ask the reporter to confirm. No automatic closure. |
| Similar operator/title, or a report that still reproduces after the candidate's fix | Do not infer a duplicate; keep investigating the new report. |
| Self-reference, foreign/PR/unavailable target, catalog umbrella, or conflicting close/umbrella annotation | No ordinary duplicate suggestion; skip or route to review. |
| Retry after comment succeeded but label writing failed | Do not repost; finish the pending labels. |

The comment asks reporters to move any new reproduction details to the linked issue and close
their own issue **only if it is the same problem**. Otherwise they can explain what differs. The
model supplies neither a URL nor free-form comment text; same-repository links and the wording are
constructed by trusted code. Semantic matching still depends on the model and human judgment.

### Test Plan

```sh
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/issue_triage_pi -v
git diff --check
```

106 Python tests pass, including 11 new suggestion tests. The initial comment test and a closed-source skip-fallback regression failed before their fixes and pass afterward.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41384204576/job/125081314456). The Python suite also runs in triage preparation, before the model.

## Validation

Before test consolidation, [pinned-runtime ciforge CI](https://github.com/pytorch/ciforge/actions/runs/41379809233) passed 119 Python tests and 4 search-tool tests with Pi 0.99.1.

[Read-only ciforge replay](https://github.com/pytorch/ciforge/actions/runs/41379809226) searched and read pytorch#200935's body/comments, then proposed it as a possible duplicate of pytorch#202764 with no automatic closure. The related-only case stayed open, and the two umbrella controls retained their close/link proposals. Apply was skipped; no comments or issue changes were posted.

The positive candidate's comments explicitly confirmed the duplicate relationship, so this is current-context integration evidence, not a blind accuracy benchmark. The related-only case had empty search results. Real-write behavior for this new suggestion path has not been exercised in ciforge; source-only writes and retries are covered by the local tests.

## Linked issue or supporting maintainer

Triage-tooling follow-up; pytorch#202764 and pytorch#200935 were used as a confirmed duplicate replay case.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: pytorch#202981
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: pytorch#203124, pytorch#202961, pytorch#202962
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
…02961)

## Human Note

Lets find dup issues

## Agent Notes

### Why

A useful duplicate search needs room to refine a bad query and inspect the evidence. Keep the
existing GitHub search tool rather than introduce a separate duplicate detector, while preventing
the model from expanding its search into unrelated repositories.

### What happens

The workflow owns the repository and source issue. The tool rejects scope overrides and unquoted
`OR`/grouping before calling GitHub, then filters the response to same-repository issues, excluding
PRs and the source. It returns at most 10 summaries; bodies and comments use the existing read tools.

```mermaid
flowchart TD
    Q["Model chooses a query"] --> G{"Scope checks pass?"}
    G -->|No| E["Reject before calling GitHub"]
    E --> Q
    G -->|Yes| S["Read-only repository-scoped search"]
    S --> F["Filter identities; return at most 10 summaries"]
    F --> M{"Useful candidates?"}
    M -->|No| B["Model can broaden or refine"]
    B --> Q
    M -->|Yes| R["Model reads candidate bodies and comments"]
    R --> P["Use evidence in the triage plan"]
```

Query checks and response filtering are enforced in code. Refinement and candidate reads are skill
guidance, not guaranteed model behavior. Search never grants permission to close an issue.

| Scenario | Outcome |
| --- | --- |
| Operator/error/label query in the workflow repository | Return candidate summaries for inspection. |
| Repository override or unquoted `OR` query | Reject it before making a GitHub request. |
| Empty results or similar titles only | Refine or gather context; do not infer absence or duplication. |

Same-repository issue text is still untrusted. This reduces external-repository exposure; it is not
prompt-injection immunity or an exhaustive duplicate search.

### Test Plan

```sh
python3 -m unittest discover -s scripts/issue_triage_pi -v
PI_TEST_RUNTIME="$HOME/.npm-global/lib/node_modules/@earendil-works/pi-coding-agent" node --test .github/pi/tests/github-issue-tools.mjs
```

The search layer passes 82 Python tests and 4 Node tests. The local Node command uses Pi 1.4.0; pinned-runtime CI is linked below.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41381389439/job/125072767834). The Python suite also runs in triage preparation, before the model.

## Validation

[Earlier full-stack ciforge CI](https://github.com/pytorch/ciforge/actions/runs/41371417559) passed with Pi 0.99.1: 4 search tests and 108 full-stack Python tests.

[Read-only replay](https://github.com/pytorch/ciforge/actions/runs/41371417099) retrieved previously missed pytorch#69512 for pytorch#202948 and kept the source open. The model did not read that candidate’s body/comments, so follow-up remains incomplete. This is limited retrieval evidence, not a general recall or prompt-injection-resistance result.

## Linked issue or supporting maintainer

Triage-tooling follow-up prompted by reports such as pytorch#202948; this does not fix the reported numerical behavior.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: pytorch#202961
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: pytorch#203124
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
## Human Note

Often issues come in that match umbrellas, there are 2 types -> close the sub issue and
put inot the main umbrealla, or open up subissues and link back. This supports both

## Agent Notes

### Why

An umbrella can mean two different things: a place to consolidate repeated reports, or a tracker
whose individual reproducers must stay open. Similarity alone cannot tell the bot which action is
appropriate. Put that decision in a checked-in catalog, separate from the model's match judgment.

### What happens

The model proposes an umbrella issue and a `covered` or `uncertain` match. The trusted apply step
validates the source, target and decision, then uses the catalog's `link` or `close` policy. All
writes go to the source issue; the umbrella body, checklist and existing members are untouched.

```mermaid
flowchart TD
    P["Model proposes umbrella and coverage"] --> V{"Reference permitted?"}
    V -->|No| R["Skip or flag for review; no umbrella close"]
    V -->|Yes| C{"Covered, close-enabled, and no review or information stop?"}
    C -->|No| L["Post fixed reference; keep source open"]
    C -->|Yes| W["Post fixed reference and labels"]
    W --> F{"Fresh source and target checks still allow closing?"}
    F -->|No| O["Do not close; flag review where needed"]
    F -->|Yes| D["Close source as duplicate of the validated umbrella"]
```

| Scenario | Policy |
| --- | --- |
| Covered missing-validation hardening report → pytorch#195547 | Close is allowed, subject to the safety checks. This is not permission to dismiss ordinary supported public-API failures. |
| Forward-AD derivative report → pytorch#198017 | Link only; keep the individual reproducer open. |
| Lost compiled validation → pytorch#197554 | Link only; keep the individual report open. |
| Uncertain coverage, review/priority, or pending information/reproduction | Do not close. |
| Invalid target or conflicting close/transfer decision | No umbrella reference; route to review. |
| Already-routed source outside an eligible bot-owned retry, ineligible source, or non-PT2 oncall redirect | Skip the umbrella action. |

A target-specific bot marker avoids repeated comments. For the PT2 case, a pending-close receipt
lets the bot finish its own interrupted operation after adding its routing label, without treating
ordinary preexisting routing as permission to close. Fresh checks still apply on retry. GitHub's
reads and writes are not an atomic transaction.

### Test Plan

```sh
python3 -m unittest discover -s scripts/issue_triage_pi -v
```

95 Python tests pass, including 13 grouped umbrella tests covering source-only writes, target validation, human stops, and retries. The smaller suite still catches the original PT2 first-close and retry failures.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41384203855/job/125081309383). The Python suite also runs in triage preparation, before the model.

## Validation

[Read-only ciforge replay](https://github.com/pytorch/ciforge/actions/runs/41371417099) proposed closing pytorch#201797 into pytorch#195547, linking pytorch#196694 to pytorch#198017 while keeping it open, and keeping pytorch#202948 open without an umbrella. Apply was skipped; no issues were changed.

<details>
<summary>Live write-path probe and its limitation</summary>

[Real Actions-token write probe](https://github.com/pytorch/ciforge/actions/runs/41339792819) verified linking and duplicate closure with zero-write retries on disposable fixtures. The job failed its obsolete event-based check; subsequent direct API reads confirmed [pytorch#704](https://github.com/pytorch/ciforge/issues/704) has `duplicateOf` pointing to [pytorch#702](https://github.com/pytorch/ciforge/issues/702). All fixtures were closed and the temporary probe deployment was removed. No existing PyTorch reports were changed. The later PT2-routing receipt fix is covered by local stateful tests, not this live probe.

</details>

## Linked issue or supporting maintainer

Umbrella policy evidence: pytorch#195547, pytorch#198017, and pytorch#197554. This does not modify their existing members.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: pytorch#202962
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: pytorch#203124, pytorch#202961
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
…ytorch#202981)

## Human Note

Let agents suggest duplicate issues

## Agent Notes

### Why

Finding a likely duplicate should help the reporter, not silently discard their report. Add a
suggestion-only path for ordinary issues: explain the possible match, ask the reporter to check it,
and leave the final decision to them. This is separate from approved umbrella closure policies.

### What happens

After reading a candidate's body and relevant comments, the model can propose
`possible_duplicate: <issue number>`. The trusted apply step validates the reference and posts fixed
copy linking that issue. It keeps the source open and never writes to the candidate, which may
already be open or closed.

```mermaid
flowchart TD
    M["Model reads candidate and proposes possible_duplicate"] --> V{"Source, target and plan are eligible?"}
    V -->|No| R["No duplicate suggestion; skip or flag review"]
    V -->|Yes| B{"Matching bot suggestion already posted?"}
    B -->|Yes| N["Do not repeat the comment"]
    B -->|No| C["Post fixed linked suggestion"]
    N --> O["Keep source open; finish any pending labels"]
    C --> O
    O --> H["Reporter can confirm the match or explain the difference"]
```

| Scenario | Outcome |
| --- | --- |
| Plausible same underlying bug, with candidate context read | Suggest the linked issue and ask the reporter to confirm. No automatic closure. |
| Similar operator/title, or a report that still reproduces after the candidate's fix | Do not infer a duplicate; keep investigating the new report. |
| Self-reference, foreign/PR/unavailable target, catalog umbrella, or conflicting close/umbrella annotation | No ordinary duplicate suggestion; skip or route to review. |
| Retry after comment succeeded but label writing failed | Do not repost; finish the pending labels. |

The comment asks reporters to move any new reproduction details to the linked issue and close
their own issue **only if it is the same problem**. Otherwise they can explain what differs. The
model supplies neither a URL nor free-form comment text; same-repository links and the wording are
constructed by trusted code. Semantic matching still depends on the model and human judgment.

### Test Plan

```sh
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/issue_triage_pi -v
git diff --check
```

106 Python tests pass, including 11 new suggestion tests. The initial comment test and a closed-source skip-fallback regression failed before their fixes and pass afterward.

[Current PyTorch PR test job](https://github.com/pytorch/pytorch/actions/runs/41384204576/job/125081314456). The Python suite also runs in triage preparation, before the model.

## Validation

Before test consolidation, [pinned-runtime ciforge CI](https://github.com/pytorch/ciforge/actions/runs/41379809233) passed 119 Python tests and 4 search-tool tests with Pi 0.99.1.

[Read-only ciforge replay](https://github.com/pytorch/ciforge/actions/runs/41379809226) searched and read pytorch#200935's body/comments, then proposed it as a possible duplicate of pytorch#202764 with no automatic closure. The related-only case stayed open, and the two umbrella controls retained their close/link proposals. Apply was skipped; no comments or issue changes were posted.

The positive candidate's comments explicitly confirmed the duplicate relationship, so this is current-context integration evidence, not a blind accuracy benchmark. The related-only case had empty search results. Real-write behavior for this new suggestion path has not been exercised in ciforge; source-only writes and retries are covered by the local tests.

## Linked issue or supporting maintainer

Triage-tooling follow-up; pytorch#202764 and pytorch#200935 were used as a confirmed duplicate replay case.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

AI-assisted implementation and validation are described in Agent Notes above.

Pull Request resolved: pytorch#202981
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: pytorch#203124, pytorch#202961, pytorch#202962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GL/superseded GreenLight review is superseded by changes in progress PR is being worked on by the author, until the automated review accepts it Merged topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants