feat(dev-lead): add reusable workflow (Phase 1.5) + shadow period (Phase 7) - #179
Conversation
…riod (Phase 7) - Create .github/workflows/dev-lead-reusable.yml: workflow_call entry point for other repos. Checks out .github-private scripts/prompts into .dev-lead/, then runs the same intent-classify + handler pipeline as dev-lead.yml with PROMPTS_DIR=.dev-lead/prompts/dev-lead. - Add PROMPTS_DIR env-var support to dev-lead-fix-ci.sh, dev-lead-fix-reviews.sh, and dev-lead-fix-issue.sh so the reusable workflow can point scripts at the sparse-checkout path without changing CWD. Defaults to prompts/dev-lead (backwards-compatible for dev-lead.yml). - Annotate dev-lead.yml with Phase 7 shadow-period window (2026-05-15 through ~2026-05-29): claude.yml and dev-lead.yml run in parallel until regressions clear, then claude.yml is removed. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces a new reusable GitHub Actions workflow that orchestrates dev-lead event handling by classifying incoming events, installing required CLI tools, and routing to intent-specific bash scripts. Three existing handler scripts are updated to accept a configurable prompt directory, enabling the reusable workflow to override the default prompt location when needed. ChangesDev-Lead Reusable Workflow and Script Integration
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
Pull request overview
Adds a workflow_call reusable variant of the dev-lead pipeline so other repos can invoke it without bundling scripts, parameterizes the prompt directory in three handler scripts so the reusable can point at the sparse-checked-out copy, and annotates dev-lead.yml with a Phase 7 shadow-period header announcing parallel operation with claude.yml through ~2026-05-29.
Changes:
- New
.github/workflows/dev-lead-reusable.ymlmirrors the dispatch job fromdev-lead.yml, sparse-checks outpetry-projects/.github-privateinto.dev-lead/, and dispatches all intents exceptcheck_run(which the caller must route). dev-lead-fix-ci.sh,dev-lead-fix-reviews.sh, anddev-lead-fix-issue.shhonor aPROMPTS_DIRenv var (defaultprompts/dev-lead), used by the reusable to point at.dev-lead/prompts/dev-lead.- Header comment in
dev-lead.ymldocuments the shadow-period coexistence withclaude.yml.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/dev-lead-reusable.yml | New reusable workflow with two-checkout pattern and explicit secret passthrough per handler |
| .github/workflows/dev-lead.yml | Adds shadow-period header comment only |
| scripts/dev-lead-fix-ci.sh | Reads PROMPTS_DIR env var for prompt template path |
| scripts/dev-lead-fix-issue.sh | Reads PROMPTS_DIR env var for fix-issue.md path |
| scripts/dev-lead-fix-reviews.sh | Reads PROMPTS_DIR env var in build_and_run |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| GH_PAT_WORKFLOWS: | ||
| required: false |
| - name: Checkout dev-lead scripts | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| repository: petry-projects/.github-private | ||
| path: .dev-lead | ||
| token: ${{ secrets.GH_PAT_WORKFLOWS || github.token }} | ||
| sparse-checkout: | | ||
| scripts | ||
| prompts/dev-lead |
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Dev-Lead Fix CI — no-changesPR: #179 | SHA: |
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/dev-lead.yml:
- Around line 1-7: The added custom header block ("Phase 7 — Shadow Period"
banner) violates the repository's verbatim-template rule for
.github/workflows/dev-lead.yml; remove the banner lines 1–7 so the workflow file
matches the upstream org template exactly, and instead place this informational
content in the upstream org template or in PR/issue docs; ensure no other
non-template edits remain in dev-lead.yml before committing.
🪄 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: 0ef42013-82a9-4922-886f-5d1ef2a4c0f9
📒 Files selected for processing (5)
.github/workflows/dev-lead-reusable.yml.github/workflows/dev-lead.ymlscripts/dev-lead-fix-ci.shscripts/dev-lead-fix-issue.shscripts/dev-lead-fix-reviews.sh
| # ───────────────────────────────────────────────────────────────────────────── | ||
| # Phase 7 — Shadow Period (started 2026-05-15) | ||
| # Both claude.yml and dev-lead.yml run in parallel on .github-private PRs for | ||
| # a 2-week observation window ending ~2026-05-29. | ||
| # Tracking issue: petry-projects/.github-private#<shadow-period-issue> | ||
| # After the window passes without regressions, claude.yml will be removed. | ||
| # ───────────────────────────────────────────────────────────────────────────── |
There was a problem hiding this comment.
Remove custom header content from this non-exempt workflow template.
On Line 1 through Line 7, the new “Phase 7 — Shadow Period” banner adds non-template content to .github/workflows/dev-lead.yml. This file is covered by the verbatim-template rule, so these edits should live in the upstream org template (or in PR/issue docs), not directly here.
As per coding guidelines, ".github/workflows/!(claude|agent-shield).yml: All workflow changes outside of exempted files must use templates from organization standards verbatim".
🤖 Prompt for 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.
In @.github/workflows/dev-lead.yml around lines 1 - 7, The added custom header
block ("Phase 7 — Shadow Period" banner) violates the repository's
verbatim-template rule for .github/workflows/dev-lead.yml; remove the banner
lines 1–7 so the workflow file matches the upstream org template exactly, and
instead place this informational content in the upstream org template or in
PR/issue docs; ensure no other non-template edits remain in dev-lead.yml before
committing.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4ac955904
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| repository: petry-projects/.github-private | ||
| path: .dev-lead | ||
| token: ${{ secrets.GH_PAT_WORKFLOWS || github.token }} |
There was a problem hiding this comment.
Require a token that can read the reusable repo
When this reusable workflow is called from any other private repository without GH_PAT_WORKFLOWS, this checkout falls back to the caller repo's github.token; actions/checkout scopes that token to the current/caller repository, so it cannot read petry-projects/.github-private and the workflow fails before intent classification. Since the workflow is explicitly meant for other repos and the secret is marked optional, callers can configure the reusable exactly as advertised but still fail at this step; make the secret required or otherwise provide a token with access to .github-private for this checkout.
Useful? React with 👍 / 👎.
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
| with: | ||
| repository: petry-projects/.github-private | ||
| path: .dev-lead |
There was a problem hiding this comment.
Keep the helper checkout out of commits
Checking the scripts repo out under the caller worktree leaves .dev-lead as an unignored nested git repository. On reusable runs that actually apply fixes, the existing handlers later stage with git add -A (for example the fix-ci and issue paths), so the generated commit can include .dev-lead as an embedded gitlink/submodule instead of only the intended code changes. Put this checkout outside the caller repository or exclude .dev-lead before any handler can stage changes.
Useful? React with 👍 / 👎.
| if: >- | ||
| (inputs.event_name == '' && github.event_name != 'check_run') || | ||
| (inputs.event_name != '' && inputs.event_name != 'check_run') |
There was a problem hiding this comment.
Restore CI relay for check_run callers
For any caller that triggers this reusable workflow on check_run events, github.event_name is check_run, so this condition skips the only job in the file. Unlike the non-reusable workflow, this new reusable does not define a ci-relay job to emit the dev-lead-ci-failure repository_dispatch event, so failing checks never reach the fix-ci handler. Include the relay in the reusable, or do not skip check_run unless a real caller-side relay has already converted it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Code Review
This pull request introduces a configurable PROMPTS_DIR environment variable across the dev-lead-fix-ci.sh, dev-lead-fix-issue.sh, and dev-lead-fix-reviews.sh scripts, allowing for custom prompt template locations. Feedback was provided to export the PROMPTS_DIR variable in each script to ensure that envsubst can correctly resolve the path if it is referenced within the markdown templates themselves.
| MAX_CI_CYCLES="${MAX_CI_CYCLES:-3}" | ||
| LOG_MAX_LINES="${LOG_MAX_LINES:-200}" | ||
| MARKER_PREFIX="<!-- dev-lead-fix-ci sha=" | ||
| PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" |
There was a problem hiding this comment.
The PROMPTS_DIR variable should be exported to ensure it is available to envsubst when processing templates. While it is used here to locate the template file, templates themselves often reference the prompt directory to include other resources or standards. Exporting it ensures consistency with other environment variables like PR_NUMBER and REPO that are passed to the templates.
| PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" | |
| export PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" |
| ISSUE_NUMBER="${ISSUE_NUMBER:-}" | ||
| REPO="${REPO:-${GITHUB_REPOSITORY:-}}" | ||
| DEV_LEAD_DRY_RUN="${DEV_LEAD_DRY_RUN:-false}" | ||
| PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" |
There was a problem hiding this comment.
The PROMPTS_DIR variable should be exported so that envsubst can substitute it if it is referenced within the fix-issue.md template. This maintains consistency with how other context variables (like ISSUE_NUMBER and REPO) are handled in this script.
| PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" | |
| export PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" |
| REPO="${REPO:-${GITHUB_REPOSITORY:-}}" | ||
| HEAD_SHA="${HEAD_SHA:-}" | ||
| DEV_LEAD_DRY_RUN="${DEV_LEAD_DRY_RUN:-false}" | ||
| PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" |
There was a problem hiding this comment.
Exporting PROMPTS_DIR ensures that any references to this path inside the markdown templates (e.g., fix-reviews.md, human.md) are correctly resolved by envsubst. This is particularly important for the reusable workflow where the prompt path is non-standard.
| PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" | |
| export PROMPTS_DIR="${PROMPTS_DIR:-prompts/dev-lead}" |
…gnore, export PROMPTS_DIR, trim header
|
Dev-Lead Fix CI — no-changesPR: #179 | SHA: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c39fd0bc77
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| prompts/dev-lead | ||
|
|
||
| - name: Protect dev-lead scripts from accidental git staging | ||
| run: echo ".dev-lead/" >> .gitignore |
There was a problem hiding this comment.
Avoid committing the helper ignore entry
When any non-skip handler later stages with git add -A, this line has already modified or created the caller repository's tracked working tree. If the engine makes no edits, handlers such as fix-ci can still see a dirty tree and commit only this .gitignore change; otherwise every automated fix carries an unrelated ignore entry. Put the helper checkout in .git/info/exclude or outside the caller worktree instead of editing the repository file.
Useful? React with 👍 / 👎.
| permissions: | ||
| contents: read | ||
|
|
There was a problem hiding this comment.
Grant the CI relay token write access
For reusable runs invoked by a caller's check_run event without a PAT in GH_PAT_WORKFLOWS, this job falls back to github.token and then posts to repos/$RELAY_REPO/dispatches; GitHub's Create repository dispatch endpoint requires the token's Contents permission to be write, but this job restricts it to read, so the relay fails with a 403 before the fix-ci path can run. The non-reusable workflow inherits contents: write, so mirror that here or require a PAT for the relay.
Useful? React with 👍 / 👎.
| INTENT_TYPE: human | ||
| PR_NUMBER: ${{ fromJson(env.INTENT_CONTEXT).pr_number }} | ||
| HEAD_SHA: ${{ fromJson(env.INTENT_CONTEXT).head_sha }} | ||
| REPO: ${{ github.repository }} |
There was a problem hiding this comment.
Pass the user request into the human handler
For @dev-lead PR comments or review comments, the intent context only carries the PR number/head SHA, and this env block forwards only those fields. scripts/dev-lead-fix-reviews.sh then defaults ACTOR, USER_INSTRUCTION, and PR_DESCRIPTION to empty before rendering prompts/dev-lead/human.md, so the reusable run starts the writer with a blank Instruction block and cannot implement the request that triggered it. Include the comment body/actor in the context or fetch them before invoking the handler.
Useful? React with 👍 / 👎.
| GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} | ||
| COPILOT_GITHUB_TOKEN: ${{ secrets.GH_PAT }} | ||
| PROMPTS_DIR: .dev-lead/prompts/dev-lead | ||
| run: bash .dev-lead/scripts/dev-lead-fix-reviews.sh |
There was a problem hiding this comment.
Push review fixes back to the PR branch
For review/comment intents that route to this script, the reusable workflow has only performed the generic caller checkout, and dev-lead-fix-reviews.sh does not check out the PR head or push after the writer commits. On pull_request_review, pull_request_review_comment, or issue_comment runs, successful fixes are therefore left as local runner commits and never update the PR, unlike the fix-ci path which explicitly gh pr checkouts and pushes. Check out the PR branch and push after a successful handler run.
Useful? React with 👍 / 👎.
| INTENT_TYPE: fix-bot-comment | ||
| PR_NUMBER: ${{ fromJson(env.INTENT_CONTEXT).pr_number }} | ||
| HEAD_SHA: ${{ fromJson(env.INTENT_CONTEXT).head_sha }} | ||
| REPO: ${{ github.repository }} |
There was a problem hiding this comment.
Forward bot comment details to the handler
When a trusted bot leaves a PR issue comment, this step invokes the fix-bot-comment path but only provides the PR number/SHA. The script renders prompts/dev-lead/fix-bot-comment.md from ACTOR and COMMENT_BODY, both of which default to empty here, so the writer is asked to address a blank bot comment and cannot know which finding to fix. Include the triggering comment author/body in the intent context or fetch the comment before running this handler.
Useful? React with 👍 / 👎.
Dev-Lead Fix CI — failedPR: #179 | SHA: |




