Skip to content

Add ClickHouse ingestion for autorevert advisor verdicts#7906

Merged
izaitsevfb merged 1 commit intomainfrom
autorevert-advisor-ch-ingestion
Mar 31, 2026
Merged

Add ClickHouse ingestion for autorevert advisor verdicts#7906
izaitsevfb merged 1 commit intomainfrom
autorevert-advisor-ch-ingestion

Conversation

@izaitsevfb
Copy link
Copy Markdown
Contributor

Summary

Sets up the S3 → ClickHouse ingestion pipeline for autorevert AI advisor verdicts, following the same pattern as claude_code_usage.

Changes

  • clickhouse_db_schema/misc.autorevert_advisor_verdicts/schema.sql — new table storing verdict, confidence, summary, causal_reasoning, plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name)
  • aws/lambda/clickhouse-replicator-s3/lambda_function.py — add autorevert_advisor_verdicts to SUPPORTED_PATHS + adapter function

S3 path

s3://ossci-raw-job-status/autorevert_advisor_verdicts/<repo>/<run_id>_<run_attempt>.json

Dependencies

  • S3 bucket notification for autorevert_advisor_verdicts/ prefix → clickhouse-replicator-s3 Lambda (internal infra change)
  • S3 write permission for the advisor workflow's IAM role (internal infra change)
  • Workflow upload step in pytorch/pytorch (separate PR)

Test plan

  • Verify CH table creation
  • Verify Lambda adapter handles the JSON format correctly
  • End-to-end: workflow uploads verdict → S3 notification → Lambda → CH table

…erdicts

- New table misc.autorevert_advisor_verdicts for storing AI advisor
  verdicts (verdict, confidence, summary, causal_reasoning) with
  signal metadata (signal_key, suspect_commit, pr_number)
- Add autorevert_advisor_verdicts adapter to clickhouse-replicator-s3
  Lambda for S3 → CH ingestion
- S3 prefix: autorevert_advisor_verdicts/
@pytorch-bot pytorch-bot bot added the ci-no-td label Mar 30, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
torchci Ignored Ignored Mar 30, 2026 9:15pm

Request Review

@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 30, 2026
@izaitsevfb izaitsevfb merged commit a2cc5e0 into main Mar 31, 2026
10 checks passed
@izaitsevfb izaitsevfb deleted the autorevert-advisor-ch-ingestion branch March 31, 2026 01:15
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Mar 31, 2026
…78810)

## Summary

Adds a workflow step that uploads the AI advisor verdict to S3 (`ossci-raw-job-status/autorevert_advisor_verdicts/`) for ingestion into ClickHouse. This enables the autorevert lambda to read verdicts from CH (fast, single query) instead of downloading GitHub Actions artifacts (~1.7s each, up to 66 in a 16h window).

The uploaded JSON includes the verdict fields plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name) extracted from the `signal_pattern` input.

## Dependencies

- [test-infra#7906](pytorch/test-infra#7906) — CH table schema + Lambda adapter
- Internal: S3 bucket notification + IAM permissions for the `bedrock` environment role

## Test plan

- [x] Verify the `jq` command correctly builds the enriched JSON
- [x] Verify S3 upload succeeds with appropriate IAM permissions
- [x] End-to-end: verdict appears in `misc.autorevert_advisor_verdicts` table

^ verified end-to-end on ciforge
Pull Request resolved: #178810
Approved by: https://github.com/wdvr
AaronWang04 pushed a commit to AaronWang04/pytorch that referenced this pull request Mar 31, 2026
…torch#178810)

## Summary

Adds a workflow step that uploads the AI advisor verdict to S3 (`ossci-raw-job-status/autorevert_advisor_verdicts/`) for ingestion into ClickHouse. This enables the autorevert lambda to read verdicts from CH (fast, single query) instead of downloading GitHub Actions artifacts (~1.7s each, up to 66 in a 16h window).

The uploaded JSON includes the verdict fields plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name) extracted from the `signal_pattern` input.

## Dependencies

- [test-infra#7906](pytorch/test-infra#7906) — CH table schema + Lambda adapter
- Internal: S3 bucket notification + IAM permissions for the `bedrock` environment role

## Test plan

- [x] Verify the `jq` command correctly builds the enriched JSON
- [x] Verify S3 upload succeeds with appropriate IAM permissions
- [x] End-to-end: verdict appears in `misc.autorevert_advisor_verdicts` table

^ verified end-to-end on ciforge
Pull Request resolved: pytorch#178810
Approved by: https://github.com/wdvr
pytorch-bot bot pushed a commit to pytorch/pytorch that referenced this pull request Apr 2, 2026
…78810)

## Summary

Adds a workflow step that uploads the AI advisor verdict to S3 (`ossci-raw-job-status/autorevert_advisor_verdicts/`) for ingestion into ClickHouse. This enables the autorevert lambda to read verdicts from CH (fast, single query) instead of downloading GitHub Actions artifacts (~1.7s each, up to 66 in a 16h window).

The uploaded JSON includes the verdict fields plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name) extracted from the `signal_pattern` input.

## Dependencies

