fix(initiative-planner): skip non-issue references in gather-context - #579
Conversation
The referenced-prerequisite resolution treated every #N in the idea's body/ comments as an issue and failed fast (exit 1) on any fetch error. But a #N can be a Discussion, a PR, the idea's own number, or a self-reference in a cross-link comment — gh api repos/.../issues/N 404s for those, killing the run (e.g. discussion #413 references #413). Skip unfetchable references (they're optional context) with a notice instead of aborting; the open-epics query above still fails fast on a genuine API/auth fault. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
More reviews will be available in 40 minutes and 6 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the gather-context.sh script to gracefully skip referenced items that cannot be fetched via the GitHub issues API (such as discussions or self-references) instead of failing the entire run. The reviewer noted that the GitHub issues API actually returns pull requests as well, meaning they will not be skipped, and suggested updating the comments and notice message to reflect this behavior accurately.
Dev-Lead — review-changes (applied)Changes committed and pushed. |
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
|
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: LOW
Reviewed commit: 942f1f078e2239e2f54c425147e0e0cd0e3a7687
Review mode: triage-approved (single reviewer)
Summary
Single-file shell fix to scripts/initiative-planner/gather-context.sh: when extracting #N references from a discussion body/comments, the loop previously did || exit 1 on gh api repos/.../issues/N failure, which aborted the run for any reference that wasn't an issue/PR (Discussions, self-refs). The fix logs a ::notice:: and continues, while the open-epics query above remains fail-fast so genuine API/auth faults still surface. +7/-1 lines, no behavior change for valid issue/PR refs.
Linked issue analysis
No closing-issues link in PR metadata, but the PR description identifies the concrete symptom (Discussion #413 dry-run failing with failed to fetch issue 413) and the validation step (re-ran on #413 from this branch, succeeded, correctly used real issue prereqs #195 and #497 as blocked_by_existing_issues while skipping discussion self-refs). Symptom is substantively addressed by the diff.
Findings
- The
ninterpolated into the API path is sanitized bygrep -oE '#[0-9]+' | tr -d '#'plussort -un, so it can only be digits — no command/path injection risk. - The new comment correctly notes that the GitHub issues REST endpoint also returns PRs (addressing gemini-code-assist's inline feedback, which don-petry resolved in commit
ee7fc49). - Fail-fast is preserved for the upstream
gh issue listepics query, so true auth/API outages still abort the run. - shellcheck, CodeQL, SonarCloud, agent-shield, bats, and the secret scan all pass on
942f1f078e2239e2f54c425147e0e0cd0e3a7687. - coderabbitai already submitted an APPROVED review on the latest SHA.
CI status
All required checks green on 942f1f078e2239e2f54c425147e0e0cd0e3a7687: Lint, shellcheck, ShellCheck, unit-tests, bats, CodeQL (actions + python), SonarCloud, Agent Security Scan, Secret scan (gitleaks), validate-agent-profiles, Compile agentic workflows, gh-aw-compile, dependency-audit (ecosystems detection + skipped ecosystem audits), agent-shield, dev-lead/dispatch, review/review. mergeStateStatus is BLOCKED only because review approval is still required (which this verdict provides via the bot).
Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.
…579) * fix(initiative-planner): skip non-issue references in gather-context The referenced-prerequisite resolution treated every #N in the idea's body/ comments as an issue and failed fast (exit 1) on any fetch error. But a #N can be a Discussion, a PR, the idea's own number, or a self-reference in a cross-link comment — gh api repos/.../issues/N 404s for those, killing the run (e.g. discussion #413 references #413). Skip unfetchable references (they're optional context) with a notice instead of aborting; the open-epics query above still fails fast on a genuine API/auth fault. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: apply manual instructions [skip ci-relay] --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…579) * fix(initiative-planner): skip non-issue references in gather-context The referenced-prerequisite resolution treated every #N in the idea's body/ comments as an issue and failed fast (exit 1) on any fetch error. But a #N can be a Discussion, a PR, the idea's own number, or a self-reference in a cross-link comment — gh api repos/.../issues/N 404s for those, killing the run (e.g. discussion #413 references #413). Skip unfetchable references (they're optional context) with a notice instead of aborting; the open-epics query above still fails fast on a genuine API/auth fault. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: apply manual instructions [skip ci-relay] --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…579) * fix(initiative-planner): skip non-issue references in gather-context The referenced-prerequisite resolution treated every #N in the idea's body/ comments as an issue and failed fast (exit 1) on any fetch error. But a #N can be a Discussion, a PR, the idea's own number, or a self-reference in a cross-link comment — gh api repos/.../issues/N 404s for those, killing the run (e.g. discussion #413 references #413). Skip unfetchable references (they're optional context) with a notice instead of aborting; the open-epics query above still fails fast on a genuine API/auth fault. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: apply manual instructions [skip ci-relay] --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…579) * fix(initiative-planner): skip non-issue references in gather-context The referenced-prerequisite resolution treated every #N in the idea's body/ comments as an issue and failed fast (exit 1) on any fetch error. But a #N can be a Discussion, a PR, the idea's own number, or a self-reference in a cross-link comment — gh api repos/.../issues/N 404s for those, killing the run (e.g. discussion #413 references #413). Skip unfetchable references (they're optional context) with a notice instead of aborting; the open-epics query above still fails fast on a genuine API/auth fault. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: apply manual instructions [skip ci-relay] --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…579) * fix(initiative-planner): skip non-issue references in gather-context The referenced-prerequisite resolution treated every #N in the idea's body/ comments as an issue and failed fast (exit 1) on any fetch error. But a #N can be a Discussion, a PR, the idea's own number, or a self-reference in a cross-link comment — gh api repos/.../issues/N 404s for those, killing the run (e.g. discussion #413 references #413). Skip unfetchable references (they're optional context) with a notice instead of aborting; the open-epics query above still fails fast on a genuine API/auth fault. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore: apply manual instructions [skip ci-relay] --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>



What
scripts/initiative-planner/gather-context.shextracts every#Nfrom an idea's body/comments and fetches each viagh api repos/.../issues/Nto surface likely prerequisites. A review refactor made that fetch fail-fast (|| exit 1). But a#Ncan be a Discussion, a PR, or a self-reference in a cross-link comment —issues/N404s for those, killing the whole run.Symptom
The first real dry-run of the planner on Discussion #413 failed:
(#413's own cross-link comments reference
#413,#553,#562,#564— all Discussions, not issues.)Fix
Skip references the issues endpoint can't return (with a
::notice::) instead of aborting. The open-epics query above still fails fast on a genuine API/auth fault, so real failures aren't masked.Validation
Re-ran the dry-run on #413 from this branch — succeeded. It correctly used the real issue prerequisites (#195 inert tier-routing, #497 ring pinning) as
blocked_by_existing_issueswhile skipping the discussion self-refs. Produced a clean 3-story epic with a valid DAG.🤖 Generated with Claude Code