fix(workflows): ensure all PR-creating workflows target $BASE_BRANCH#1479
Conversation
📝 WalkthroughWalkthroughPull request creation now explicitly specifies a base branch via the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 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. Review rate limit: 6/8 reviews remaining, refill in 10 minutes and 40 seconds.Comment |
Review SummaryVerdict: minor-fixes-needed This PR fixes a regression where bundled workflows creating PRs silently ignored the configured Blocking issuesNone. Code and error handling are solid. Suggested fixes
Minor / nice-to-have
Compliments
Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: code-review, error-handling, comment-quality, docs-impact. |
- Add --base $BASE_BRANCH to gh pr create in archon-architect, archon-refactor-safely, and archon-implement-issue - Add verify-pr-base bash node to all 9 PR-creating workflows that auto-corrects via gh pr edit if the AI mis-targets - Rewire downstream depends_on edges through verify-pr-base - Regenerate bundled-defaults.generated.ts
283a978 to
64aad61
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.archon/workflows/defaults/archon-refactor-safely.yaml (1)
449-495:⚠️ Potential issue | 🟠 MajorUse the repo PR template verbatim here.
This still hand-rolls the PR body. Repo policy says every PR must copy
.github/PULL_REQUEST_TEMPLATE.mdinto the body and fill every section explicitly; otherwise this workflow can drift from the required format.Suggested adjustment
- 4. Create the PR targeting `$BASE_BRANCH` as the base branch: - `gh pr create --base $BASE_BRANCH --title "..." --body "..."`, then format - title/body per the template below + 4. Create the PR targeting `$BASE_BRANCH` as the base branch: + Copy `.github/PULL_REQUEST_TEMPLATE.md` into the PR body, fill every section, + then invoke `gh pr create --base $BASE_BRANCH --title "..." --body "..."`.Based on learnings: All PRs must use the template at
.github/PULL_REQUEST_TEMPLATE.md— fill in every section; when opening viagh pr create, copy the template into the body explicitly.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.archon/workflows/defaults/archon-refactor-safely.yaml around lines 449 - 495, The PR body in the workflow currently hand-rolls a refactor template instead of using the repo's required PR template; update the step that runs `gh pr create` (the block that writes the PR body/title and saves `$ARTIFACTS_DIR/.pr-url`) to read and insert the contents of `.github/PULL_REQUEST_TEMPLATE.md` into the `--body` argument and ensure every section is filled before creating the PR (keep using `$BASE_BRANCH` and preserve saving the PR URL to `$ARTIFACTS_DIR/.pr-url`), so the workflow always copies the canonical template verbatim and populates its fields rather than using the inline markdown shown in the current PR Format section.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In @.archon/workflows/defaults/archon-refactor-safely.yaml:
- Around line 449-495: The PR body in the workflow currently hand-rolls a
refactor template instead of using the repo's required PR template; update the
step that runs `gh pr create` (the block that writes the PR body/title and saves
`$ARTIFACTS_DIR/.pr-url`) to read and insert the contents of
`.github/PULL_REQUEST_TEMPLATE.md` into the `--body` argument and ensure every
section is filled before creating the PR (keep using `$BASE_BRANCH` and preserve
saving the PR URL to `$ARTIFACTS_DIR/.pr-url`), so the workflow always copies
the canonical template verbatim and populates its fields rather than using the
inline markdown shown in the current PR Format section.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1d3ef2f1-48cf-4748-b8e2-e11be2ad3715
📒 Files selected for processing (11)
.archon/commands/defaults/archon-implement-issue.md.archon/workflows/defaults/archon-architect.yaml.archon/workflows/defaults/archon-feature-development.yaml.archon/workflows/defaults/archon-fix-github-issue.yaml.archon/workflows/defaults/archon-idea-to-pr.yaml.archon/workflows/defaults/archon-issue-review-full.yaml.archon/workflows/defaults/archon-piv-loop.yaml.archon/workflows/defaults/archon-plan-to-pr.yaml.archon/workflows/defaults/archon-ralph-dag.yaml.archon/workflows/defaults/archon-refactor-safely.yamlpackages/workflows/src/defaults/bundled-defaults.generated.ts
✅ Files skipped from review due to trivial changes (1)
- .archon/commands/defaults/archon-implement-issue.md
🚧 Files skipped from review as they are similar to previous changes (7)
- .archon/workflows/defaults/archon-plan-to-pr.yaml
- .archon/workflows/defaults/archon-piv-loop.yaml
- .archon/workflows/defaults/archon-fix-github-issue.yaml
- .archon/workflows/defaults/archon-issue-review-full.yaml
- .archon/workflows/defaults/archon-ralph-dag.yaml
- .archon/workflows/defaults/archon-architect.yaml
- .archon/workflows/defaults/archon-idea-to-pr.yaml
Summary
worktree.baseBranch. The engine substitutes$BASE_BRANCHcorrectly; the bug is that some prompts/commands fail to instruct the AI to pass--base $BASE_BRANCHtogh pr create.worktree.baseBranchin.archon/config.yamlget PRs filed against the wrong base, requiring manualgh pr editcleanup. Superseded PR fix: ensure all PR-creating workflows target $BASE_BRANCH #1453 is itself an example — it was opened against the wrong base because the workflow that created it hit this exact bug.--base $BASE_BRANCHtogh pr createinvocations inarchon-architect,archon-refactor-safely, andarchon-implement-issue. Added a defensiveverify-pr-basebash node to all 9 PR-creating bundled workflows that auto-corrects viagh pr editif the AI ever drops the flag.packages/*/src/**is modified. The engine-layer substitution and fail-fast guard at `executor-shared.ts:287-310` and the bash-node substitution path at `dag-executor.ts:1252-1268` are already correct and intentionally not touched.UX Journey
Before
```
User Archon AI agent GitHub
──── ────── ──────── ──────
runs workflow ────▶ resolves $BASE_BRANCH from worktree.baseBranch
builds prompt
streams to AI ──────▶ runs `gh pr create --title ... --body ...`
(no --base flag) ──────────────────▶ PR opens against repo
default branch
(WRONG base)
sees PR ◀──────────────────────────────────────────────────────────────────── manual gh pr edit
required
```
After
```
User Archon AI agent GitHub
──── ────── ──────── ──────
runs workflow ────▶ resolves $BASE_BRANCH from worktree.baseBranch
builds prompt
streams to AI ──────▶ runs `gh pr create [--base $BASE_BRANCH] ...` ◀── *** changed
──────────────▶ PR opens against
configured base ✅
[verify-pr-base node] ──▶ `gh pr view --json baseRefName` ◀── *** new
if mismatch:
`gh pr edit --base $EXPECTED` ◀── *** new
sees correctly-targeted PR ◀──────────────────────────────────────────────────
```
Architecture Diagram
Before
```
DAG (per PR-creating workflow):
... ──▶ create-pr ──▶ (downstream nodes)
```
After
```
DAG (per PR-creating workflow):
... ──▶ create-pr ──▶ [+] verify-pr-base ──▶ (downstream nodes)
│
└─ `gh pr view --json baseRefName`
if mismatch: `gh pr edit --base $EXPECTED`
```
Connection inventory:
Label Snapshot
Change Metadata
Linked Issue
Validation Evidence (required)
```bash
bun run validate
```
Evidence provided: `bun run validate` exit code 0 on commit `283a978b`.
Security Impact (required)
Compatibility / Migration
Human Verification (required)
End-to-end verified by running `archon-architect` against a project whose `.archon/config.yaml` set `worktree.baseBranch` to a non-default branch.
Side Effects / Blast Radius (required)
Rollback Plan (required)
Risks and Mitigations
Summary by CodeRabbit