Skip to content

Read AI advisor verdicts from CH and use in autorevert decisions#7908

Merged
izaitsevfb merged 3 commits intomainfrom
autorevert-advisor-verdict-reading
Apr 2, 2026
Merged

Read AI advisor verdicts from CH and use in autorevert decisions#7908
izaitsevfb merged 3 commits intomainfrom
autorevert-advisor-verdict-reading

Conversation

@izaitsevfb
Copy link
Copy Markdown
Contributor

@izaitsevfb izaitsevfb commented Mar 31, 2026

Summary

Closes the loop on the AI advisor: autorevert now reads verdict results from misc.autorevert_advisor_verdicts (populated via S3 ingestion from the advisor workflow) and uses them to make faster decisions.

Verdict Handling

Advisor Verdict Autorevert Action
revert Produce AutorevertPattern immediately — skip restarts
not_related Early exit as Ineligible(ADVISOR_NOT_RELATED)
garbage Suppress signal for 2h since verdict timestamp
unsure Continue normal restart-to-confirm flow

Changes

  • signal.py: AdvisorVerdict enum, AIAdvisorResult dataclass, SignalCommit.advisor_result field, _check_advisor_verdict() method, restructured process_valid_autorevert_pattern() (flakiness check moved after advisor)
  • signal_extraction_datasource.py: fetch_advisor_verdicts() — CH query for verdicts by commit SHAs
  • signal_extraction.py: _attach_advisor_verdicts() — post-processing step that wires CH data to SignalCommit objects
  • tests/test_signal.py: 8 new tests covering all verdict types, 2h expiry, signal key matching, flaky signal handling

Dependencies

Test plan

  • 60 tests passing (8 new)
  • End-to-end verified: ciforge advisor run → S3 → CH → row queryable
  • Deploy and verify verdicts are read during live autorevert runs

tested locally:

python -m pytorch_auto_revert --dry-run autorevert-checker trunk --hours 18  --as-of "2026-03-31 18:12" --hud-html
python -m pytorch_auto_revert --dry-run autorevert-checker trunk --hours 18   --hud-html

example of the result:
2026-04-01T00-11-54.124373-00-00.html

2026-04-01T01-22-24.845831-00-00.html

@pytorch-bot pytorch-bot bot added the ci-no-td label Mar 31, 2026
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 31, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
torchci Ignored Ignored Preview Apr 1, 2026 0:42am

Request Review

@izaitsevfb izaitsevfb force-pushed the autorevert-advisor-verdict-reading branch 2 times, most recently from 661668a to bb41c53 Compare March 31, 2026 20:55
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

Deployment failed with the following error:

Invalid request: `attribution.gitUser` should NOT have additional property `isBot`.

@izaitsevfb izaitsevfb force-pushed the autorevert-advisor-verdict-reading branch 2 times, most recently from fc6dc64 to e1d39e6 Compare March 31, 2026 22:32
When advisor verdicts are available in misc.autorevert_advisor_verdicts,
autorevert now uses them to make faster decisions:

- revert → produce AutorevertPattern immediately (skip restarts)
- not_related → early exit (Ineligible)
- garbage → suppress signal for 2 hours since verdict timestamp
- unsure → continue normal restart-to-confirm flow

Key changes:
- AIAdvisorResult dataclass + AdvisorVerdict enum in signal.py
- SignalCommit gets optional advisor_result field
- fetch_advisor_verdicts() query in signal_extraction_datasource.py
- _attach_advisor_verdicts() in signal_extraction.py wires CH data to SignalCommits
- Flakiness check moved AFTER advisor check/dispatch so advisor
  can still evaluate flaky-looking signals
- 8 new tests covering all verdict types, expiry, signal key matching
@izaitsevfb izaitsevfb force-pushed the autorevert-advisor-verdict-reading branch 2 times, most recently from 1c51ffe to ed40f5a Compare April 1, 2026 00:11
1. AutorevertPattern carries optional advisor_verdict field.
   When a revert is advisor-accelerated, the revert comment includes
   "Note: This revert was accelerated by the AI advisor" with verdict
   and confidence.

2. State JSON includes advisor data in two places (both forward/backward
   compatible — absent in older states, gracefully ignored):
   - outcomes: advisor_verdict on AutorevertPattern data
   - columns: advisor_results map per (commit_sha → verdict/confidence)

3. HUD renderer shows:
   - "AI:revert" / "AI:not_related" / etc badges in table cells
   - "[AI: revert @95%]" in outcome notes for advisor-accelerated reverts
@izaitsevfb izaitsevfb force-pushed the autorevert-advisor-verdict-reading branch 2 times, most recently from 52db32f to b9686ba Compare April 1, 2026 00:33
FakeDatasource now accepts advisor_verdicts dict, enabling end-to-end
tests that verify verdicts are correctly attached to SignalCommit
objects during extraction.

3 new tests:
- verdict attached to matching (commit, signal_key)
- verdict for wrong signal_key is not attached
- verdict attached to test-track signals
@izaitsevfb izaitsevfb force-pushed the autorevert-advisor-verdict-reading branch from b9686ba to 529dd6d Compare April 1, 2026 00:42
@izaitsevfb izaitsevfb requested a review from jeanschmidt April 1, 2026 00:56
@jeanschmidt
Copy link
Copy Markdown
Contributor

There is a gap in our autorevert that we're not closing with the given strategy, but I believe it is not sufficiently pervasive to require dedicated logic. Having said that, the solution seems very simple.

  • Flaky signals masking introduction of real problems;
    And this is where, in theory, AI in autorevert could shine: when not_related instead of ignoring, it retries, until either a green or two unsure or a revert.

@izaitsevfb izaitsevfb merged commit 69e3e2a into main Apr 2, 2026
11 checks passed
@izaitsevfb izaitsevfb deleted the autorevert-advisor-verdict-reading branch April 2, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants