ci: resolve fork PRs missing Castiron run associations - #180
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Castiron custom code✅ No new custom-code files detected. 5 mixed files remain; 2 existing customizations changed. Compared
3 existing customizations unchanged
A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 34418241438 --repo openai/openai-cli \
--name castiron-custom-code-34418241438-1 --dir /tmp/castiron-custom-code-34418241438-1
git apply --stat /tmp/castiron-custom-code-34418241438-1/custom-code.patch
cat /tmp/castiron-custom-code-34418241438-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 9b6774cbdfb3e713abb5aa2203315f9458f5ef6b 8e09c6af154bf768c4d195407cd5124349827edb
python3 scripts/castiron/custom_code_report.py report \
--base 9b6774cbdfb3e713abb5aa2203315f9458f5ef6b \
--head 8e09c6af154bf768c4d195407cd5124349827edb --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-8e09c6af154b
cat /tmp/castiron-custom-code-8e09c6af154b/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
There was a problem hiding this comment.
🟢 Approval recommended
The fallback association logic is narrowly scoped, preserves existing validation checks, and is covered by targeted regression tests across report, budget, and publishing paths.
Pull request overview
This PR updates Castiron’s custom-code reporter/budget evaluation to reliably resolve fork pull requests when GitHub omits both the workflow-run PR association and the commit-to-PR association, by falling back to listing open PRs for the fork owner+branch and then applying the existing head/target/freshness/ambiguity validation.
Changes:
- Add a shared
associated_pulls()helper that falls back topulls.list(state=open, head=owner:branch) when both association endpoints return empty. - Wire the new association logic into report publication and budget evaluation paths.
- Extend unit coverage for fork fallback behavior and update the reporter integrity digest in the workflow.
File summaries
| File | Description |
|---|---|
| scripts/castiron/custom_code_report.py | Introduces associated_pulls() and uses it for trusted report computation and comment publication. |
| scripts/castiron/custom_code_budget.py | Uses report.associated_pulls() for PR-run association resolution during budget evaluation. |
| scripts/castiron/test_custom_code_report.py | Adds fork-missing-association cases and pagination coverage for the fallback PR listing. |
| scripts/castiron/test_custom_code_budget.py | Adds fork scenarios for status publication when commit association is missing. |
| .github/workflows/castiron-custom-code.yml | Updates REPORTER_SHA256 to match the modified reporter script. |
| .github/workflows/castiron-custom-code-comment.yml | Adds the same fork fallback (pulls.list by head) to the trusted status/comment publisher workflow logic. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
When GitHub omits a fork PR from both the workflow-run association and the base repository's commit-to-PR endpoint, Castiron cannot resolve the PR and leaves the required budget statuses missing.
Port the focused fix from openai/openai-python#3831: fall back to listing open PRs by the source run's fork owner and branch, then retain the existing exact-head, target, freshness, and ambiguity checks. Cover report computation, budget evaluation, and publication; update the reporter integrity digest.
Validation
scripts/castiron;git diff --check.The trusted handler runs from main. After merging, rerun affected Castiron custom-code workflows so the required statuses can be published.