fix(ci): classify agent authorship with python3 instead of Ruby - #155
Merged
Conversation
The reusable agent-authorship-label workflow fails fleet-wide with `ruby: command not found` (exit 127) on every pull_request_target event: callers pin it by SHA at a revision whose classify step runs `ruby org-defaults/.github/scripts/classify-agent-authorship.rb`, and the resolved PUBLIC_PR_VALIDATION_RUNNER image no longer ships Ruby. Provisioning Ruby at runtime (ruby/setup-ruby) is a live tool install, which the repo rail reserves against and which #153 already removed from the other org reusable workflows. Follow that established pattern instead: port the classifier to python3 (standard library only), which is proven to exist on every runner image we operate, and assert the toolchain up front with a preflight so a missing interpreter fails loudly instead of after a silent skip. The Python port matches the Ruby original on 65 differential cases (plus identical file-arg and --github-output behavior) covering complete, incomplete, mixed, case-varied, whitespace-varied, unicode, nested commit.message, and empty inputs. Consumers pin this repo by SHA and must bump their `uses:` ref to pick up this fix; the SHA pinned in evalops/platform#5205 cannot be retrofixed. Refs evalops/platform#5205
Python str.splitlines() also splits on \v \f \x1c-\x1e \x85 U+2028 U+2029, which jq emits literally inside JSON strings — a commit message containing one tore a JSONL record into unparseable fragments and crashed the classify step. Ruby's each_line splits on "\n" only; match it exactly.
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.
Root cause
agent-authorship-labelfails fleet-wide on everypull_request_targetevent since ~2026-07-26T19:35Z withruby: command not found(exit 127). Callers pin the reusable workflow by SHA (@45c31c99), whose classify step runsruby org-defaults/.github/scripts/classify-agent-authorship.rb. The resolvedvars.PUBLIC_PR_VALIDATION_RUNNER || 'ubuntu-latest'image no longer ships Ruby — run history pins the regression to the runner image/routing change, not any PR diff.Fix
Per the repo rail (required CI jobs must not depend on live tool installs) and the precedent set in #153 (
ci: remove the ruby dependency from the org reusable workflows), the classifier no longer uses Ruby at all:classify-agent-authorship.rb→.github/scripts/classify_agent_authorship.py(standard library only). python3 is proven to exist on every runner image we operate, so there is nothing to install.ruby/setup-rubystep (a live tool install) and added a preflight step assertingpython3exists before classification, matching the pattern incodex-rails-check.yml— a missing interpreter now fails loudly with a named error.test/classify_agent_authorship_test.py, stdlib unittest) and updated the workflow guard test to enforce the python3-no-Ruby contract instead of the setup-ruby contract.Validation
commit.messagevs top-levelmessage, missing message, and empty input.--github-outputappend behavior verified byte-identical to the Ruby original.python3 -m unittest discover -s test -p '*_test.py': 4 tests OK.ruby -Itest test/workflow_pr_ref_guard_test.rb: 4 runs, 22 assertions, 0 failures.Note for consumers
Consumers pin this repo by SHA, so the
@45c31c99pin cited in the platform issue cannot be retrofixed — callers must bump theiruses:ref (andhelper_refif overridden) to a revision containing this change.Refs evalops/platform#5205 (cross-repo: closing keyword won't auto-close from this repo, so this is a reference — please close evalops/platform#5205 once caller pins are bumped).