Skip to content

Use Sol 6.1 by default for issue triage - #203124

Closed
drisspg wants to merge 1 commit into
gh/drisspg/471/basefrom
gh/drisspg/471/head
Closed

drisspg wants to merge 1 commit into
gh/drisspg/471/basefrom
gh/drisspg/471/head

Conversation

@drisspg

@drisspg drisspg commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Human Note

Did a bunch of tests in CIFORGE and in theory this is both cheaper and more reliably triaging and using tools

Agent Notes

Switch first-pass and distributed issue triage to global.openai.gpt-6.1-sol at medium thinking. Update both manual-dispatch defaults and automatic-handoff fallbacks; allowlisted model overrides remain available.

Sol matched the intended discovery and evidence-gathering outcomes in a three-case read-only ciforge replay. Its reported cost averaged $0.059 per issue versus $0.071 for Sonnet 5 and $0.251 for Astra. These are Pi estimates on reused cases, not a production accuracy benchmark or verified AWS charges. Prompt/rule changes remain in the following PRs.

Test Plan

PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/issue_triage_pi -v
PATH="$HOME/.venvs/dev/bin:$PATH" lintrunner -a .github/workflows/issue-triage-pi.yml .github/workflows/distributed-triage-pi.yml .github/actions/pi-agent/README.md .github/actions/pi-agent/allowed-models.json
git diff --check

Validation

Sol replay found and inspected the ordinary duplicate, applied the approved umbrella policy, and correctly handled the process question. Apply was skipped. The replay used the following PRs' tooling and prompt changes; it is not isolated validation of the base commit's older skill.

Linked issue or supporting maintainer

Triage model selection; requested by the stack author.

BC-breaking?

No public PyTorch API change.

Summary (human written only)

Agent details (if applicable)

Prepared with an AI assistant; implementation and validation are described above.

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Nov 2, 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:

This PR changes the default model for first-pass issue triage and distributed
triage from global.anthropic.claude-sonnet-5 to global.openai.gpt-6.1-sol, and
updates the pi-agent README and allowed-models.json to match. Recommendation:
Request Changes. The blocker is the validation gap: as stacked, this commit can
land first and put Sol in apply mode on every new issue and every distributed
sweep without validation at this commit.

Findings (4):

[major] .github/workflows/distributed-triage-pi.yml:34
Distributed triage switches to Sol with no Sol validation, and the first-pass
validation ran on a different commit (also distributed-triage-pi.yml:97,
issue-triage-pi.yml:37/:98). The only evidence is a three-case ciforge replay of
first-pass `triaging-issues` cases. Nothing runs the `distributed-triage` skill
or `distributed-triage-plan.json` on Sol. `mode` defaults to `apply`, and the
daily sweep (`claude-distributed-triage-cron.yml:185-187`) dispatches up to 20
issues a day with no `-f model`/`-f mode`, so every swept issue gets labels and
comments written by Sol with no dry run first. The description says the replay
"used the following PRs' tooling and prompt changes; it is not isolated
validation of the base commit's older skill." This PR is the oldest in the
ghstack, so it can merge before # 202961, # 202962 and # 202981, and every new
issue would be triaged by Sol in apply mode against untested skill files. Fix:
move this default switch to the top of the stack, after the changes it was
tested with, or attach a dry run of `distributed-triage-pi.yml` and a replay of
`issue-triage-pi.yml` on Sol at this commit.

