Skip to content

fix(worktree): resolve real remote+default branch, not hardcoded origin/main (INT-2545)#271

Merged
unohee merged 1 commit into
mainfrom
fix/INT-2545-resolve-base-ref
Jul 6, 2026
Merged

fix(worktree): resolve real remote+default branch, not hardcoded origin/main (INT-2545)#271
unohee merged 1 commit into
mainfrom
fix/INT-2545-resolve-base-ref

Conversation

@unohee

@unohee unohee commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

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. This was the dominant daemon error in the live logs (every STO-* task stuck).
  • remote isn't named origin (vega-agent uses unohee) → same failure.

Fix

resolveBaseRef(gitDir) resolves {remote, branch, ref}: prefer <remote>/HEAD, fall back to main then master; pick origin if 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

  • resolveBaseRef over origin/main, origin/master, and a non-origin (unohee) remote
  • createWorktree succeeds on a master-default repo and a non-origin repo (both previously fataled)
  • commitAndCreatePR (fake gh on PATH) pushes to the resolved remote and PRs against the resolved base — proving completed work isn't stranded

tsc + oxlint clean, full suite 148 files / 1760 passed / 1 skipped, openswarm review APPROVE.

Context

Found while fixing OpenSwarm so the daemon actually does code work (/goal session). 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

…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.
@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

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.

@unohee unohee merged commit eec8a5e into main Jul 6, 2026
5 checks passed
@unohee unohee deleted the fix/INT-2545-resolve-base-ref branch July 6, 2026 00:24
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