Skip to content

fix: find open jobs when running fix from main branch#624

Merged
wesm merged 2 commits intomainfrom
fix/fix-main-branch
Apr 5, 2026
Merged

fix: find open jobs when running fix from main branch#624
wesm merged 2 commits intomainfrom
fix/fix-main-branch

Conversation

@wesm
Copy link
Copy Markdown
Collaborator

@wesm wesm commented Apr 5, 2026

Summary

  • Skip API-level branch filter when branch is auto-resolved. queryOpenJobs was sending branch=main&branch_include_empty=true to the server, which excluded jobs originally created on feature branches whose commits were later merged to main. When no --branch flag is passed, the API query now omits the branch filter and relies on filterReachableJobs for commit-graph reachability. Applied to runFixOpen, runFixList, runFixBatch, and runCompact.

  • Fall back to branch matching when a SHA is unreachable. filterReachableJobs used git merge-base --is-ancestor to check whether a job's commit SHA is reachable from HEAD. When a commit has been amended, squashed, or rebased, the original SHA is no longer an ancestor of HEAD — but the dangling object still exists, so git returns exit code 1 (not ancestor) rather than 128 (unknown object). This caused filterReachableJobs to silently drop the job. Now when a SHA is unreachable, it falls back to branch matching: if the job's branch matches the current branch, the job is included.

🤖 Generated with Claude Code

wesm and others added 2 commits April 4, 2026 18:47
When running `roborev fix` from the main branch without --branch,
queryOpenJobs filtered by branch=main in the API query. This excluded
jobs originally created on feature branches whose commits were later
merged to main — the server-side branch filter eliminated them before
filterReachableJobs could check commit-graph reachability via
git merge-base --is-ancestor.

Skip the API-level branch filter when the branch was auto-resolved
(not passed via --branch). filterReachableJobs already handles
the actual filtering using commit-graph reachability for SHA refs
and branch matching for non-SHA refs.

Applied the same fix to runFixList, runFixBatch, and runCompact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a commit's SHA is no longer reachable from HEAD (e.g., after
amend, squash, or rebase), git merge-base --is-ancestor returns
exit code 1 and filterReachableJobs silently dropped the job.

Fall back to branch matching when the SHA is unreachable: if the
job's branch matches the current branch, include it. This handles
amended/rebased commits on the same branch while still excluding
jobs from other branches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@roborev-ci
Copy link
Copy Markdown

roborev-ci bot commented Apr 5, 2026

roborev: Combined Review (f005b93)

Verdict: Changes are not ready to merge due to 1 medium-severity correctness issue.

Medium

  • cmd/roborev/compact.go around lines 325-339 and cmd/roborev/fix.go around lines 683-699: when --branch is not provided, the new flow clears the resolved current branch before calling filterReachableJobs. That prevents jobReachable from using the current branch as a fallback discriminator, so the default compact / fix list path can retain unrelated unreachable jobs and makes the new fallback ineffective in normal usage. Pass the resolved current branch into filterReachableJobs for client-side filtering even if you omit it from the API query.

Synthesized from 3 reviews (agents: codex, gemini | types: default, security)

@wesm
Copy link
Copy Markdown
Collaborator Author

wesm commented Apr 5, 2026

False positive. This PR fixes an issue I was experiencing

@wesm wesm merged commit 45987ff into main Apr 5, 2026
8 checks passed
@wesm wesm deleted the fix/fix-main-branch branch April 5, 2026 12:56
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.

1 participant