fix(gh-fix-ci): Prefer job-specific logs over run-level logs to prevent cross-job contamination#139
Open
yaooqinn wants to merge 1 commit intoopenai:mainfrom
Open
Conversation
When a workflow run contains multiple jobs, `fetch_check_log` previously
fetched the entire run log (`gh run view --log`) which combines output
from ALL jobs. This caused cross-job log contamination: the failure
snippet for one job could contain errors from a completely different job,
leading to incorrect diagnosis.
For example, in a workflow with 22 jobs (e.g., Velox Fuzzer Jobs), all
failing checks would get the same mixed log blob, and
`extract_failure_snippet` would pick up errors from the wrong job.
The fix prioritizes `fetch_job_log(job_id)` via the GitHub API
(`/repos/.../actions/jobs/{job_id}/logs`) when a `job_id` is available,
falling back to run-level logs only when job-specific logs fail.
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.
Problem
When a workflow run contains multiple jobs,
fetch_check_logfetches the entire run log (gh run view --log) which combines output from ALL jobs. It only falls back to job-specific logs when the run log is unavailable (pending).This causes cross-job log contamination: the failure snippet for one job can contain errors from a completely different job, leading to incorrect CI failure diagnosis.
Example
In a workflow with 22 jobs (e.g., Velox Fuzzer Jobs), all failing checks get the same mixed log blob.
extract_failure_snippetthen picks up errors from the wrong job:Fix
Prioritize
fetch_job_log(job_id)via the GitHub API (/repos/.../actions/jobs/{job_id}/logs) when ajob_idis available. Fall back to run-level logs (gh run view --log) only when:job_idis available, ORBefore
After
Testing
Tested against facebookincubator/velox#16308 which has a Fuzzer Jobs workflow with 22 jobs (1 failing). After the fix, each failing check correctly shows its own job-specific errors.