Repository navigation
feat(webhook): A job may carry a job label that pins its runner to it - #57
Merged
Merged
Conversation
…mpt>-<rest> A job label of another run or attempt, two job labels, or one naming no job is ignored, and the log line says why. A job without it is served as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…label Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
How to write the label in runs-on (the job key by hand, since github.job is empty there), in a reusable workflow, and GitHub's label length limit, each measured in a scratch repo on 2026-11-20. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cked after the shape A job label without its run and attempt was logged as another run's; one over 255 characters, which GitHub refuses or cuts as a runner label, was enqueued. A job outside the label contract is now ignored silently whatever job label it carries. One isJobLabel test serves both checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sodre
marked this pull request as ready for review
November 21, 2026 01:36
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.
Closes #55
Summary
A job can now carry a job label,
ci-job-<run_id>-<run_attempt>-<job key>-<matrix index>, and the runner launched for it registers with that label, so no other labelled job can take that runner. A job without the label is served exactly as before. The label is optional for now; #56 Require the job label, and remove the swap repair makes it required.What a reader should know:
runs-on,github.jobevaluates to an empty string, soci-job-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}-${{ strategy.job-index }}gives every job in a run with no matrix the same label. The docs therefore tell consumers to type the job key by hand. The webhook check is unaffected: it reads only the run and the attempt. This is a choice the ticket left open (it asked whatgithub.jobevaluates to).ci-job-label it carries.The three questions, answered
Each was measured on 2026-11-20 in the private scratch repo
zeroae/foresight-migration-scratch. A probe workflow'sruns-onheld only labels no runner has. I read the queued jobs' evaluatedlabelsback withGET /repos/.../actions/runs/<id>/jobs, then cancelled the runs and deleted the probe branch.strategy.job-indexin a job with no matrix evaluates to0insideruns-on. A two-entry matrix gave0and1. The docs use it in every form.github.jobevaluates to an empty string insideruns-on, in a plain job and in a reusable workflow's job alike. Both gaveci-job-<run>-1--0. Two calls of one reusable workflow got the same label,ci-job-<run>-1--0, unless an input differed:call: agave...-0-a. So the docs tell consumers:${{ strategy.job-index }}in that input too (probed:call-mat-0,call-mat-1).All three documented forms were checked the same way: an array
runs-onwith an expression item,cond && fromJSON(format('[...]', ...)) || 'ubuntu-latest', and the reusable workflow with an input.GitHub's runner label limit is 255 characters. I called
POST /repos/.../actions/runners/generate-jitconfigwith labels of 100, 200 and 255 characters: all were stored whole. A 256-character label was accepted but stored cut to 255. Labels of 257 and 300 were refused:Labels must be less than 256 characters in length. Every probe runner was deleted after. A 98-character job key is accepted, and a 100-character one is a workflow file error. So the longest likely label is under 130 characters (11-digit run id, 2-digit attempt, 98-character key, 3-digit index) plus a reusable workflow's input.Evidence
labelsci-job-label naming another run, or another attempt, is ignored with a log line naming the reasonci-job-labels, orci-job-<run_id>-<run_attempt>-with nothing after it, is ignorednode --test test/*.test.js(no existing test body changed; the shared payload helper gainedrun_attempt: 2, a field GitHub always sends)docs/adr/0004-…, ADR 0003's added line,docs/stack.md"The job label",docs/traps.mdandGLOSSARY.mdand found them complete; the written forms were run in the scratch-repo probe abovegenerate-jitconfigcalls under "The three questions, answered"node --test test/*.test.js200 !== 202jobLabelFault: both failed (no log line)toLowerCase()removed before the match: failedjob label of another runci-job-labels filtered out of the JIT mint: failednode --test test/*.test.json dc848c9: 205 tests, 205 passed, 0 skipped, 0 failed.make build:build/template.yaml80,332 of 1,048,576 bytes.Not run: a live run on the stack (
docs/runbook.md"Proving a change live"). The webhook change is covered with fakes. No consumer carries the label yet, so a live run would need a hand-made workflow; it is first exercised when a consumer adopts the label.Merge Danger
Door: two-way. A revert drops the job label from the contract: a job carrying one is then ignored as outside it (
ignored: labels) until its workflow drops the label.Blast Radius: queued jobs that carry a
ci-job-label (none today).The merge changes the webhook Lambda only, inlined into the template, and deploys with
make deploy. No image, no new infrastructure, no IAM change, no flag. Jobs without the label behave as before.Reviews
Correctness, Standards, Spec and Security, two rounds: 12 findings, each with its outcome
Correctness, round 1 (c55cf70, medium)
ci-runner:labelstag, which is cut to 256 characters (and sanitized on ECS), so a long job label could come back damaged. Pushed back: it needs a job label of about 215 characters or more, against a likely maximum under 130; and Require the job label, and remove the swap repair #56 Require the job label, and remove the swap repair deletes this code.ci-job-444-tests-0) was logged asjob label of another run. Fixed: its own reason,job label without its run and attempt.job label over 255 characters.ci-job-label was logged. Fixed: the job label is checked after the shape.run_attemptrejects every labelled job. Pushed back: github.com'sworkflow_jobpayload always carriesrun_attempt, and without it only labelled jobs are refused, with the reason logged.ci-job-prefix test was written twice. Fixed: oneisJobLabelhelper.Standards, round 1
why.slice(13)in a test title. Fixed: the table carries the title's phrase.isJobLabelhelper.why(as 2). Fixed: its own reason.Spec, round 1: no findings.
Security, round 1 (run because this repo has no security-path list): no findings.
Correctness, round 2 (dc848c9, low): no findings. Standards, round 2: no findings.
Spec, round 2
Security, round 2: no findings.
Tracking
Epic: none
Spec: none
Ticket: #55 A job label pins each runner to the job it was launched for
Flag: none
🤖 Generated with Claude Code