fix(worktree): resolve real remote+default branch, not hardcoded origin/main (INT-2545)#271
Merged
Merged
Conversation
…dcoded origin/main (INT-2545)
The daemon could not do code work on entire repos. createWorktree() +
commitAndCreatePR() hardcoded 'origin/main' everywhere, so any repo that doesn't
match BOTH assumptions failed at the very first step:
- default branch is 'master' (pykiwoom-rest, ArtifactNet) → 'git worktree add …
origin/main' died with 'fatal: invalid reference: origin/main' → worktree creation
failed → the issue could NEVER be worked (observed live: the dominant daemon error,
every STO-* task stuck);
- remote isn't named 'origin' (vega-agent uses 'unohee') → same failure.
resolveBaseRef(gitDir) now resolves {remote, branch, ref}: prefer <remote>/HEAD,
fall back to main then master; pick 'origin' if present else the first remote. Wired
through the whole create→commits-ahead→push→PR chain and the overlap report, so
master-default and non-origin repos work end to end (create from the real base, push
to the real remote, PR against the real base branch).
Tests: resolveBaseRef over origin/main, origin/master, and a non-origin remote;
createWorktree succeeds on a master-default repo and a non-origin repo; and
commitAndCreatePR (fake gh on PATH) pushes to the resolved remote and PRs against the
resolved base. tsc + oxlint clean, full suite 148 files / 1760 passed; openswarm review APPROVE.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The daemon could not do code work on entire repos.
createWorktree()+commitAndCreatePR()hardcodedorigin/maineverywhere, so any repo that doesn't match BOTH assumptions failed at the very first step:master(pykiwoom-rest, ArtifactNet) →git worktree add … origin/maindied withfatal: invalid reference: origin/main→ worktree creation failed → the issue could never be worked. This was the dominant daemon error in the live logs (every STO-* task stuck).origin(vega-agent usesunohee) → same failure.Fix
resolveBaseRef(gitDir)resolves{remote, branch, ref}: prefer<remote>/HEAD, fall back tomainthenmaster; pickoriginif present else the first configured remote. Wired through the whole create → commits-ahead → push → PR chain and the overlap report, so master-default and non-origin repos work end to end (branch from the real base, push to the real remote, PR against the real base branch).Tests
resolveBaseRefover origin/main, origin/master, and a non-origin (unohee) remotecreateWorktreesucceeds on a master-default repo and a non-origin repo (both previously fataled)commitAndCreatePR(fakeghon PATH) pushes to the resolved remote and PRs against the resolved base — proving completed work isn't strandedtsc + oxlint clean, full suite 148 files / 1760 passed / 1 skipped,
openswarm reviewAPPROVE.Context
Found while fixing OpenSwarm so the daemon actually does code work (
/goalsession). This is the #1 reason the pykiwoom-rest/ArtifactNet/vega-agent In Progress issues weren't being processed. Related: INT-2545 (orphan branches), INT-2548 (ENOSPC crash), INT-2521 (exception handling).🤖 Generated with Claude Code