feat: implement issue #819 — Parameterize the central initiative-planner on a target repo - #827
Conversation
…ner on a target repo
|
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 52 minutes and 58 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. 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)
📝 WalkthroughWalkthroughAdds ChangesCross-repo initiative-planner parameterization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related issues
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-06-20T05:08:52Z. |
There was a problem hiding this comment.
Code Review
This pull request introduces cross-repo target parameterization by adding a TARGET_REPO environment variable to the redispatch script, allowing the central planner to plan for a non-self target repository. It also adds comprehensive unit tests to verify context gathering, plan application, and default fallback behaviors. The review feedback suggests making the tests more robust and hermetic by creating mock directories inside the pre-existing $TMP directory (ensuring cleanup on assertion failures) and explicitly unsetting TARGET_REPO in the default-path test to avoid environment leakage.
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #827 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically. |
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-06-20T05:14:04Z. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/initiative-planner.yml:
- Around line 120-128: The TARGET_GH_TOKEN environment variable at line 128 is
hardcoded to secrets.GITHUB_TOKEN, which is scoped only to the current
repository and causes permission failures for non-self target_repo runs (those
operations occur at lines 180-181, 191, 199, and 362-363). Update the
TARGET_GH_TOKEN assignment to use a conditional expression that evaluates the
target_repo against github.repository: when they match (self-path), use
secrets.GITHUB_TOKEN as the fallback, but when they differ, use the cross-repo
App token source (as referenced in the S1 `#818` note in the comment above) to
ensure the token has write permissions to the target repository.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 66f99623-db03-4e7b-9838-20b55ee84625
📒 Files selected for processing (4)
.github/workflows/initiative-planner.ymlscripts/initiative-planner/redispatch.shtests/test_initiative_planner.batstests/test_initiative_planner_redispatch.bats
|
@coderabbitai resolve |
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
✅ Action performedComments resolved and changes approved. |
|
Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-06-20T05:27:57Z. |
Dev-Lead — fix-bot-comment (no-changes)Agent reasoning |
|
Dev-Lead — waiting on PR blockers (intent: fix-reviews)PR: #827 |
|
@donpetry-bot please review — code-owner approval needed to merge (CI green, CodeRabbit approved). |
|
@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 41eba1ce5f5a06793e78f86c66a0ddfdd34ef803
Review mode: triage-approved (single reviewer)
Summary
Parameterizes the central initiative-planner on a target_repo so one planner can serve fleet repos. Clean, scoped change (workflow + redispatch.sh + bats). CodeRabbit raised the one substantive concern (cross-repo token scoping), it was fixed in the head commit, and CodeRabbit subsequently APPROVED. All security/CI scanners green.
Linked issue analysis
Closes #819. All five acceptance criteria are met: (1) target_repo workflow_dispatch input added, REPO = inputs.target_repo || github.repository; (2) concurrency.group re-keyed on target-repo + discussion; (3) every TARGET-repo write now uses TARGET_GH_TOKEN (GITHUB_TOKEN for self, GH_PAT_WORKFLOWS for cross-repo); (4) the discussion->redispatch bridge passes target_repo=self so the dogfood path is unchanged; (5) bats suites add non-self target_repo coverage for gather-context, apply-plan, and redispatch.
Findings
No blocking findings.
- Token routing (initiative-planner.yml): the TARGET_GH_TOKEN ternary correctly selects GITHUB_TOKEN on the self path and GH_PAT_WORKFLOWS cross-repo. GITHUB_TOKEN is always present in Actions context, so the GHA ternary cannot silently fall through. This was CodeRabbit's CHANGES_REQUESTED item on an earlier SHA and is resolved in the reviewed head commit.
- Reviewed-plan artifact download correctly pulls from github.repository (central repo, where the planner produced it) rather than the target repo.
- NOTE (non-blocking, tracked): on the cross-repo path a broad org PAT (GH_PAT_WORKFLOWS) is handed to the Claude Code action as github_token. This extends the existing self-path pattern across repos and is mitigated by an operator-gated workflow_dispatch trigger (not reachable from untrusted PR input) and a tracked follow-up (#818) to mint a tighter, target-scoped GitHub App token. Worth confirming GH_PAT_WORKFLOWS has the intended fleet write scope before cross-repo use lands.
- redispatch.sh: TARGET_REPO defaults to REPO; forwarding is quoted and safe. Docs/echo updated.
CI status
All substantive checks green: CodeQL (actions, python), SonarCloud (Quality Gate passed), AgentShield, Agent Security Scan, gitleaks, shellcheck/ShellCheck, bats, unit-tests, holdout-guard, validate-agent-profiles, gh-aw-compile, Compile agentic workflows, Lint. The CANCELLED 'dev-lead / dispatch' and 'dev-lead / ci-relay' runs are superseded agent-workflow jobs (concurrency churn), not CI gates; the final dev-lead dispatch succeeded. mergeStateStatus=BLOCKED reflects REVIEW_REQUIRED (code-owner/org-leads approval pending) — exactly what this review addresses.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.



Closes #819
Implemented by dev-lead agent. Please review.
Summary by CodeRabbit
New Features
Tests