Skip to content

fix(ci): classify agent authorship with python3 instead of Ruby - #155

Merged
haasonsaas merged 2 commits into
mainfrom
fix/agent-authorship-ruby
Jul 27, 2026
Merged

fix(ci): classify agent authorship with python3 instead of Ruby#155
haasonsaas merged 2 commits into
mainfrom
fix/agent-authorship-ruby

Conversation

@haasonsaas

@haasonsaas haasonsaas commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Root cause

agent-authorship-label fails fleet-wide on every pull_request_target event since ~2026-07-26T19:35Z with ruby: command not found (exit 127). Callers pin the reusable workflow by SHA (@45c31c99), whose classify step runs ruby org-defaults/.github/scripts/classify-agent-authorship.rb. The resolved vars.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:

  • Ported 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.
  • Dropped the ruby/setup-ruby step (a live tool install) and added a preflight step asserting python3 exists before classification, matching the pattern in codex-rails-check.yml — a missing interpreter now fails loudly with a named error.
  • Ported the classifier test to Python (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

  • Differential test, old Ruby script vs Python port: 65 cases, 0 mismatches (stdout + exit code), covering complete/incomplete/mixed trailers, case and whitespace variation, unicode, nested commit.message vs top-level message, missing message, and empty input.
  • File-argument invocation and --github-output append 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 @45c31c99 pin cited in the platform issue cannot be retrofixed — callers must bump their uses: ref (and helper_ref if 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).


Open in Devin Review

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 4 potential issues.

Open in Devin Review

Comment thread .github/scripts/classify_agent_authorship.py Outdated
Comment thread .github/scripts/classify_agent_authorship.py
Comment thread .github/scripts/classify_agent_authorship.py
Comment thread test/classify_agent_authorship_test.py
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.
@haasonsaas
haasonsaas merged commit cfe34dd into main Jul 27, 2026
3 checks passed
@haasonsaas
haasonsaas deleted the fix/agent-authorship-ruby branch July 27, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant