Repository navigation
Conversation
… gate pull_request.branches:[main] on 34 workflows meant a PR based on anything but main ran zero unit tests, lint, or agent suites while still looking green (#2599 merged email-agent changes with 0 email tests, 0 unit tests, 0 lint). Removed that filter from the pull_request trigger only, leaving push:[main] untouched so main-push validation runs are unaffected. build_tui.yml is deliberately left alone here — PR #2696 already widens that one's trigger. Also adds a Required Checks Gate (.github/workflows/required_checks_gate.yml) that closes the class rather than just this instance: it derives which checks should have run for a PR's changed files directly from every other workflow's own pull_request paths/paths-ignore filters (.github/scripts/check_required_status.py), then polls the Checks API for the PR's head SHA and fails if a relevant check never reports, or reports stuck at "skipped" — the exact signature of #2755's ready_for_ci gap, since that job's own trigger never listens for the label that would re-run it.
A job-level if: mirroring the audited jobs' own draft-gate meant the gate skipped on exactly the PRs where it mattered most: this repo's default draft-without-ready_for_ci state. That reproduces #2767's own bug inside the mechanism meant to catch it — suites skip, gate skips too, checks page reads green over zero coverage. The gate job now always executes and self-posts a Checks API check-run (gh api .../check-runs, checks:write) with an explicit conclusion instead of relying on its own native job status: neutral while the PR legitimately hasn't asked for CI yet (draft, no ready_for_ci label — named in the check's own summary), success once the relevant suites verifiably passed, failure otherwise. Neutral doesn't block a merge on its own, matching GitHub's branch-protection semantics for a neutral required check, so this is visible without being noise. The native workflow-job check is renamed "(runner)" to make clear it only reflects whether the script executed, not the real verdict.
Live evidence on the throwaway PR (#2775) surfaced a real bug: the bare 'Test' prefix (test_hub_agents.yml's matrix-templated job) was also matching OTHER prefix-mode jobs' rendered names (Test Apps Build (jira), Test MCPAgent (ubuntu-latest)) because the reserved-names guard only covered static names, not other prefixes. The verdict came out right that run (both were legitimately still skipped), but the failure message misattributed which job was actually failing. Replaces the reserved-names dict with a general most-specific-owner rule: every check-run name belongs to whichever job's matcher matches it most specifically (exact beats any prefix; among prefixes, the longer one wins), computed across every job in every workflow file regardless of exclude or trigger type.
Live evidence on the throwaway PR (#2775) showed this: the repo's auto-labeler added labels shortly after the PR opened, firing a second labeled event for the same SHA while the gate was still polling. With cancel-in-progress: true, that killed the in-progress run before it ever called post_check_run() — benign here only because a further run happened to supersede it. If a cancelled run is ever the LAST triggering event for a SHA, the check silently never posts at all: a fourth way to fail open, inside the fix for the other three. Queuing costs run time on a burst of events but guarantees every trigger eventually gets a real, posted verdict.
Verdict: Approve with suggestionsThis PR closes a real CI gap: PRs targeting non- One behavioral inconsistency is worth fixing before or shortly after merge, but it isn't a merge blocker because it fails closed rather than open:
Real-world evidenceN/A — CI-only change (workflow YAML, a helper script, and its unit tests); no runnable GAIA CLI/API/Agent-UI/MCP surface to exercise. The gate's core logic is covered by 🔍 Technical details🟡 Important1.
So following the neutral summary's own instruction ("add the
(The nuance: the label does work when it's already present at 🟢 Minor2. 3. Latent trap: any legitimately-skipped PR-triggered job becomes a terminal failure. The gate requires every Strengths
|
The gate failed on its own PR (#2783), and replaying that PR's real Checks API history through evaluate() (not synthetic fixtures) found the actual causes and took total failures 55 -> 1 (the one remaining is the pre-existing, self-documented build_cpp_email.yml scaffold guard for #1110, unrelated to this change). Root cause, unified: GitHub never deletes a check-run — every triggering event (opened, then labeled, then reopened) adds new rows alongside old ones. evaluate() collected the full history for a SHA and gave any bad match unconditional priority over good ones, with no notion of recency. A five-minute-old stale skip was masking a fresh, real pass sitting right next to it in the same API response. Fixed with an exact rule, not a tuned time-window (the observed gap between stale and fresh ranged from about a minute to several minutes on real data, so no fixed window reliably separates "same event" from "different event"): dedup by exact check-run name keeping only the newest, then discard any pre-expansion artifact older than the newest real entry for that requirement. A pre-expansion artifact is decidable two ways, not one — the second was found the same way, by replaying real data: a job's name containing literal "${{ }}" (skipped before its matrix ever expanded), OR a job whose name has no template at all but does have a strategy.matrix, where GitHub still auto-appends "(leg, values)" to every real rendered check-run, so a real run can never produce the bare, un-suffixed name matching the job's declared name. Also: a job gated on a tag ref (`startsWith(github.ref, 'refs/tags/')`) can never run on a pull_request event at all — unlike needs.*, this is statically decidable, not just excluded on uncertainty. Every exclusion (continue-on-error, needs.*-gated, tag-ref-gated) is now named in the gate's own posted summary, not silently dropped from the required set — "enforced N/M requirements; excluded K (kind: count, ...)" with each one's reason. Messaging: the neutral and failure summaries now say label AND close/reopen, not label alone — the audited suites don't listen for `labeled`, so the label by itself cannot re-trigger them. Failure text also splits "did not run" (stuck at skipped, needs a re-trigger) from "ran and did not pass" (a real failure), since they need different advice. 6 new unit tests reproducing the real shapes found live: stale skip masked by fresh pass (both artifact forms), a genuine failure not masked by a stale skip nearby, latest-entry-still-skipped staying failed (not silently passing), a re-skip after a real pass still reported as current, and the exclusion-count summary itself.
|
Addressed the messaging gap you flagged: the neutral and failure summaries now say label AND close/reopen (not label alone) — the audited suites don't listen for the |
|
Verdict: Request changes (one concern to confirm; otherwise a strong, well-tested PR) This adds an aggregating "Required Checks Gate" that derives what should have run from every workflow's own The one thing to resolve before this becomes a required check: it needs to write check-runs, but PRs from forks get a read-only token — so on external-contributor PRs the gate will likely fail to post its verdict and error out. Please confirm the behavior against a real fork PR; if this is required in branch protection, it could block every fork contribution. See details below. Real-world evidenceN/A — CI/infra-only change (no CLI/API/agent/UI/MCP surface), so no evidence bundle applies. The runnable surface here is GitHub Actions itself. Correctness rests on the committed unit suite ( 🔍 Technical details🟡 Fork PRs get a read-only 🟢 🟢 Strengths
|
|
Integration-tested against the other four PRs from this run (#2774, #2782, #2784, #2788) on a combined branch — all five merged cleanly with no conflicts, and this branch's own scope (CI trigger widening + the required-checks gate) is orthogonal to the other four's email-agent code, so it carries no TUI/runtime surface of its own to re-verify here. Integration details
Integrated tree: |
Fork PRs get a read-only GITHUB_TOKEN for `pull_request` (not `pull_request_target`) regardless of the workflow's declared permissions. The gate posted its verdict via a self-managed Checks API check-run needing checks:write — a required check that can only post via a permission forks don't have would block every fork contribution to this repo. Confirmed live, not assumed: inspected a real fork PR's job log (#2753, "Dependency Review", plain pull_request trigger, declares pull-requests: write) and it logged "GITHUB_TOKEN Permissions: Contents: read, Metadata: read, PullRequests: read" -- write silently dropped to read. checks:write downgrades identically. The binding signal is now this job's own native exit code -- available with zero special permissions, identical on same-repo and fork PRs. neutral and success both exit 0 (a draft PR without ready_for_ci can't be merged regardless of check status -- GitHub blocks merging any draft PR at the platform level -- so there's nothing to protect by failing here), only a genuine failure or timeout exits 1. The richer three-state distinction isn't dropped: write_step_summary() puts it in the job's own Actions summary (no permissions needed, works on forks), and post_check_run() still attempts the richer, distinctly-colored "Required Checks Gate (detail)" check-run wherever the token allows it -- best-effort, catches its own failure, logs a clear warning, never raises, never fails the job. Renamed: the job itself is now "Required Checks Gate" (the one to add to branch protection); the API-posted check-run is "Required Checks Gate (detail)" (informational, same-repo only). 4 new unit tests: post_check_run() returns False (not raise) on a simulated 403, returns True on success, and write_step_summary() both no-ops without GITHUB_STEP_SUMMARY set and writes correctly when it is.
Pull request was converted to draft
|
Addressed the fork-PR gap: the gate previously bound branch protection to a self-posted Checks API check-run needing Fixed by making the job's own native exit code the binding signal (renamed to Full reasoning, including what happens to the draft-PR neutral case, is in the PR description. |
|
Closing this — the premise it was built on doesn't hold up. The concern in #2767 was that a PR based on a branch other than The exact case #2767 cited proves it. #2599 (base
So The Required Checks Gate is a separate idea and a bigger one. If the latency is worth addressing, the proportionate version is a small PR widening only Notes for anyone picking this up
#2767 should probably be closed or rewritten too — its acceptance criteria are built on the same premise. |
Closes #2767
A PR based on anything but
mainran almost no CI — no unit tests, no lint, no agent suites — and its checks page looked healthy the whole time, becausepull_request.branches: [main]filters on the PR's base, not its head. Verified live just now: #2599 (merged, base a feature branch) still shows exactly 16 checks, none of them email/unit/lint; #2757 (main-based control) shows 46+ including all of them. After this change, the same class of PR gets the full suite — proven on a real throwaway PR against a non-mainbase, where 9+ suites that had run zero times on that base before this change all went green. A second, independent mechanism — a required checks gate — turns any future silent skip into a visible, named check instead of a checks page that simply omits rows.Building the gate found real bugs twice over — both times by replaying real API data, not by trusting synthetic tests. Live on the throwaway PR, a bare job-name prefix (
"Test") was silently cross-matching other jobs' rendered check-run names. Fixed and covered with a unit test. Then the gate itself failed on this very PR — replaying #2783's actual Checks API history through the classification logic (rather than trusting the 27 tests that existed at that point) took total failures from 55 to 1, and surfaced two more real bugs no amount of reasoning from the YAML alone would have found: GitHub keeps every historical check-run for a SHA forever, so a five-minute-old stale skip was masking a fresh, real pass sitting right next to it in the same API response; and a job with a static name plus a matrix (no${{ }}anywhere) gets GitHub's own auto-appended(leg, values)disambiguator on every real run, which exact-matching on the bare name never catches. The one remaining "failure" after all three fixes isC++ Email Agent— a pre-existing, self-documented scaffold guard for the separate C++ email milestone (#1110), unrelated to this change.Test plan
python util/lint.py --allcleanpytest tests/unit/— 8842 passed, 146 skipped, 8 pre-existing failures unrelated to this change (binary-on-PATH / hub-wheel-install / VLM-extraction / a documented nested-worktree API-key artifact — none touch.github/or the files this PR adds)pytest tests/unit/test_check_required_status.py— 43 tests, all passing, proving the gate's classification logic (including every live-found bug below, and the fork-PR degrade path) by constructionWhat changed and why
1. Widened the PR trigger on 34 workflows. Removed
branches: [main]frompull_request:only —push: branches: [main]is untouched, so main-push validation is unaffected and there's no duplicate-run risk (different event types; a feature-branch push never matchedpush:either way). This follows a pattern already used elsewhere in the repo (docs.yml,pypi.yml,website-ci.yml,check_doc_links.yml, …) rather than inventing an allowlist.build_tui.ymlis deliberately excluded — PR #2696 already widens that one; touching it here would collide.Audited all 34 for PR-triggered side effects before touching them: only
dependency-review.ymldoes anything beyond test/lint, and only posts a PR comment on failure.Intended trade-off, stated plainly: most of these 34 workflows already list their own
.github/workflows/<file>.ymlin theirpaths:filter — an existing "if you touch my CI config, re-validate me" convention, not something this PR introduced. Because this PR edits all 34 at once, essentially every one of them becomes required for this diff — confirmed by checking each one'spaths:, not assumed. That's heavy by design: a workflow-config change legitimately re-validates the whole matrix. A normal single-workflow change afterward won't have this effect.2. A required checks gate that derives what to check instead of hand-listing it. Cross-workflow
needs:doesn't exist in GitHub Actions, so this can't depend on the other workflows directly —.github/scripts/check_required_status.pyparses every workflow's ownpull_requestpath filters at run time and derives what's required for a given diff, so a new workflow is covered automatically, nothing to remember to update here.Not a false green, not noise — always runs and always decides. The gate deliberately does not carry the draft-gate
if:the 34 audited workflows use. Mirroring that would reproduce this issue's own bug inside the fix: on a draft PR withoutready_for_ci(this repo's default state for an open PR), the audited suites skip and the gate would skip too — nothing red, checks page still green, zero coverage. Instead the gate always runs, and reports through two channels — see the fork-PR section below for why there are two, and why only one of them is the thing to make required.The required check is the job's own native status —
Required Checks Gate— not an API-posted one, because of a fork-PR gap found on this PR itself. The original design self-posted a richer three-state (neutral/success/failure) check-run via the Checks API, needingchecks: write. Confirmed live, not assumed: GitHub silently downgradesGITHUB_TOKENto read-only forpull_request(notpull_request_target) on a fork PR regardless of what a workflow'spermissions:block declares — inspected a real recent fork PR's job log (#2753's "Dependency Review", which declarespull-requests: write) and its own "Set up job" step printedGITHUB_TOKEN Permissions: Contents: read, Metadata: read, PullRequests: read.checks: writewould be downgraded the identical way. A required check that can only post via a permission forks don't have would block every fork contribution to this repo — the opposite of what "required" should mean.So the native job exit code — needs no special permissions, identical on same-repo and fork PRs — is the binding signal now, and that's what belongs in branch protection / the merge queue.
neutralandsuccessboth map to exit 0 (pass): a draft PR withoutready_for_cican't be merged anyway regardless of check status — GitHub blocks merging any draft PR at the platform level — so there's nothing to protect by failing here, and reflexive red on every draft was already rejected as noise. Only a genuine failure or timeout exits 1. The neutral/success distinction isn't lost, just moved to two channels that need no elevated permissions either: the job's own Actions step summary (works identically on forks), and a second, purely informational check-run —Required Checks Gate (detail)— that the job still attempts to post wherever the token allows it (same-repo PRs). That call is wrapped so a 403 logs a warning and the job carries on; it's never what branch protection depends on.Recency: GitHub never deletes a check-run. Every triggering event (opened, then labeled, then reopened) adds new rows alongside old ones. The gate used to give any bad match unconditional priority over good ones regardless of age. Fixed with an exact rule, not a tuned time-window — the observed gap between a stale skip and its real re-run ranged from about a minute to several minutes on real PRs in this repo, so no fixed window reliably separates "same event" from "different event." Instead: dedup by exact check-run name keeping only the newest, then discard any pre-expansion artifact older than the newest real entry for that requirement. A pre-expansion artifact is decidable two ways: a name containing literal
${{ }}(job skipped before its matrix ever expanded), or — the one caught only by replaying real data — a name with no template at all but a matrix, where GitHub auto-suffixes every real leg with(leg, values), so a real run can never produce the bare name the requirement is keyed on. A pre-expansion artifact newer than every real entry is kept, not discarded — that's a genuine re-skip (e.g. the PR went back to draft after a real pass), and the gate has a named test making sure that case still fails closed.Exclusions are reported, not silent. Three job shapes can't be statically verified from YAML alone:
continue-on-error: true(the job's own author already declared it non-blocking), anif:referencingneeds.*(gated on another job's runtime output — e.g.build-electron-apps.yml'sbuild-apps, whose matrix is also dynamically generated viafromJson(needs.discover-apps.outputs.matrix)), and anif:gated on a tag ref (startsWith(github.ref, 'refs/tags/...')— unlikeneeds.*, this one is statically decidable, sincegithub.refon apull_requestevent is never a tag ref). All three are excluded from the required set, but every posted check-run summary now states the ratio and breakdown —"Enforced N/M requirements; excluded K (needs-gated: a, continue-on-error: b, ref-conditional: c): <name> (from <file>): <reason>; ..."— so a future job silently dropping out of scope is visible, not a repeat of this issue's own bug with a new mechanism.Messaging distinguishes "did not run" from "ran and failed." The neutral and failure summaries now say label and close/reopen, not label alone — the audited suites don't listen for the
labeledevent (only this gate does), so the label by itself cannot re-trigger them; #2755's own text describes close/reopen alone as sufficient, but that was observed on a non-draft PR and doesn't hold for this repo's default open-PR state (measured live, companion issue #2763, PR #2782). The failure text also splits "stuck at skipped, needs a re-trigger" from "ran and genuinely failed" — different states, different advice.Concurrency: queue instead of cancel. The gate's own workflow originally used
concurrency: cancel-in-progress: true. Live on the throwaway PR, this repo's auto-labeler fired a secondlabeledevent mid-poll and cancelled the in-progress gate run before it ever posted a check-run for that SHA — benign that time only because a later run happened to supersede it and try again. If a cancelled run is ever the last triggering event for a SHA, the check silently never posts at all: a fourth way to fail open, shipped inside the PR meant to close the other three. Fixed by queuing instead (cancel-in-progress: false) — costs some run time on a burst of events, guarantees every trigger eventually gets a real, posted verdict.Evidence
Before — re-verified live with
gh pr checks, not quoted from the issueAfter — throwaway PR (#2775, closed/deleted) against a non-main base
Base branch
evidence/2767-fake-base(a plain, non-mainbranch), head touchinghub/agents/email/python/**+src/gaia/agents/base/**. Two states captured:State 1 — draft, no label. The audited suites now genuinely register (not absent, as before this fix) but correctly show
skippingper their own draft-gate — this itself is new: pre-fix, a non-main-based PR wouldn't show these rows at all. The gate's self-posted check:State 2 —
ready_for_cilabel added (still draft) → suites actually run. Realgh pr checks 2775output, non-skipped rows:Nine of these are the exact suites named in the issue's own table (email / unit / lint) — all ran zero times on a non-main base before this change.
Also caught live on this same throwaway PR: adding
ready_for_ciwhile still draft (no push) correctly left the audited jobs stuck atconclusion: skipped— sincelabeledisn't a type they listen for — and the gate (which does listen forlabeled) reportedfailurefor exactly that reason. That's the #2755 class of bug, reproduced and caught live, not constructed.The gate failing on its own PR (#2783), and going green — the replay evidence
Real
gh api repos/amd/gaia/commits/<sha>/check-runsoutput for #2783's own head SHA, replayed offline throughevaluate()before and after each fix (script:python -c "..."against the actual API response, not a hand-written fixture):Live check on the real PR after pushing the fix — the gate's own posted verdict, matching the replay:
After the fork-PR fix (both check names now exist and agree, on this same-repo PR):
Required Checks Gate(no permissions needed, works identically on forks) is the one to add to branch protection;(detail)is the same-repo-only, richer, best-effort companion.This PR does not go green on itself, and that is correct, not a bug.
C++ Email Agenthas been red onmainitself for months —gh run list --workflow=build_cpp_email.yml --branch mainshowsfailuregoing back to at least June 3 — a pre-existing, self-documented scaffold guard for the separate C++ email milestone (#1110), unrelated to this change. This PR touches every one of the 34 widened workflow files, includingbuild_cpp_email.yml, so it can't avoid becoming the one PR that surfaces this genuine, already-broken check. Making the gate ignore it would mean teaching it to special-case a real failure — exactly the kind of quiet exception this issue exists to close. A gate that went green here would be a gate that lies; one real check failing, reported accurately, is the correct outcome.