Skip to content

[Fix] Resolve implicit repository branches from origin HEAD#635

Merged
daniel-lxs merged 1 commit into
developfrom
codex/fix-all-repos-default-branch
Jul 20, 2026
Merged

[Fix] Resolve implicit repository branches from origin HEAD#635
daniel-lxs merged 1 commit into
developfrom
codex/fix-all-repos-default-branch

Conversation

@daniel-lxs

Copy link
Copy Markdown
Member

What changed

  • Prefer the fetched local origin/HEAD when a task does not explicitly select a branch.
  • Fall back to the remote HEAD lookup with a bounded retry.
  • Verify remote-tracking refs before checkout and fail with a clear diagnostic when neither HEAD nor stored metadata points to an existing branch.
  • Add regression coverage for stale metadata, missing local HEAD, verified stored defaults, and unresolved defaults.

Why

All-repositories tasks intentionally omit a branch. If stored repository metadata was stale and the remote HEAD lookup returned no result, the worker previously fell through to that stale value and attempted a checkout such as origin/main even when the repository default was develop.

This keeps explicit branch selections unchanged while making implicit default-branch resolution resilient to stale metadata and transient provider lookups.

Addresses the branch-checkout failure reported in #630.

Validation

  • pnpm exec dotenvx run -f .env.test -- pnpm --filter @roomote/worker exec vitest run src/workspace/__tests__ src/commands/setup/__tests__/workspace.test.ts (69 tests)
  • pnpm --filter @roomote/worker check-types
  • pnpm --filter @roomote/worker lint
  • Full pre-push suite: oxlint, residual lint, fast typecheck, and knip
  • Real clone of easonLiangWorldedtech/Roomote with deliberately stale main metadata checked out develop
  • Rebuilt local worker release archive and confirmed the packaged worker contains the new resolver

@roomote-roomote

roomote-roomote Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • apps/worker/src/workspace/workspace-manager.ts:854 git fetch --all does not refresh the symbolic refs/remotes/origin/HEAD. After a repository changes its default branch while the old branch still exists, this stale local ref is verified and selected before ls-remote, so an implicit checkout remains on the old default branch. Refresh the remote HEAD or prefer the remote lookup before trusting the cached ref.

Reviewed 8423323

@daniel-lxs
daniel-lxs merged commit 0f9e16d into develop Jul 20, 2026
18 checks passed
@daniel-lxs
daniel-lxs deleted the codex/fix-all-repos-default-branch branch July 20, 2026 21:54
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