fix(gh-fix-ci): Prefer job-specific logs over run-level logs to prevent cross-job contamination #139
+8
−8
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.