mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
a770e5b847
## Why The PR babysitter could surface inline comments from a GitHub review that was still in the `PENDING` state. That allowed Codex to start acting on feedback before the reviewer submitted it. ## What changed - Correlate inline comments with their parent review and ignore pending reviews and their comments. - Remove pending review IDs from saved watcher state so the feedback surfaces normally after publication. - Update the skill instructions and add regression coverage for the draft-to-published transition. ## Validation - `python3 -m pytest .codex/skills/babysit-pr/scripts/test_gh_pr_watch.py` - Skill package validation with `quick_validate.py` - Live verification on #26835: the draft comment stayed hidden and surfaced after the review was submitted.
2.3 KiB
2.3 KiB
GitHub CLI / API Notes For babysit-pr
Primary commands used
PR metadata
gh pr view --json number,url,state,mergedAt,closedAt,headRefName,headRefOid,headRepository,headRepositoryOwner
Used to resolve PR number, URL, branch, head SHA, and closed/merged state.
PR checks summary
gh pr checks --json name,state,bucket,link,workflow,event,startedAt,completedAt
Used to compute pending/failed/passed counts and whether the current CI round is terminal.
Workflow runs for head SHA
gh api repos/{owner}/{repo}/actions/runs -X GET -f head_sha=<sha> -f per_page=100
Used to discover failed workflow runs and rerunnable run IDs.
Failed log inspection
gh run view <run-id> --json jobs,name,workflowName,conclusion,status,url,headShagh api repos/{owner}/{repo}/actions/runs/{run_id}/jobs -X GET -f per_page=100gh api repos/{owner}/{repo}/actions/jobs/{job_id}/logs > /tmp/codex-gh-job-{job_id}-logs.zipgh run view <run-id> --log-failed
Used by Codex to classify branch-related vs flaky/unrelated failures. Prefer the direct job log endpoint as soon as a job has failed because gh run view --log-failed may not produce failed-job logs until the overall workflow run completes.
Retry failed jobs only
gh run rerun <run-id> --failed
Reruns only failed jobs (and dependencies) for a workflow run.
Review-related endpoints
- Issue comments on PR:
gh api repos/{owner}/{repo}/issues/<pr_number>/comments?per_page=100
- Inline PR review comments:
gh api repos/{owner}/{repo}/pulls/<pr_number>/comments?per_page=100
- Review submissions:
gh api repos/{owner}/{repo}/pulls/<pr_number>/reviews?per_page=100
Use each inline comment's pull_request_review_id to find its parent review. Ignore parent reviews
whose state is PENDING, along with their inline comments, until the review is submitted.
JSON fields consumed by the watcher
gh pr view
numberurlstatemergedAtclosedAtheadRefNameheadRefOid
gh pr checks
bucket(pass,fail,pending,skipping)statenameworkflowlink
Actions runs API (workflow_runs[])
idnamestatusconclusionhtml_urlhead_sha
Actions run jobs API (jobs[])
idnamestatusconclusionhtml_url