Skip to content

feat: implement issue #819 — Parameterize the central initiative-planner on a target repo - #827

Merged
don-petry merged 3 commits into
mainfrom
dev-lead/issue-819-20260620-0357
Jun 20, 2026
Merged

feat: implement issue #819 — Parameterize the central initiative-planner on a target repo#827
don-petry merged 3 commits into
mainfrom
dev-lead/issue-819-20260620-0357

Conversation

@don-petry

@don-petry don-petry commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Closes #819

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • New Features

    • Initiative planner now supports specifying a target repository for planning operations, enabling cross-repository initiative management. The workflow automatically routes all changes to the specified repository while maintaining proper access controls.
  • Tests

    • Expanded test coverage to verify cross-repository planning and initiative application workflows function correctly.

@don-petry
don-petry requested a review from a team as a code owner June 20, 2026 04:07
@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.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

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

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ae190939-2276-4c65-9ee2-5bc366c885c7

📥 Commits

Reviewing files that changed from the base of the PR and between 59a0707 and 41eba1c.

📒 Files selected for processing (1)
  • .github/workflows/initiative-planner.yml
📝 Walkthrough

Walkthrough

Adds target_repo as a workflow_dispatch input to initiative-planner.yml, derives REPO and TARGET_GH_TOKEN env vars from it, re-keys concurrency on both repo and discussion, routes all write steps through the target-scoped token, updates redispatch.sh to forward TARGET_REPO, and extends bats tests to cover non-self target repo behavior.

Changes

Cross-repo initiative-planner parameterization

Layer / File(s) Summary
Workflow input, concurrency, and env wiring
.github/workflows/initiative-planner.yml
Adds target_repo workflow_dispatch input, re-keys concurrency.group to include both target repo and discussion number, explicitly sets TARGET_REPO in the redispatch bridge job for the dogfood path, and introduces REPO (derived from inputs.target_repo or github.repository) and TARGET_GH_TOKEN as plan job env vars.
Token-routed write operations
.github/workflows/initiative-planner.yml
Changes reviewed-plan artifact download to pull from the central repo, updates gather-context and reviewed-plan apply steps to use TARGET_GH_TOKEN, updates the LLM plan step to reference env.REPO and TARGET_GH_TOKEN, and passes env.REPO to apply-plan.sh.
redispatch.sh TARGET_REPO forwarding
scripts/initiative-planner/redispatch.sh
Documents and initializes TARGET_REPO (defaulting to REPO), adds -f target_repo="$TARGET_REPO" to the gh workflow run invocation, and expands the echo output to include target repo and dry-run status.
Bats tests for non-self target
tests/test_initiative_planner.bats, tests/test_initiative_planner_redispatch.bats
Adds tests verifying gather-context.sh queries the non-self target repo and records it in context JSON, that apply-plan.sh creates the epic against the supplied REPO API endpoint, and that redispatch.sh passes the correct target_repo default and override to the gh invocation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related issues

  • #819 (Parameterize the central initiative-planner on a target repo): This PR directly implements all five acceptance criteria from that issue — target_repo input, concurrency re-keying, cross-repo token routing, dogfood target_repo=self pass-through, and bats test coverage for non-self targets.

Possibly related PRs

  • petry-projects/.github-private#654: Modifies the same discussion→workflow_dispatch redispatch bridge in initiative-planner.yml and redispatch.sh; this PR extends that flow to carry target_repo.
  • petry-projects/.github-private#742: Modifies initiative-planner.yml and apply-plan.sh epic creation/detection logic that this PR now routes through TARGET_GH_TOKEN/REPO.

Suggested labels

enhancement, initiative

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically references issue #819 and summarizes the main feature: parameterizing the initiative-planner workflow to accept a target repository input.
Linked Issues check ✅ Passed The PR implementation comprehensively addresses all five acceptance criteria from issue #819: target_repo input support, concurrency group keying, cross-repo token authentication, redispatch bridge handling, and extended test coverage.
Out of Scope Changes check ✅ Passed All changes directly support the implementation of issue #819 requirements; no unrelated modifications were introduced beyond the specified workflow, script, and test file updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-819-20260620-0357

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.