Summary
.github/workflows/dev-lead-reusable.yml: aworkflow_callreusable that lets other repos invoke the dev-lead pipeline without bundling scripts. It sparse-checks out.github-privateinto.dev-lead/and runs the same intent→handler flow asdev-lead.yml, passingPROMPTS_DIR=.dev-lead/prompts/dev-leadto each handler.PROMPTS_DIRenv-var todev-lead-fix-ci.sh,dev-lead-fix-reviews.sh, anddev-lead-fix-issue.sh. Defaults toprompts/dev-lead(no change for existing users); reusable workflow sets it to.dev-lead/prompts/dev-lead.dev-lead.ymlwith shadow-period header:claude.ymlanddev-lead.ymlrun in parallel from 2026-05-15 through ~2026-05-29. After the window closes without regressions,claude.ymlis removed.Key design decisions
actions/checkoutsteps: caller repo at root,.github-privateat.dev-lead/. Allbashinvocations arebash .dev-lead/scripts/...sosource "$(dirname "$0")/engine.sh"resolves correctly.ci-relayjob in the reusable —check_runevents don't flow throughworkflow_call. The caller stub (petry-projects/.github/standards/workflows/dev-lead.yml) is responsible for handling check_run by calling the reusable from its own ci-relay job withinputs.event_name: check_run.dispatchjobif:condition guards against check_run events whether they arrive viagithub.event_nameorinputs.event_name.secrets:can't be mapped there fromworkflow_call).cdto repo root and don't setPROMPTS_DIR, so the defaultprompts/dev-leadpath is used as before.Test plan
Test Dev-Lead Agentworkflow runs BATS unit tests and prompt-coverage check)dev-lead-reusable.ymlparses withgh workflow viewafter mergeclaude.ymlremains active (shadow period — both workflows run)claude.yml🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores