Skip to content

Report a project checkout's new branch base as its merge base - #5853

Closed
alexandre-vl wants to merge 1 commit into
get-bb:mainfrom
alexandre-vl:fix/project-checkout-merge-base
Closed

alexandre-vl wants to merge 1 commit into
get-bb:mainfrom
alexandre-vl:fix/project-checkout-merge-base

Conversation

@alexandre-vl

Copy link
Copy Markdown
Contributor

Human comments

What was wrong

#3227 moved the project checkout into its plugin. The merge base the server used to record for a new branch (resolveProvisionedEnvironmentBranchMetadata) was dropped in the move. The provider reports none, so a thread's diff falls back to the default branch, and a branch made from dev shows dev's commits as its own.

What changed

  • The checkout host reports the ref it made a new branch from, as the worktree host reports its base. The provider passes it on as mergeBaseBranch. An existing branch, or the checkout used as-is, reports none, as before Environment providers: plugins own where threads run #3227.
  • Restore reports the merge base the destroyed environment had. The engine stores whatever restore returns (environment-engine.ts#L510), so it would otherwise be dropped.
  • No HOST_DAEMON_PROTOCOL_VERSION bump. The field is on the plugin's own host RPC, and the daemon runs the host artifact the server sends (plugin-host-manager.ts#L442-L458).

How you verified

  • New integration test project-checkout-branches.test.ts: a new branch from origin/dev reads an empty diff and records origin/dev. At e0f6fda it fails with expected 'A\tdev.txt\n' to be ''.
  • Unit tests cover the host's report, create and restore. Each fails with its part of the fix reverted.
  • These pass:
    • turbo run typecheck for the plugin and the integration tests
    • the plugin's tests (46)
    • the smoke, multi-thread and environments integration suites (39)
    • oxlint and oxfmt on the changed files

Fixes #5850

AGENT GENERATED

get-bb#3227 moved the checkout into this plugin and dropped the merge base the server used to record for a new branch, so a thread's diff fell back to the default branch. The host now reports the ref it made the branch from, as the worktree host does, and a restored environment keeps the merge base it had.
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @alexandre-vl for the PR. This repo approves new contributors before it reviews their PRs, so this PR now closes on its own. That is expected. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ), post a link to this PR, and explain what it changes and why. A maintainer then adds you to the allow list and can reopen the PR.

@github-actions github-actions Bot closed this Oct 20, 2026
@alexandre-vl
alexandre-vl deleted the fix/project-checkout-merge-base branch October 20, 2026 20:21
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.

Project checkout records no merge base for a new branch, so its diff is read against the default branch

1 participant