[minor] .github/workflows/distributed-triage-pi.yml:97
Public bot comments and nearby text still say Claude.
`.agents/skills/distributed-triage/templates.json:7` and `:12` end with "*This
comment was generated by PTD's claude triage bot.*". These are the only comments
`apply_distributed_plan.py` can post, so with this change every automatic
distributed comment names the wrong model. Caution on rewording: dedup is a
substring match on the full template text (`apply_plan.py:136`, reused by
`apply_distributed_plan.py`), so a changed signature means issues that already
have the old comment could get a second copy on a manual re-dispatch, and
`distributed-triage-pi.yml` doesn't check `ptd-bot-triaged`. In the same change,
update `claude-distributed-triage-cron.yml:2` and `:11` ("Max issues to process
with Claude") and `allowed-models.json:6`, where Sonnet 5's `use` still reads
"Same model as the Claude Code triage". No Claude Code issue triage exists any
more (`test_workflow_contract.py:177-179`); the only Sonnet 5 user is PR triage
in `auto-pr-triage/action.yml:125`. The PR removed the matching README sentence
but left this one.

[minor] .github/workflows/issue-triage-pi.yml:98
No test pins the default model or keeps its four copies in sync. Each workflow
has the ID twice: as the dispatch `default:` and as the `inputs.model || '...'`
fallback (issue-triage-pi.yml:37/:98, distributed-triage-pi.yml:34/:97).
`inputs` is empty for `workflow_run`, so automatic handoffs use the fallback and
manual dispatches use `default:`. If the two drift apart, automatic and manual
runs quietly use different models. `test_workflow_contract.py` never parses
`on:`, and `test_workflow_config.py:36` injects `MODEL=test-model`. Neither
checks the default is in `allowed-models.json` or `models.json`, so a typo only
shows up when the Bedrock plan job fails in `run.sh:21-27`, after OIDC
credentials are fetched. Fix: add a contract test asserting, for each caller,
that the dispatch `default:` equals the `MODEL` fallback (PyYAML loads `on:` as
key `True`), that both workflows use the same default (as README line 102
claims), and that the ID is in `allowed-models.json` and in `models.json`'s
`providers.amazon-bedrock.models[].id`.

(1 more not shown, see the review run)

Reviewed commit: 01e45ca

Review run

🔗 Helpful Links

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

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

✅ No Failures

As of commit 01e45ca with merge base 78def3c (image):
💚 Looks good so far! There are no failures yet. 💚

🟡 GREEN LIGHT - PR requires human review:

  • Socialization
    • Moves the default model for automated issue triage from global.anthropic.claude-sonnet-5 to global.openai.gpt-6.1-sol
    • Fallback MODEL: ${{ inputs.model || ... }} changes in issue-triage-pi.yml and distributed-triage-pi.yml, so every auto-triggered run switches
  • Consequence
    • Automatic runs default to MODE: apply, so a different model now acts on every newly opened pytorch issue
    • Choosing that model rests on a three-case ciforge replay the PR body cites, a judgment a maintainer should own
  • Correctness
    • global.openai.gpt-6.1-sol is already listed in allowed-models.json and models.json; the edits are consistent across both workflows

reason: needs_socialization
Reviewed commit: 01e45ca

Inference job

🐛 Report a wrong verdict

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

@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-02T23:43:22.209632Z 01e45ca 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 3, 2026

@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 01e45ca: changes requested before human review.

This PR changes the default model for first-pass issue triage and distributed triage from global.anthropic.claude-sonnet-5 to global.openai.gpt-6.1-sol, and updates the pi-agent README and allowed-models.json to match. Recommendation: Request Changes. The blocker is the validation gap: as stacked, this commit can land first and put Sol in apply mode on every new issue and every distributed sweep without validation at this commit.

🔴 1 blocking finding is attached to the code below.

⚪ 3 non-blocking findings

MODEL: ${{ inputs.model || 'global.openai.gpt-6.1-sol' }}

Public bot comments and nearby text still say Claude. .agents/skills/distributed-triage/templates.json:7 and :12 end with "This comment was generated by PTD's claude triage bot.". These are the only comments apply_distributed_plan.py can post, so with this change every automatic distributed comment names the wrong model. Caution on rewording: dedup is a substring match on the full template text (apply_plan.py:136, reused by apply_distributed_plan.py), so a changed signature means issues that already have the old comment could get a second copy on a manual re-dispatch, and distributed-triage-pi.yml doesn't check ptd-bot-triaged. In the same change, update claude-distributed-triage-cron.yml:2 and :11 ("Max issues to process with Claude") and allowed-models.json:6, where Sonnet 5's use still reads "Same model as the Claude Code triage". No Claude Code issue triage exists any more (test_workflow_contract.py:177-179); the only Sonnet 5 user is PR triage in auto-pr-triage/action.yml:125. The PR removed the matching README sentence but left this one.


MODEL: ${{ inputs.model || 'global.openai.gpt-6.1-sol' }}

No test pins the default model or keeps its four copies in sync. Each workflow has the ID twice: as the dispatch default: and as the inputs.model || '...' fallback (issue-triage-pi.yml:37/:98, distributed-triage-pi.yml:34/:97). inputs is empty for workflow_run, so automatic handoffs use the fallback and manual dispatches use default:. If the two drift apart, automatic and manual runs quietly use different models. test_workflow_contract.py never parses on:, and test_workflow_config.py:36 injects MODEL=test-model. Neither checks the default is in allowed-models.json or models.json, so a typo only shows up when the Bedrock plan job fails in run.sh:21-27, after OIDC credentials are fetched. Fix: add a contract test asserting, for each caller, that the dispatch default: equals the MODEL fallback (PyYAML loads on: as key True), that both workflows use the same default (as README line 102 claims), and that the ID is in allowed-models.json and in models.json's providers.amazon-bedrock.models\[\].id.


through the `model` dispatch input. Distributed triage uses the same default:

The README sentence the PR re-wrapped still misleads. "Distributed triage uses the same default:" ends with a colon that introduces the plan/apply list, but item 2 of that list (apply_plan.py, the hand-off) describes first-pass triage only. This text predates the PR, but the PR rewrote these lines. End the sentence with a period, or move the clause to the "Distributed triage" section at line 124.

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.

@d4l3k d4l3k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

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

LGTM! I checked the cost difference, but it's negligible

@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

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 #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.

Pull Request resolved: #202961
Approved by: https://github.com/ezyang, https://github.com/malfet
ghstack dependencies: #203124
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
## Human Note

Did a bunch of tests in CIFORGE and in theory this is both cheaper and more reliably triaging and using tools

## Agent Notes

Switch first-pass and distributed issue triage to `global.openai.gpt-6.1-sol` at medium thinking. Update both manual-dispatch defaults and automatic-handoff fallbacks; allowlisted model overrides remain available.

Sol matched the intended discovery and evidence-gathering outcomes in a three-case read-only ciforge replay. Its reported cost averaged $0.059 per issue versus $0.071 for Sonnet 5 and $0.251 for Astra. These are Pi estimates on reused cases, not a production accuracy benchmark or verified AWS charges. Prompt/rule changes remain in the following PRs.

### Test Plan

```sh
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/issue_triage_pi -v
PATH="$HOME/.venvs/dev/bin:$PATH" lintrunner -a .github/workflows/issue-triage-pi.yml .github/workflows/distributed-triage-pi.yml .github/actions/pi-agent/README.md .github/actions/pi-agent/allowed-models.json
git diff --check
```

## Validation

[Sol replay](https://github.com/pytorch/ciforge/actions/runs/41542975814) found and inspected the ordinary duplicate, applied the approved umbrella policy, and correctly handled the process question. Apply was skipped. The replay used the following PRs' tooling and prompt changes; it is not isolated validation of the base commit's older skill.

## Linked issue or supporting maintainer

Triage model selection; requested by the stack author.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

Prepared with an AI assistant; implementation and validation are described above.
Pull Request resolved: pytorch#203124
Approved by: https://github.com/d4l3k, https://github.com/huydhn
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
## Human Note

Did a bunch of tests in CIFORGE and in theory this is both cheaper and more reliably triaging and using tools

## Agent Notes

Switch first-pass and distributed issue triage to `global.openai.gpt-6.1-sol` at medium thinking. Update both manual-dispatch defaults and automatic-handoff fallbacks; allowlisted model overrides remain available.

Sol matched the intended discovery and evidence-gathering outcomes in a three-case read-only ciforge replay. Its reported cost averaged $0.059 per issue versus $0.071 for Sonnet 5 and $0.251 for Astra. These are Pi estimates on reused cases, not a production accuracy benchmark or verified AWS charges. Prompt/rule changes remain in the following PRs.

### Test Plan

```sh
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s scripts/issue_triage_pi -v
PATH="$HOME/.venvs/dev/bin:$PATH" lintrunner -a .github/workflows/issue-triage-pi.yml .github/workflows/distributed-triage-pi.yml .github/actions/pi-agent/README.md .github/actions/pi-agent/allowed-models.json
git diff --check
```

## Validation

[Sol replay](https://github.com/pytorch/ciforge/actions/runs/41542975814) found and inspected the ordinary duplicate, applied the approved umbrella policy, and correctly handled the process question. Apply was skipped. The replay used the following PRs' tooling and prompt changes; it is not isolated validation of the base commit's older skill.

## Linked issue or supporting maintainer

Triage model selection; requested by the stack author.

## BC-breaking?

No public PyTorch API change.

## Summary (human written only)

## Agent details (if applicable)

Prepared with an AI assistant; implementation and validation are described above.
Pull Request resolved: pytorch#203124
Approved by: https://github.com/d4l3k, https://github.com/huydhn
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/human GreenLight marked as needing human review 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