Skip to content

fix(initiative-planner): skip non-issue references in gather-context - #579

Merged
don-petry merged 4 commits into
mainfrom
fix/planner-gather-context-refs
Jun 12, 2026
Merged

fix(initiative-planner): skip non-issue references in gather-context#579
don-petry merged 4 commits into
mainfrom
fix/planner-gather-context-refs

Conversation

@don-petry

Copy link
Copy Markdown
Collaborator

What

scripts/initiative-planner/gather-context.sh extracts every #N from an idea's body/comments and fetches each via gh api repos/.../issues/N to surface likely prerequisites. A review refactor made that fetch fail-fast (|| exit 1). But a #N can be a Discussion, a PR, or a self-reference in a cross-link comment — issues/N 404s for those, killing the whole run.

Symptom

The first real dry-run of the planner on Discussion #413 failed:

##[error]failed to fetch issue 413 from petry-projects/.github-private

(#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_issues while skipping the discussion self-refs. Produced a clean 3-story epic with a valid DAG.

🤖 Generated with Claude Code

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>
@don-petry
don-petry requested a review from a team as a code owner June 11, 2026 22:43
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 49b6c12a-928f-42eb-83e0-6b91e62e4c56

📥 Commits

Reviewing files that changed from the base of the PR and between acbf67c and 942f1f0.

📒 Files selected for processing (1)
  • scripts/initiative-planner/gather-context.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/planner-gather-context-refs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/initiative-planner/gather-context.sh Outdated
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) June 11, 2026 22:50
@don-petry
don-petry disabled auto-merge June 11, 2026 22:51
@don-petry
don-petry enabled auto-merge (squash) June 11, 2026 22:54
@don-petry
don-petry disabled auto-merge June 11, 2026 22:55
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
Files changed: none
Skipped (informational): 1 — SonarCloud quality gate passed with 0 new issues,
  0 security hotspots; no actionable findings in the PR diff.
No open review threads to resolve (0 unresolved threads found).
No Tier 1 CI/review blockers present.
```

@don-petry
don-petry enabled auto-merge (squash) June 11, 2026 22:56
@don-petry
don-petry disabled auto-merge June 11, 2026 23:14
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry disabled auto-merge June 11, 2026 23:52
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) June 11, 2026 23:55

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 n interpolated into the API path is sanitized by grep -oE '#[0-9]+' | tr -d '#' plus sort -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 list epics 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.

@don-petry
don-petry merged commit cf9ac2e into main Jun 12, 2026
27 checks passed
@don-petry
don-petry deleted the fix/planner-gather-context-refs branch June 12, 2026 00:04
don-petry added a commit that referenced this pull request Jun 12, 2026
…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>
don-petry added a commit that referenced this pull request Jun 14, 2026
…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>
don-petry added a commit that referenced this pull request Jun 18, 2026
…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>
don-petry added a commit that referenced this pull request Jun 25, 2026
…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>
don-petry added a commit that referenced this pull request Jun 25, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants