refactor(agent-workflows): pick the runner inside the gate job - #30
Merged
Merged
Conversation
Fold the runner picker into each agent workflow's gate job, as a step run after actions/agent-gate and guarded on the same proceed output the agent job already checks. A proceeding run now costs one hosted job start instead of two: previously gate and pick-runner each billed a full hosted minute before the agent job even began. Applies to issue-triage.yml, issue-implement.yml, claude-assist.yml, pr-review.yml and deps-verify.yml. Each drops its standalone pick-runner job, adds a runner output to gate, and points its agent job's runs-on at needs.gate.outputs.runner instead of needs.pick-runner.outputs.runner. gate's timeout-minutes moves from 5 (8 for pr-review) to 10, since the picker calls the org API and may retry. issue-triage.yml's workflow_dispatch no-op path (added earlier today) already sets proceed=false before the pick step, so a dispatch with no issue-number still skips the picker. self-test.yml gains an assertion that every agent workflow picks its runner as a step inside gate, guarded on a proceed output, with no standalone pick-runner job left behind. AGENTS.md and README.md are updated to describe the new shape. Status-check contexts: '<caller job> / pick-runner / Pick runner' disappears for these five workflows, since pick-runner is no longer a job of its own there. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.6.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Every agent workflow ran three hosted job starts before the agent step:
gate,then a
pick-runnerjob (a call to the reusablepick-runner.yml), then theagent job on the picked runner. Each hosted start bills a full minute, and the
picker itself does nothing
gatecouldn't host alongside it.This folds the picker into the
gatejob as a step, using the composite actionactions/pick-runner(merged earlier today) directly instead of the reusablepick-runner.ymlwrapper. The picker step runs after the last step that decidesgate'sproceedoutput, guarded byif: <that step>.outputs.proceed == 'true',so it never runs for an event that will not proceed.
gategains arunneroutput, and the agent job (
triage,implement,assist,review,buildindeps-verify) reads
runs-on: ${{ fromJson(needs.gate.outputs.runner) }}and dropspick-runnerfromneeds:.Applies to
issue-triage.yml,issue-implement.yml,claude-assist.yml,pr-review.yml,deps-verify.yml.Per workflow, the step guarding
proceedcomes from:issue-triage.yml:steps.bots.outputs.proceed(covers theworkflow_dispatchno-issue-number no-op path added earlier today, verified below)
issue-implement.yml:steps.check.outputs.proceedclaude-assist.yml:steps.gate.outputs.proceedpr-review.yml:steps.level.outputs.proceed(narrows the gate's own verdictfurther: no changed files, docs only)
deps-verify.yml:steps.gate.outputs.proceedgate'stimeout-minutesmoves from 5 (8 forpr-review) to 10, since thepicker calls the org runner API and may retry.
AGENTS.md's row for this rule is rewritten: the picker now runs inside thegate job, after
agent-gate, conditioned onproceed, so it cannot run for anevent that will not proceed, and it still never precedes the kill switch.
README.md's "Runners" section and theagent:implementfield-comparison lineare updated to match; "When nothing happens" did not mention the picker job and
needed no change.
self-test.ymlgains an assertion that every one of these five workflows picksits runner as a step inside
gate, guarded on aproceed-named output, with nostandalone
pick-runnerjob left behind.Status check contexts
<caller job> / pick-runner / Pick runnerdisappears from these five workflows,since
pick-runneris no longer a job of its own there. Nothing in this repo orits consumers requires that context by name.
Verification
actionlinton all six changed workflow files: clean (only the two documentedcreate-github-app-tokenignores apply, and neither fired).bash actions/agent-gate/test.sh: pass=30 fail=0.bash actions/sticky-comment/test.sh: pass=10 fail=0 (unaffected by thischange, run for completeness).
pointed its
pr-review.ymlandtriage.ymlcallers at this branch on athrowaway branch and draft PR, adding a
workflow_dispatchissue-numberinput to
triage.ymlfor the dispatch test (throwaway change, not part ofthis PR).
pr-reviewrun: run 34698942244, conclusion failure. The job list showed
exactly one hosted job (
gate, which includes the pick step) beforereviewstarted on the picked runner — the fold-in worked. The run thenfailed for a documented, pre-existing reason unrelated to this change:
claude-code-actionself-skips whenever a PR changes a workflow file(this throwaway PR necessarily did), and the existing guard step correctly
turns that skip into a failing job rather than a false green.
triagewith noissue-numberon this branch: run34698826193, conclusion success — clean no-op,
gateran andtriagewas skipped, no pick step or picker job executed.triagewith a throwaway issue number: run 34698804159,conclusion failure. Job list: exactly
gatethentriage, nostandalone picker job — the agent job actually ran on the picked runner.
It failed on the pre-existing "Verify triage recorded its state" check
(the agent did not set
Triage stateon this throwaway issue), unrelatedto this change.
gh run view --json jobson all three runs above that eachhad exactly one hosted job (
gate) before the agent job, never two.throwaway issue.
Internal references stay pinned at
@v1, andactions/pick-runnermerged tomainearlier today, so no temporary re-pointing of the action itself wasneeded — only the reference consumer's caller
uses:pointed at this branch forthe exercise above.
Not verified
Could not exercise a real (non-self-skipped)
claude-code-actionagent commenton
pr-reviewin the live exercise, because any PR that points a caller'suses:at a branch necessarily changes a workflow file, which makesclaude-code-actionskip itself by design until the change reaches the defaultbranch. The infra-level behavior (gate picks the runner, exactly one hosted job,
agent job dispatched) is confirmed regardless.
🤖 Generated with Claude Code