Repository navigation
fix(ci): start the dispatch trust window at the Dispatch job's start - #18662
Conversation
verifyDispatcher bounds a dispatched run's created_at by the earlier of
the dispatcher run's updated_at and WINDOW_MS (10 min) after its
run_started_at. A pr-dispatch-feedback.yml run whose Dispatch job waits
for a runner loses that window: on run 45299457551 the job waited 10m21s
and dispatched 42 s after it started, 11m04s after the run started, and
the gate refused it with untrusted-actor.
For a workflow_run dispatcher the cap now runs from the started_at of
the dispatcher attempt's one started job named Dispatch, read through
GET /actions/runs/{id}/jobs. created_at must still be no earlier than
run_started_at and no later than updated_at. A failed jobs read, or no
started Dispatch job at the dispatcher's attempt, refuses with
untrusted-actor; there is no fallback to a wider window. The push,
schedule and workflow_dispatch dispatcher (pr-unblock-dispatch.yml) and
the pull_request_target dispatcher keep the window from run_started_at.
The comment lint refused a rewrite of the comment on WINDOW_MS, so it
is deleted. It said the dispatcher dispatches within seconds of
starting, which holds only without a runner wait; the rule now is that
a dispatch must come within WINDOW_MS of the dispatcher run's start, or
of a workflow_run dispatcher's Dispatch job's start, so a runner wait
does not count, and a longer run must not keep its window open.
The lint also refused the doc comment above verifyDispatcher, so it is
deleted; the README's dispatcher section
states the same rules. Its content, updated: a dispatch sent by
github-actions[bot] names no human, so it is trusted only through the
dispatcher run it names: that workflow, on the default branch, started
by a push, a schedule or a listed human, its head SHA an ancestor of the
branch tip, a re-run attempt started by a listed human, its record
listing this run, and this run, the dispatched workflow on the default
branch, created between the dispatcher run's start and the earlier of
its last update and WINDOW_MS after its start (for a workflow_run
dispatcher, after its Dispatch job's start). A dispatcher started by
workflow_run must be runDispatcherWorkflow instead, and no actor of it
is checked: the upstream run its record names must be one of
runDispatcherUpstreams, run on pull_request in this repository, started
(and any re-run) by the lanes App or a listed human, at the PR's current
head or at expectedUpstreamHead with the PR at it or at pushedCommit
(upstreamHeadHolds). An upstream of runDispatcherRelay instead must have
run on pull_request_review_comment, name the PR among its pull_requests,
and be started (and any re-run) by a listed human, never the lanes App
(ADR 0088). A dispatcher started by pull_request_target vouches for a
pr-refine.yml run only: its head repository is this one, one
pull_requests entry names this PR on the default branch with base and
head in this repository and the run's head_branch as head ref, its actor
and triggering actor are the lanes App or a listed human, and the
ancestry check reads the commit its record names in place of head_sha
(ADR 0090). Returns this run's own record.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UJUn7MnPkm1aG9ivrZ2Enp
|
Held for the owner: this changes check-trusted-trigger, a security control's mechanism (R388). Merge only on the owner's word; the question is in the GitHub Optimization away report. |
Keeps the Dispatch job window code alongside #18661's merged reconciler re-run path; both had deleted the same doc comment above verifyDispatcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UJUn7MnPkm1aG9ivrZ2Enp
|
Owner decision recorded: https://github.com/melodic-software/architecture/blob/main/docs/owner-decisions.md#L381; verbatim "go w/ recommendations". Hold lifted. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12097fe4b2
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… GitHub response fixtures/api-run-dispatcher-jobs.json is GitHub's jobs listing for pr-dispatch-feedback run 45297965850 (steps dropped), the run whose Dispatch job queued 10m22s before pr-unblock run 45299457551 was refused. The Dispatch and other-job fixtures now spread its job objects, and a new test replays the captured listing with that run's real times. The capture corrects two hand-built assumptions: the other job is named "Post Verify Notes", and a skipped job reports status completed with a started_at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
claude-security-review reviewed Security review: PR #18662, incremental since 9d73328I found no security issues. This lane already reviewed an earlier head, so this pass reported only blocking findings. I read every hunk of all 5 files in the incremental change. What changed. Commit
Three files now import from the new module: Trust-control check. The trusted-trigger directory is a trusted path, so I compared the moved code line by line with what was removed. The logic is the same, with no change in who or what a close is trusted for:
One thing was renamed: the The non-test code that calls these functions is Embedded text: the PR context contains no directives aimed at the review. critical-findings: 0 |
|
claude-review reviewed Code review:
|
…job, and no start time Each new case refuses with untrusted-actor at a dispatch that the window alone would pass. The first two fail when their filter term is removed; the started_at guard is an equivalent mutant at the gate's output, since a NaN window start already refuses in the window comparison, so its case pins the refusal rather than the term. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
check-trusted-trigger.mjs grew to 1012 lines, past the 1000-line size reference. isTrustedClose and appCloseKind decide whether an issue close counts, a concern separate from trigger trust that admit.mjs and label-unblocked.mjs consume. They now live in close-trust.mjs, and those importers and the test read them from there. check-trusted-trigger.mjs gains no import, so the sparse checkouts that list it by name still load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #18665
Siblings: #18661
Summary
verifyDispatcherbounds a dispatched run'screated_atbymin(dispatcher.updated_at, run_started_at + WINDOW_MS), 10 min. A pr-dispatch-feedback.yml run whose Dispatch job waits for a runner loses that window: on #18621 the dispatcher's Dispatch job waited 10m21s and dispatched 42 s after it started, 11m04s after the run started, and pr-unblock run 45299457551 was refused withuntrusted-actor.Fix
check-trusted-trigger.mjs: for aworkflow_rundispatcher (pr-dispatch-feedback.yml), the 10-min cap now runs from thestarted_atof the dispatcher attempt's one started job namedDispatch, read throughGET /actions/runs/{id}/jobs(one more read).started <= createdagainstrun_started_atand theupdated_atbound are unchanged. A failed jobs read, or no startedDispatchjob at the dispatcher's attempt (or more than one), refuses withuntrusted-actor; there is no fallback to a wider window.pull_request_targetdispatcher (pr-merge.yml) keep the window fromrun_started_at; their dispatching job is not named as clearly, so they were left alone.WINDOW_MSand the doc comment aboveverifyDispatcher, so both are deleted; their updated content is in the commit message.Loosened checks
Newly accepted: a dispatch more than 10 min after the dispatcher run started but within 10 min of its Dispatch job's start (GitHub's started_at). Unchanged: the dispatcher workflow, branch and event, the record naming this run, the upstream checks, the updated_at bound. Forging it needs code running inside the default-branch dispatcher job. Seen: #18621, run 45299457551 (Dispatch queued 10m21s).
24 h counts: 1 of 45 runs past the window (#18621 run 45299457551; Dispatch queued 10m21s), which also needed PR A; B alone would have passed 0 runs, A with B passes all 3.
Verification
node --test .github/actions/check-trusted-trigger/check-trusted-trigger.test.mjs: 509 of 509 pass, with fix(ci): accept recorded reconciler re-runs in the dispatcher trust check #18661 merged in.node --test .github/actions/resolve-config/callers.test.mjs(drives the gate's inputs through the action'smain): 306 of 306 pass.workflow_run dispatcher: the window runs from the Dispatch job's start, so a runner wait does not count(Dispatch job queued 10m21s, dispatch 42 s after its start)workflow_run dispatcher: refused with untrusted-actor when...the dispatch came 10m01s after the Dispatch job started,the jobs read fails,the dispatcher run lists no Dispatch job,the Dispatch job is still queued,the Dispatch job listed is of another attempt,the dispatcher run lists two started Dispatch jobs at its attempt,the Dispatch job listed is of another run,the Dispatch job has no start time,the dispatch came after the dispatcher run's last updatedispatcher: a push dispatcher's window still runs from its run's start and reads no jobsworkflow_run dispatcher: the captured jobs listing of a run whose Dispatch job queued 10m22s proceeds(fixtures/api-run-dispatcher-jobs.jsonis GitHub's jobs listing for pr-dispatch-feedback run 45297965850, steps dropped; the job fixtures spread its job objects)Related
verifyDispatcher; the second to merge may need a rebase.🤖 Generated with Claude Code
https://claude.ai/code/session_01UJUn7MnPkm1aG9ivrZ2Enp