Repository navigation
Add a flaky-test triage agent for #pw-health - #36468
shah-harshit wants to merge 5 commits into
Conversation
Hourly workflow lists OSS flaky alerts without a triage reply, then runs Claude Code (Opus 5.5) over skills/flaky-test-triage: dedupe against the last 7 days, root-cause, verify the fix 10x retry-free against a CI stack, open the fix PR, and reply in the thread with RCA, PR status and owners.
The agent job now holds only the read-only github.token: it drafts fix branches, PR bodies and replies as files. A publish job that runs no agent code checks each fix touches only playwright/, pushes and opens the PR with COLLATE_PAT, and posts replies under this run's pending alerts with the Slack token. Look back 7h so a run queued behind a long triage misses no alert. Record the rules in a decision record. Accept ANTHROPIC_API_KEY as well as CLAUDE_CODE_OAUTH_TOKEN.
Fix PRs no longer get 'safe to test'; a maintainer adds it after reading the diff. Publish accepts only Playwright test code (e2e, utils, support, constant, fixtures, test-data), not lint rules, reporters or configs that CI runs on every PR. One fix or reply that fails to publish no longer stops the rest, so every alert still gets its reply.
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
Code Review ✅ Approved 5 closed / 5 findings🟡 Medium risk · The triage workflow pushes allowlisted test branches, opens PRs, and posts Slack replies, so mis-scoped drafts could publish unintended changes or messages. Adds an hourly GitHub Actions agent that triages flaky Playwright tests from #pw-health, separating read-only triage from a publish job that opens test-only fix PRs and posts Slack replies. Resolved this session: the agent's tools could no longer read or leak COLLATE_PAT or the Slack token, the 2h look-back no longer drops alerts during long runs, agent-written playwright code no longer runs with secrets via ✅ 5 closed✅ Security: Allowed tools let the agent read and leak COLLATE_PAT and the Slack token
✅ Edge Case: 2h look-back drops alerts while a run of up to 5h is in progress
✅ Quality: Triage dedupe marker and verification thresholds exist only in prose
✅ Security: Agent-written playwright/ code runs in CI with secrets via 'safe to test'
✅ Bug: One failing fix aborts publish, so no Slack replies get posted
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Adds an agent that triages the flaky Playwright tests posted in #pw-health, for
open-metadata/OpenMetadataonly..github/workflows/flaky-test-triage.yml, hourly or by hand, three jobs:collect(Slack token): gathers OSS alerts withFLAKYlines and noFlaky triagereply, plus a week of alert threads for the dedupe. If nothing is pending, the run stops before starting a stack or calling Claude.triage(read-onlygithub.tokenonly, no PAT, no Slack token): starts an OpenMetadata stack, then runs Claude Code (claude-opus-5-5) overskills/flaky-test-triage/SKILL.md. For each flaky test it:playwright-blob-*artifacts;It writes fix branches, PR bodies and thread replies as files.
publish(COLLATE_PAT+ Slack token, runs no agent code):flaky-fix/…branches that change nothing but Playwright test code (e2e/,utils/,support/,constant/,fixtures/,test-data/).UIandskip-pr-checksand assigns the test owner.Fix PRs do not get
safe to test: a maintainer reads the agent-written diff before adding the label that runs it with repo secrets.COLLATE_PATis used rather thangithub.tokenbecause PRs made withgithub.tokennever trigger their checks. The rules are recorded in ADR:2026-10-29-flaky-test-triage-agent-writes-nothing-itself.Prerequisites: a repo secret
ANTHROPIC_API_KEY(orCLAUDE_CODE_OAUTH_TOKEN).COLLATE_BOT_SLACK_TOKENneedschannels:history(already works) andusers:read.email; without the latter, mentions fall back to@github-login.Trial: the
pull_requesttrigger markedTRIAL ONLYruns the agent for real on one alert from the last 24h. Remove it before merge.No linked issue: this is internal CI tooling.
Type of change:
Tests:
Unit tests
.github/scripts/tests/test_flaky_triage.py(7 passed) covers:FAILED-only alerts;safe to testnever being auto-applied;Manual testing
collectjob reads #pw-health and picks an alert. Thetriagejob is blocked until the Claude secret is added.Checklist:
🤖 Generated with Claude Code
Summary by Gitar
github.token; separatepublishjob without agent code pushes fix branches, opens PRs, and posts repliesflaky_triage.pywithcollectandpublishcommandsflaky-fix/branches changing files underplaywright/are publishedFlaky triagemarkerFlaky triagereply are skipped2026-10-29-flaky-test-triage-agent-writes-nothing-itselfThis will update automatically on new commits.