fix(genies): local-first resolution + existing PR handling#16
fix(genies): local-first resolution + existing PR handling#16Sillhouette wants to merge 4 commits intomainfrom
Conversation
58860fb to
a6a1a77
Compare
|
@npatterson I reworked the PR a bit to address 4 clear issues and bugs, please take a look when you have a chance! |
Critic Review — PR #16:
|
When invoked as the global install (~/.claude/scripts/genies), check for a project-scoped .claude/scripts/genies and exec into it. Uses BASH_SOURCE[0] path check so project copies skip this block entirely — no env guard, no recursion risk. Co-Authored-By: Crafter <noreply@anthropic.com>
The /commit phase creates the PR; the integration phase should only push subsequent /done commits onto the existing branch. Without this check, session_integrate_pr called `gh pr create` unconditionally, causing batch runs to report failure even when the PDLC completed successfully. Refs: docs/backlog/ Co-Authored-By: Crafter <noreply@anthropic.com>
Without --log-dir, `genies status` returned an error even when a batch had just run. It now falls back to the most-recent logs/batch-* directory in the repo root, matching the path written by the batch runner. Test updated to pass STATUS_LOG_DIR=/nonexistent so CI doesn't accidentally pick up a real batch dir and mask the "no log dir" error path. Refs: docs/backlog/ Co-Authored-By: Crafter <noreply@anthropic.com>
The batch runner writes claude_stderr.log, claude_stdout.log, and batch-manifest.log alongside per-item logs. The status scanner was treating them as backlog items, producing spurious "unknown" rows in the status table and inflating the item count. Refs: docs/backlog/ Co-Authored-By: Crafter <noreply@anthropic.com>
a6a1a77 to
a58d7cb
Compare
|
Both non-blocking observations addressed: 1. Mock tightened to validate The if [[ "$1 $2" == "pr list" && "$*" == *"--head genie/existing-pr-item-deliver"* ]]; thenA wrong branch name would now cause the mock to fall through to the 2. Outside-a-git-repo path now tested ( New test invokes the global shim from a plain temp dir (no 531 tests, all green. |
Follow-up Review PassBoth observations from the first review were addressed: 1. 2. New test: global genies outside a git repo — the CI still green (lint ✓, test ✓). No new concerns. All observations resolved. Verdict: APPROVED — ready to merge. |
Full Review — PR #16 (final pass)CI: lint ✓ test ✓ (531 assertions across 3 test suites, 0 failures) Fix 1 —
|
| Fix | Correct | Tests |
|---|---|---|
Skip gh pr create when PR exists |
✅ | ✅ Branch name validated in mock |
| Local-first resolution | ✅ | ✅ All 3 paths covered |
| Auto-detect batch log dir | ✅ | ✅ Error path pinned correctly |
| Skip non-item log files | ✅ | ✅ Item present, noise absent |
Verdict: APPROVED. All four bugs fixed correctly, no regressions, CI green. The branch-cleanup and dead-code observations are follow-up items, not blockers.
|
@npatterson Candidly, I'm not sure Thoughts? |
How batch execution works
Understanding this context makes the bugs below make sense.
Each worker runs a full PDLC lifecycle:
/commitcreates the PR/donearchives the backlog item (adds commits to the branch after the PR exists)After all workers finish, the batch runner runs an integration phase for each succeeded item. It pushes any post-
/commitcommits (i.e. from/done) to the remote branch so they land in the PR, then ensures a PR exists.Bugs fixed
1. Integration phase fails when
/commitalready created a PRsession_integrate_prcalledgh pr createunconditionally. Since/commitalready opened the PR,ghreturned an error — and the batch marked the item as failed despite an APPROVED run.Fix: check for an existing open PR first. If found, return it as success. The branch push still runs first so
/donecommits are included.2. Global
geniesignores project-local installWhen genie-team is installed both globally and in a project, the global binary always ran. Project-level installs (e.g. to test a PR branch) were silently ignored.
Fix: path-based shim at startup. If running from
~/.claude/scripts/, check for a project-scoped.claude/scripts/geniesand exec into it. Project copies skip this block entirely — no env guard, no recursion risk.3.
genies statusrequired explicit--log-dirRunning
genies statuswithout--log-direrrored immediately, even during an active batch.Fix: auto-detect the most recent
logs/batch-*/directory in the repo root.4. Side-effect files appeared as batch items in status
The status scanner picked up all
*.logfiles, includingclaude_stderr.logwritten by the runner itself.Fix: skip files matching
claude_*andbatch-manifest*.Test plan
/donecommits appear in the PR after integrationgeniesfrom a project with a local install → uses local versiongeniesfrom a dir with no local install → falls back to globalgenies statuswith no flags during active batch → auto-detects log dirclaude_stderr🤖 Generated with Claude Code