Repository navigation
fix(app): show the main checkout's branch for Local in new sessions - #62061
Merged
Merged
Conversation
3 of 6 tasks
Contributor
There was a problem hiding this comment.
The fix works. In a draft opened from a worktree session with Local selected, the branch label now shows the main checkout's branch, and submitting still starts the session in the main checkout.
How I checked: I ran the new e2e case on this branch, where it passes, and on dev, where it fails because the label shows the worktree's branch. The screenshots below show the same draft on each. The new-session unit tests (75 pass) and tsc -b in packages/app also pass.
The label and submit now read the same root, so they can't drift apart again, and the added e2e case is small and on point.
Public API: unchanged (app-internal only).
No concerns.
Related: #51992
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
A new session opened from a worktree session keeps that worktree as its directory. With Local selected, the branch label read that worktree, while submitting started the session in the main checkout. Local now reads the main checkout's branch, and the label and submit use the same directory, so they can't disagree again.
Fixes #55327
This supersedes #55787, which fixes the same label but conflicts with
devand expects the old New worktree behavior thatdevhas since changed. Thanks @udayasree25 for the earlier fix.Changes
new-session/workspace/controller.ts: Local and New worktree take their branch from the main checkout, and Local's branch is refreshed when it isn't the draft's own directory.new-session/composer-adapter.ts: submitting uses that same directory instead of working it out separately.e2e/regression/new-session.spec.ts: a draft opened in a worktree shows the main checkout's branch beside Local and submits there. It fails ondev.Checks
bun typecheck(packages/app): passesbun test ./src/new-session(packages/app): 75 passbun run lint:changed origin/dev: 0 problemse2e/regression/new-session.spec.ts(built): 38 of 39 pass. The one failure, "the title and message stay stable through worktree creation", fails the same way ondevwithout this change.Before / after
Draft opened in
.worktrees/quiet-river(branchworktree-branch), main checkout oncheckout-branch, Local selected.Before:
After:
Visual
Added by the opencode bot (AI-generated).
Related: #51992