Skip to content

Fix PR auto-merge: scanner detection, merge method config, trigger spam, install race#23

Merged
bearmug merged 2 commits into
mainfrom
fix/issue-22-pr-automerge-bugs
Mar 17, 2026
Merged

Fix PR auto-merge: scanner detection, merge method config, trigger spam, install race#23
bearmug merged 2 commits into
mainfrom
fix/issue-22-pr-automerge-bugs

Conversation

@bearmug
Copy link
Copy Markdown
Contributor

@bearmug bearmug commented Mar 17, 2026

Fixes #22

Summary

Four bugs preventing PR auto-merge from working correctly:

  1. Scanner can't find Claude (versioned binary)isClaudeCLI() now resolves the claude binary via exec.LookPath + filepath.EvalSymlinks at startup, matching versioned paths like .../claude/ver/<specific version> that filepath.Base returns as a version string not "claude".

  2. Merge method unset blocks auto-merge, picker persists choice — New PRs start with MergeMethod: "" and ShouldAutoMerge returns false until configured. TUI auto-shows the merge picker when adding a PR from a new repo. Picker calls SetMergeMethod to persist the choice to the daemon; the daemon stores per-repo preferences so future PRs inherit the method. YOLO mode no longer requires completed checks (repos with no CI can merge).

  3. Auto-merge fires once, not every pollMergeTriggered flag prevents re-firing /aviator merge (or gh pr merge --auto) on every 30s poll. Resets only if checks regress to failing/running.

  4. Install race conditioncsm-daemon install now polls pgrep and waits up to 2s for the old process to exit after launchctl unload before starting the new one.

Test plan

  • All daemon tests pass (go test ./... in daemon/)
  • All TUI tests pass (go test ./... in tui/)
  • PR with no CI checks + YOLO mode → merges on next poll
  • Adding PR from new repo → merge picker auto-shows
  • Adding second PR from same repo → no picker (inherits method)
  • /aviator merge comment posted at most once per eligible state

bearmug added 2 commits March 17, 2026 21:08
…am, install race

Fix 1: isClaudeCLI — resolve claude binary via which+EvalSymlinks at startup so
versioned paths (e.g. ~/.local/share/claude/versions/2.1.77) are recognised.

Fix 2: Merge method — new PRs start with MergeMethod="" (unset); ShouldAutoMerge
blocks until configured. TUI auto-shows picker for new repos on add, persists
choice via SetMergeMethod to daemon; per-repo preference stored in prs.json so
future PRs from same repo inherit it. YOLO no longer requires completed checks.

Fix 3: MergeTriggered flag — auto-merge fires once per eligible state; resets
only if checks regress to failing/running, preventing /aviator merge spam.

Fix 4: Install race — wait up to 2s for old csm-daemon to exit after launchctl
unload before loading the new one, preventing stale state overwrites.

Closes #22
- PR zoom panel now shows current merge method (e.g. '⎇ squash') or '⎇ unset'
  in the info line next to branch/commits/mergeable
- M key (shift+m) opens the merge picker in config-only mode — persists the
  method to daemon without triggering an immediate gh pr merge
- m key retains existing behavior: pick method + trigger immediate merge
- Add MergeMethod field to client TrackedPR so it flows through to the TUI
- Hints bar shows 'M set method' when a PR is selected
@bearmug bearmug merged commit 4197dde into main Mar 17, 2026
1 check passed
@bearmug bearmug deleted the fix/issue-22-pr-automerge-bugs branch March 17, 2026 20:25
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.

PR auto-merge: multiple bugs causing merge failures and spam

1 participant