@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 20, 2026 04:08
@donpetry-bot

Copy link
Copy Markdown
Contributor

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.

@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 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.

Comment thread tests/test_initiative_planner.bats
Comment thread tests/test_initiative_planner.bats
Comment thread tests/test_initiative_planner_redispatch.bats
@don-petry
don-petry disabled auto-merge June 20, 2026 04:09
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 20, 2026
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #827
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-06-20T04:43:46Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

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.
Next attempt after: 2026-06-20T04:43:46Z

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 04:13
@donpetry-bot

Copy link
Copy Markdown
Contributor

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.

@don-petry

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@don-petry
don-petry disabled auto-merge June 20, 2026 04:20
@don-petry

Copy link
Copy Markdown
Collaborator Author

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

Agent reasoning
- ✅ CodeRabbit: **dismissed with no actionable issues**
- ✅ No Tier 1 blockers (no CHANGES_REQUESTED, no failed checks)
**What already happened on this PR:**
1. gemini-code-assist[bot] suggested 3 test improvements (low priority)
2. don-petry replied to each thread with specific fixes:
   - Changed `gather-context` test to use `$TMP/mock_bin_gather` instead of `mktemp -d`
   - Changed `apply-plan` test similarly to use `$TMP/mock_bin_apply`
   - Added `unset TARGET_REPO` to the redispatch test for hermetic test isolation
3. All review threads were marked resolved
The PR is clean and ready. No further action is needed from the dev-lead agent.

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 04:20

@coderabbitai coderabbitai 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6754772 and 59a0707.

📒 Files selected for processing (4)
  • .github/workflows/initiative-planner.yml
  • scripts/initiative-planner/redispatch.sh
  • tests/test_initiative_planner.bats
  • tests/test_initiative_planner_redispatch.bats

Comment thread .github/workflows/initiative-planner.yml Outdated
@don-petry
don-petry disabled auto-merge June 20, 2026 04:24
@don-petry

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resolve

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 20, 2026
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@don-petry
don-petry disabled auto-merge June 20, 2026 04:27
@donpetry-bot

Copy link
Copy Markdown
Contributor

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.

@don-petry

Copy link
Copy Markdown
Collaborator Author

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

Agent reasoning
- CodeRabbit thread `PRRT_kwDOR9SdIs6K9qjk`: Already resolved and marked outdated ✅
- All other review threads: Resolved (gemini-code-assist threads)
## Summary
**Bot:** CodeRabbit
**Issues addressed:** 1
- **TARGET_GH_TOKEN permission scoping for cross-repo target_repo**: Fixed in commit 41eba1c by updating line 129 to use a conditional expression that selects `secrets.GITHUB_TOKEN` for self-repo runs and `secrets.GH_PAT_WORKFLOWS` for cross-repo operations. The token is now correctly scoped to the target repository. [already resolved]
**Files changed:** 
- `.github/workflows/initiative-planner.yml`
**Skipped (informational):** 0
All actionable issues from CodeRabbit have been addressed and the review thread is properly resolved.

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 04:28
@don-petry
don-petry disabled auto-merge June 20, 2026 04:28
@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 04:30
@don-petry
don-petry disabled auto-merge June 20, 2026 04:39
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: fix-reviews)

PR: #827
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-06-20T05:10:01Z

@don-petry
don-petry enabled auto-merge (squash) June 20, 2026 04:40
@don-petry

Copy link
Copy Markdown
Collaborator Author

@donpetry-bot please review — code-owner approval needed to merge (CI green, CodeRabbit approved).

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

@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: 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.

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.

Parameterize the central initiative-planner on a target repo

2 participants