Skip to content

refactor(ci): run the demotion filing step from a tested script - #18450

Merged
kyle-sexton merged 6 commits into
mainfrom
refactor/demotion-filer-script
Nov 23, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
refactor/demotion-filer-script

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

No related issue: candidate 17 (part 2) of an /architecture:improve deepening pass over the CI lanes, run in a local session.

Summary

post-merge-file-demotion-issues.yml's "File or comment on the demotion issue" step held its filing logic as a large inline bash body, reachable by tests only through the workflow file.

Fix

  • The step now runs .github/scripts/post-merge-demotion-alert/file-demotion-issue.sh from main's checkout (.base), with the same id, env and outputs. The body moved verbatim, shfmt-formatted; its api-budget wrap sources api-budget.bash relative to the script, as the repository's other self-wrapping scripts do.
  • The script joins the hold floor as a gate row, like the workflow that runs it; sync-hold-floor.py regenerated the floor copies and the pins moved. The job checks out the full .base, so no copy list changes.
  • Portability: the revert-marker regex quotes its literal parts in place of \< and \>, and the gh --jq trims spell \s as [\t\n\f\r ]; both forms give identical gh api --jq output.
  • The stale TODO(#10517) above the record filing is dropped: fix(pr-pipeline): align every needs-human path with the owner stop rule #10517 is closed, and the script's comment scan flags a TODO the workflow's YAML hid.
  • api-budget-coverage.test.mjs gains a test-scope line for the script; no assertion or expected entry changes.

Reasons kept from deleted comments

  • A failed intake hand-off (retry step or this one) fails the job at the step's end and takes no needs-human; the next run retries it.
  • A cancel counts as a failure: pr-require-checks.yml cancels no running full run, so a cancel came from an actor with actions: write or a time-budget overrun. A dispatch replaced in the main-dispatch group before it started is no signal and files nothing. A passing re-run is recorded, never cleared. A dispatched run files on action_required too, matching babysit_postmerge.py's FAILED_CONCLUSIONS.
  • A full run's failed jobs are re-run once and waited on here, since a re-run this token starts raises no workflow_run event. babysit_postmerge credits it only on a run the bot did not start, so pr-merge dispatches are left to the wrapper's re-run; if the wrapper re-ran first the POST fails and the wait reads its attempt. The wait is 20 minutes, or red-main.confirm-wait-minutes (default 55, at most 60, 40 when unread) for a bot-started dispatch. A dispatched red files nothing once a newer full run on main passed (newer-green.bash), checked during and after the wait; a failed lookup keeps waiting, then files.
  • Failing checks follow red-main.mjs's rule (failing-checks.mjs on the runner's node). Judge exit 0 files only quarantine issues; 1 demotes (a baseline-red check whose quarantine expired); any other exit warns and files as before. Quarantine issues are locked and sent to intake, since github-actions[bot] issues start no issues run.
  • Each sighting names its attempt, so a later failing attempt is a new sighting. A full run is charged to every first-parent commit since main's last green full run; compare pages past the first are read only for at most 300 commits, since GitHub lists at most 250 unpaged.
  • Only a merge the lanes App enqueued demotes the lane: the agent identity as actor or enqueuer of each PR's latest AddedToMergeQueueEvent, never the commit author. Anything unproven demotes: a canary, an unknown range, a subject with no (#N), an unreadable identity, a failed lookup.
  • Records are read from both filers (github-actions[bot] and merge.agent-identity); a user-opened issue with the marker cannot stand in. A failed read of the bot's records fails the job; of the identity's, it warns and can only add a record, never drop one. A record matched by its failing run must be a demotion record.
  • Revert detection is anchored at line starts (Reverts #N lists, revert-button subjects, This reverts commit, the red-main revert marker), so prose or another repository names nothing; an unreadable reverted subject is an unproven revert and demotes. The canary push range is at most 20 commits, the newest 20 when the previous head cannot be read.
  • A cut or guessed range gets no lift block, since one that understates the deletion would lift the record; a record without a block clears only on a person's close. The file-revert job files the revert record with issues: write alone; outputs are written before anything can fail the step, as the runner keeps a failed step's outputs.
  • has_block reads columns with awk, not read: with IFS=$'\t', read merges empty tab-separated fields, so an empty Failing run column would shift column 7.
  • An existing record matches on either marker, so an attempt whose lookup would answer differently still updates the record filed first.
  • A canary record filed without a lift block (babysit_postmerge.py has no checkout to scan) gets it as a comment, once.
  • A canary or over-cap record gets no dimensions because a person holds and sizes that work; any other record is only read and closed while its fix issues carry the work, hence needs-triage critical small low known.
  • A commit subject is rendered in code font without backticks, so it mentions no one.
  • Fix issues: one per newly failing check, at most 5, with fixed text (a fix_name_ok check name, hex SHAs, the numeric run link, the record number), no label, closing keyword, subject or marker, so no reader takes one for a record. Job names only, never annotation text.
  • A canary record and a full-run record with a check over the cap or outside the charset keep Work status needs-human, as reviewed exceptions to the owner's stop rule; a failed intake hand-off is not one.

Verification

  • After merging current main: demotion shell suite 337 pass; Node suites that read the workflow or script 979 pass, 0 fail; write-runner-never-rules.test.sh 75 pass; test_diff_risk.py 146 pass (PyYAML installed). sync-hold-floor.py --check clean.
  • scripts/check-shell-portability.sh origin/main clean; plan-test-lanes.sh --base origin/main ends unmapped=0; the can't-fail scan flags nothing.

Related

Part of the .github deepening series; follows #18438 (part 1, pr-dispatch-feedback).

🤖 Generated with Claude Code

kyle-sexton and others added 5 commits November 23, 2026 01:45
post-merge-file-demotion-issues.yml's "File or comment on the demotion
issue" step now runs .github/scripts/post-merge-demotion-alert/
file-demotion-issue.sh from main's checkout (.base), with the same id,
env and outputs. The body moved verbatim, shfmt-formatted; its api-budget
wrap now sources the library relative to the script, as the repo's other
self-wrapping scripts do. The script joins the hold floor as a gate row,
like the workflow that runs it. The shell suite, workflow.test.mjs,
demotion-record.test.mjs, label-unblocked and the api-budget tests read
the script; the coverage detector follows a bash-run script to the Node
scripts it runs.

Reasons kept from deleted comments:
- A failed intake hand-off (retry step or this one) fails the job at the
  step's end and takes no needs-human; the next run retries it.
- A cancel counts as a failure: pr-require-checks.yml cancels no running
  full run, so a cancel came from an actor with actions: write or a
  time-budget overrun. A dispatch replaced in the main-dispatch group
  before it started is no signal and files nothing. A passing re-run is
  recorded, never cleared. A dispatched run files on action_required too,
  matching babysit_postmerge.py's FAILED_CONCLUSIONS.
- A full run's failed jobs are re-run once and waited on here, since a
  re-run this token starts raises no workflow_run event. babysit_postmerge
  credits it only on a run the bot did not start, so pr-merge dispatches
  are left to the wrapper's re-run; if the wrapper re-ran first the POST
  fails and the wait reads its attempt. The wait is 20 minutes, or
  red-main.confirm-wait-minutes (default 55, at most 60, 40 when unread)
  for a bot-started dispatch. A dispatched red files nothing once a newer
  full run on main passed (newer-green.bash), checked during and after
  the wait; a failed lookup keeps waiting, then files.
- Failing checks follow red-main.mjs's rule (failing-checks.mjs on the
  runner's node). Judge exit 0 files only quarantine issues; 1 demotes
  (a baseline-red check whose quarantine expired); any other exit warns
  and files as before. Quarantine issues are locked and sent to intake,
  since github-actions[bot] issues start no issues run.
- Each sighting names its attempt, so a later failing attempt is a new
  sighting. A full run is charged to every first-parent commit since
  main's last green full run; compare pages past the first are read only
  for at most 300 commits, since GitHub lists at most 250 unpaged.
- Only a merge the lanes App enqueued demotes the lane: the agent identity
  as actor or enqueuer of each PR's latest AddedToMergeQueueEvent, never
  the commit author. Anything unproven demotes: a canary, an unknown
  range, a subject with no (#N), an unreadable identity, a failed lookup.
- Records are read from both filers (github-actions[bot] and
  merge.agent-identity); a user-opened issue with the marker cannot stand
  in. A failed read of the bot's records fails the job; of the identity's,
  it warns and can only add a record, never drop one. A record matched by
  its failing run must be a demotion record.
- Revert detection is anchored at line starts (Reverts #N lists, revert-
  button subjects, `This reverts commit`, the red-main revert marker), so
  prose or another repository names nothing; an unreadable reverted
  subject is an unproven revert and demotes. The canary push range is at
  most 20 commits, the newest 20 when the previous head cannot be read.
- A cut or guessed range gets no lift block, since one that understates
  the deletion would lift the record; a record without a block clears
  only on a person's close. The file-revert job files the revert record
  with issues: write alone; outputs are written before anything can fail
  the step, as the runner keeps a failed step's outputs.
- A commit subject is rendered in code font without backticks, so it
  mentions no one.
- Fix issues: one per newly failing check, at most 5, with fixed text
  (a fix_name_ok check name, hex SHAs, the numeric run link, the record
  number), no label, closing keyword, subject or marker, so no reader
  takes one for a record. Job names only, never annotation text.
- A canary record and a full-run record with a check over the cap or
  outside the charset keep Work status needs-human, as reviewed exceptions
  to the owner's stop rule; a failed intake hand-off is not one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er-script

The hold-floor files take main's version, regenerated by
sync-hold-floor.py with this branch's file-demotion-issue.sh gate row
beside main's rerun-ci-status.sh row. The floor pins are main's counts
plus that one gate row (high and author-review routes).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
check-shell-portability.sh flagged two constructs the script carried
over from the inline step: the revert-marker regex's escaped angle
brackets and gh --jq's \s. The marker regex now quotes its literal
parts, and the trims spell \s as gojq's own set, [\t\n\f\r ], so both
match exactly what they did. api-budget-coverage.test.mjs reads the
script through its bash-run detector, so it now declares it in
test-scope.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 14:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T14:04:18.892297Z 4ae46d9 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 3b731dd3efc21b002915b44f49807784b6394f11: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental): PR #18450 at 3b731dd3

No security issues found. This was a blocking-only review: this lane already reviewed the earlier head 4ae46d9d.

Scope

The push changes one file, .github/scripts/post-merge-demotion-alert/file-demotion-issue.sh, which is on a trusted path. I read its whole hunk in the incremental diff.

What changed

The push deletes one comment line, # TODO(#10517): move these holds off needs-human., just above record="$(file_issue Bug ...)" (L676).

What I checked

  • Code and labels. No code changed. The set_fields "$record" needs-human critical call that follows is untouched, so the issue the script files and the hold labels it sets behave exactly as they did at the head I reviewed before.
  • Instruction surface. The deleted line is not one. It is a code comment in a shell script, not a rule a model reads at run time, and removing it does not soften any control.
  • Prior findings. The earlier review posted no findings, so none carry over.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 4ae46d9d9fd9b924614073cda37848081239353b; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 3b731dd3efc21b002915b44f49807784b6394f11: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #18450, incremental since 4ae46d9d

Scope. I reviewed only what changed since 4ae46d9d: one file, .github/scripts/post-merge-demotion-alert/file-demotion-issue.sh. The only change is that one comment line is deleted, # TODO(#10517): move these holds off needs-human., which sat above the record filing at L676. No code changed. The deleted line is a TODO pointing at an issue tracker entry. It recorded no reason for a design decision, so the REVIEW.md rule on deleted comments that record a reason does not apply. The PR body says #10517 is closed and that the script's comment scan flags the TODO. I did not check the issue's state myself: this lane has no GitHub access.

Prior finding. The earlier advisory thread listed reasons from deleted comments that were recorded nowhere. The PR body's "Reasons kept from deleted comments" section now covers each of them:

  • the has_block awk-vs-read reason;
  • the either-marker match;
  • the canary lift-block comment;
  • the dimensions for each record kind.

Nothing is left to raise again.

Blocking only. This lane already reviewed an earlier head, so this review reports blocking findings only. There are none.

Loosened checks. The change edits no test or check. Loosened checks would be marked: fail (default: the prompt has no loosened_check_verdict: or loosened_check_patterns: line); patterns: 0. The prompt has no loosened_check_decision_record: line either, so I did not check the citation requirement.

Closing issue. The PR names none, so there are no criteria to check.

Hold / spend. This change bills nothing and spends no extra credits.

Verifier dropped 0 of 0 candidates.

#10517 is closed. Reasons for this branch's other deleted comments are in the PR body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 221fb5f Nov 23, 2026
92 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/demotion-filer-script branch November 23, 2026 14:38
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
kyle-sexton added a commit that referenced this pull request Nov 23, 2026
Main added a gate row to the hold floor (#18450) while this branch added
the cdn-paths.mjs enforcement row. The floor pins carry both: 163 rows,
gate 72, enforcement 66; high and author_review take main's digests,
review takes this branch's. pr-require-checks.yml's hold_patterns is
regenerated by scripts/sync-hold-floor.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant