Repository navigation
Conversation
[ghstack-poisoned]
PR Status: in progressA 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 🟡 AUTOMATED REVIEW - Changes requested:
Findings (9): Reviewed commit: 🔗 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 FailuresAs of commit b2de164 with merge base 78def3c ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: 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]
[ghstack-poisoned]
[ghstack-poisoned]
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
ezyang
left a comment
There was a problem hiding this comment.
approving because you shouldn't be blocked but I do care about my comment
[ghstack-poisoned]
[ghstack-poisoned]
There was a problem hiding this comment.
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
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.
(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.
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-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.
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.
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. |
There was a problem hiding this comment.
🔴 @ 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 |
There was a problem hiding this comment.
🔴 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 |
There was a problem hiding this comment.
🔴 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.
|
Starting merge as part of PR stack under #202981 |
## 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
…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
…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
## 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
…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
…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
## 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
…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
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, excludingPRs 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"]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.
ORquerySame-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.mjsThe 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.