Repository navigation
fix(app): show the canonical branch for Local sessions - #55787
udayasree25 wants to merge 1 commit into
Conversation
Use the per-location canonical checkout for Local branch lookup and VCS refresh, matching session creation rather than a shared project record. Preserve existing and new-worktree behavior and avoid warming unrelated worktrees. Co-authored-by: Copilot <[email protected]>
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
Looks good. I reproduced #55327 at the code level using a real git repo with the main checkout on dev and a worktree on feature. On the base, Local resolved to feature. With this change it resolves to dev. Your new browser-runtime test fails on the base for the session opened from the worktree and passes here. The src/new-session tests and bun typecheck in packages/app also pass. Local now uses the same project.canonical directory that composer-adapter.ts already sends Local sessions to. That keeps the label consistent with where the session starts. Skipping the extra refresh when the canonical directory is the current one is fine, because the existing effect already refreshes it.
Public API: unchanged. The new projectDirectory argument of resolveNewSessionBranch is app-internal.
One small, optional point: the existing model-selection runner lives in test-browser/, while this one is spawned from the unit test file controller.test.ts. Moving it to test-browser/ would keep the unit and browser suites separate.
I couldn't run the desktop app here. If you can, please add before/after screenshots from a real Desktop run.
Related: #42976
|
Thanks for this fix. #62061 addresses the same issue (#55327) on current |
Issue for this PR
Closes #55327
Type of change
What does this PR do?
Local now reads and refreshes VCS data for the per-location canonical checkout, matching the current composer destination. A shared project's root can belong to another clone, so using that root alone is not sufficient. Existing-worktree and new-worktree branch behavior is unchanged; unrelated worktrees are not warmed.
I'm leaning toward matching the existing destination contract here; happy to adjust if Local's semantics change in #51805. This PR does not change session placement and is independent of #55782.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
From
packages/app:bun test --conditions=solid --isolate --preload ./happydom.ts ./src/new-session— passed, 20 tests, including an isolated runner for three browser-runtime cases. The wrong-branch and missing canonical-refresh regressions fail before the fix.bun typecheck— passed.From the repository root:
sh .husky/pre-push— passed: Bun version check, lint, and all 36 workspace typecheck tasks.bun x --no-install prettier --check packages/app/src/new-session/workspace/controller.ts packages/app/src/new-session/workspace/controller.test.ts packages/app/test-browser/fixtures/new-session-workspace.ts— passed.git diff --check— passed.Browser-runtime cases cover cold canonical VCS data, avoiding duplicate/unrelated refreshes, a separate clone sharing the project ID, and switching between Local, an existing worktree, and new-worktree creation.
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Real workspace selector and branch resolver with fixture checkout data. Cold-cache/controller wiring is covered by the browser-runtime tests; this is not a full Desktop end-to-end run.
Checklist
If you do not follow this template your PR will be automatically rejected.
Added by the opencode bot (AI-generated).
Related: #42976