- [test-infra#7906](pytorch/test-infra#7906) — CH table schema + Lambda adapter
- Internal: S3 bucket notification + IAM permissions for the `bedrock` environment role

## Test plan

- [x] Verify the `jq` command correctly builds the enriched JSON
- [x] Verify S3 upload succeeds with appropriate IAM permissions
- [x] End-to-end: verdict appears in `misc.autorevert_advisor_verdicts` table

^ verified end-to-end on ciforge
Pull Request resolved: #178810
Approved by: https://github.com/wdvr
izaitsevfb added a commit that referenced this pull request Apr 2, 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

- [#7839](#7839) (merged) —
advisor dispatch from lambda
- [#7906](#7906) (merged) — CH
table + S3 ingestion
-
[pytorch/pytorch#178810](pytorch/pytorch#178810)
(pending) — workflow S3 upload step

## Test plan

- [x] 60 tests passing (8 new)
- [x] 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](https://github.com/user-attachments/files/26392664/2026-04-01T00-11-54.124373-00-00.html)



[2026-04-01T01-22-24.845831-00-00.html](https://github.com/user-attachments/files/26393283/2026-04-01T01-22-24.845831-00-00.html)
IvanKobzarev pushed a commit to IvanKobzarev/pytorch that referenced this pull request Apr 3, 2026
…torch#178810)

## Summary

Adds a workflow step that uploads the AI advisor verdict to S3 (`ossci-raw-job-status/autorevert_advisor_verdicts/`) for ingestion into ClickHouse. This enables the autorevert lambda to read verdicts from CH (fast, single query) instead of downloading GitHub Actions artifacts (~1.7s each, up to 66 in a 16h window).

The uploaded JSON includes the verdict fields plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name) extracted from the `signal_pattern` input.

## Dependencies

- [test-infra#7906](pytorch/test-infra#7906) — CH table schema + Lambda adapter
- Internal: S3 bucket notification + IAM permissions for the `bedrock` environment role

## Test plan

- [x] Verify the `jq` command correctly builds the enriched JSON
- [x] Verify S3 upload succeeds with appropriate IAM permissions
- [x] End-to-end: verdict appears in `misc.autorevert_advisor_verdicts` table

^ verified end-to-end on ciforge
Pull Request resolved: pytorch#178810
Approved by: https://github.com/wdvr
nklshy-aws pushed a commit to nklshy-aws/pytorch that referenced this pull request Apr 7, 2026
…torch#178810)

## Summary

Adds a workflow step that uploads the AI advisor verdict to S3 (`ossci-raw-job-status/autorevert_advisor_verdicts/`) for ingestion into ClickHouse. This enables the autorevert lambda to read verdicts from CH (fast, single query) instead of downloading GitHub Actions artifacts (~1.7s each, up to 66 in a 16h window).

The uploaded JSON includes the verdict fields plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name) extracted from the `signal_pattern` input.

## Dependencies

- [test-infra#7906](pytorch/test-infra#7906) — CH table schema + Lambda adapter
- Internal: S3 bucket notification + IAM permissions for the `bedrock` environment role

## Test plan

- [x] Verify the `jq` command correctly builds the enriched JSON
- [x] Verify S3 upload succeeds with appropriate IAM permissions
- [x] End-to-end: verdict appears in `misc.autorevert_advisor_verdicts` table

^ verified end-to-end on ciforge
Pull Request resolved: pytorch#178810
Approved by: https://github.com/wdvr
bobrenjc93 pushed a commit to bobrenjc93/pytorch that referenced this pull request Apr 9, 2026
…torch#178810)

## Summary

Adds a workflow step that uploads the AI advisor verdict to S3 (`ossci-raw-job-status/autorevert_advisor_verdicts/`) for ingestion into ClickHouse. This enables the autorevert lambda to read verdicts from CH (fast, single query) instead of downloading GitHub Actions artifacts (~1.7s each, up to 66 in a 16h window).

The uploaded JSON includes the verdict fields plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name) extracted from the `signal_pattern` input.

## Dependencies

- [test-infra#7906](pytorch/test-infra#7906) — CH table schema + Lambda adapter
- Internal: S3 bucket notification + IAM permissions for the `bedrock` environment role

## Test plan

- [x] Verify the `jq` command correctly builds the enriched JSON
- [x] Verify S3 upload succeeds with appropriate IAM permissions
- [x] End-to-end: verdict appears in `misc.autorevert_advisor_verdicts` table

^ verified end-to-end on ciforge
Pull Request resolved: pytorch#178810
Approved by: https://github.com/wdvr
bobrenjc93 pushed a commit to bobrenjc93/pytorch that referenced this pull request Apr 10, 2026
…torch#178810)

## Summary

Adds a workflow step that uploads the AI advisor verdict to S3 (`ossci-raw-job-status/autorevert_advisor_verdicts/`) for ingestion into ClickHouse. This enables the autorevert lambda to read verdicts from CH (fast, single query) instead of downloading GitHub Actions artifacts (~1.7s each, up to 66 in a 16h window).

The uploaded JSON includes the verdict fields plus signal metadata (signal_key, suspect_commit, pr_number, workflow_name) extracted from the `signal_pattern` input.

## Dependencies

- [test-infra#7906](pytorch/test-infra#7906) — CH table schema + Lambda adapter
- Internal: S3 bucket notification + IAM permissions for the `bedrock` environment role

## Test plan

- [x] Verify the `jq` command correctly builds the enriched JSON
- [x] Verify S3 upload succeeds with appropriate IAM permissions
- [x] End-to-end: verdict appears in `misc.autorevert_advisor_verdicts` table

^ verified end-to-end on ciforge
Pull Request resolved: pytorch#178810
Approved by: https://github.com/wdvr
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.

2 participants