Skip to content

feat: pick a base branch per repo for multi-repo isolated runs - #295

Merged
LoganRupe merged 1 commit into
multi-repo-workspacesfrom
feature/113/per-repo-base-branches
Sep 23, 2026
Merged

LoganRupe merged 1 commit into
multi-repo-workspacesfrom
feature/113/per-repo-base-branches

Conversation

@LoganRupe

@LoganRupe LoganRupe commented Sep 23, 2026

Copy link
Copy Markdown
Owner

What Changed

  • Contract: prepareWorktree gains an optional repoBaseBranches: [{ repoRoot, baseBranch }], holding only explicit picks. baseBranch still means the anchor repo, so older clients are unaffected.
  • Server: each non-anchor repo root bases on its pick, else its own default branch (origin/HEAD, via a new GitWorkflowService.resolveDefaultBranch), else its checked-out branch. "Start from origin" now fetches in each repo, falling back to the local branch, and a default branch that only exists on origin still resolves.
  • Web: in new-worktree mode on a multi-repo project, a "+N repos" menu sits next to the anchor's "From " selector, with a branch submenu per repo showing that repo's default until you pick. Picks are kept in a small in-memory store keyed by thread (repoBaseBranchStore.ts), not in composerDraftStore, to keep this out of the upstream draft store; a page reload drops them and the default applies.
  • Mobile: the base-branch list now queries the anchor repo root. It still queried the directory holding the .code-workspace, so the list was empty there, the same bug web had before b652075. Mobile has no per-repo picker; the other repos get the server's origin/HEAD default.

Behaviour change: with no pick, non-anchor repos now start from their default branch rather than whatever they have checked out, matching how the anchor already defaults.

Why

Fixes #113. One base selector couldn't serve N repos with different defaults (master, dev, main in the report). The anchor got the chosen base and every other repo silently branched off its current HEAD.

Verified: the multi-repo bootstrap tests in server.test.ts cover a pick, an origin/HEAD default and per-repo start-from-origin; server, web, mobile and contracts typecheck clean. In a real dev build, with web checked out on feature/x and origin/HEAD at dev, no pick gives a dev worktree and picking main gives main, confirmed on disk.

Limits: each submenu lists the repo's first 100 refs with no search.

UI Changes

Before/after, new isolated run in a two-repo project; the agent reports which branch the web worktree came from:

issue-113-before-after.mp4

A multi-repo isolated run based only the anchor repo on the chosen
branch; every other repo branched off whatever it had checked out, and
mobile's base-branch list was empty because it queried the directory
holding the .code-workspace.

prepareWorktree gains an optional repoBaseBranches list of per-repo
picks. The server bases each non-anchor repo on its pick, else its own
default branch (origin/HEAD), else its checkout, and "start from origin"
now fetches per repo. The web composer shows a "+N repos" menu next to
the anchor's base selector with a branch submenu per repo. Mobile lists
the anchor repo's branches and leaves the rest to the server default.

Fixes #113
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L labels Sep 23, 2026
@LoganRupe
LoganRupe merged commit 538c915 into multi-repo-workspaces Sep 23, 2026
7 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants