Repository navigation
Closed
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
Not sure
Steps to reproduce
- Open the branch picker for a repository with a local branch that is not checked out.
- Close the branch picker.
- Outside T3 Code, create a worktree for that existing branch without switching the original checkout.
- Reopen the branch picker from the original checkout.
Expected behavior
The branch shows a worktree badge.
Actual behavior
The branch still appears as an ordinary local branch.
Impact
Minor bug or occasional failure. People who manage worktrees outside T3 Code can see stale checkout information each time they reopen a branch list already held by the app.
Version or commit
main at db9efc5cf0. The cause is at packages/client-runtime/src/state/vcsRefInvalidation.ts:99.
Environment
Linux x64 boat.dev default machine, a fresh checkout.
Logs or stack traces
The feature branch option fails to contain the text worktree.Automated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/scripts/scenarios/branch-picker-sees-external-worktree.e2e.ts b/scripts/scenarios/branch-picker-sees-external-worktree.e2e.ts
new file mode 100644
index 0000000000..ccd14a4616
--- /dev/null
+++ b/scripts/scenarios/branch-picker-sees-external-worktree.e2e.ts
@@ -0,0 +1,71 @@
+/// <reference lib="dom" />
+import { expect } from "e2e";
+import * as Effect from "effect/Effect";
+
+import { run } from "./shell.ts";
+import { runPromise, test, WEB } from "./t3.ts";
+
+test(
+ "Reopening the branch picker shows a worktree created outside T3 Code",
+ WEB,
+ async ({ t3, app, browser, screen }) => {
+ const project = await t3.project("demo");
+ const git = (...args: string[]) => runPromise(run("git", args, { cwd: project }));
+ await git("branch", "feature");
+ await browser.setViewport({ width: 1280, height: 800 });
+
+ // Wait for the real server's first forced ref listing to complete before changing Git.
+ await browser.addInitScript(() => {
+ const refreshRequests = new Set<string>();
+ const watched = new WeakSet<WebSocket>();
+ const send = WebSocket.prototype.send;
+ WebSocket.prototype.send = function (data) {
+ if (typeof data === "string") {
+ for (const request of [JSON.parse(data)].flat()) {
+ if (request?.tag === "vcs.listRefs" && request.payload?.refresh === true) {
+ refreshRequests.add(String(request.id));
+ }
+ }
+ }
+ if (!watched.has(this)) {
+ watched.add(this);
+ this.addEventListener("message", (event) => {
+ if (typeof event.data !== "string") return;
+ for (const response of [JSON.parse(event.data)].flat()) {
+ if (
+ response?._tag === "Exit" &&
+ response.exit?._tag === "Success" &&
+ refreshRequests.has(String(response.requestId))
+ ) {
+ document.documentElement.dataset.refRefresh = "done";
+ }
+ }
+ });
+ }
+ return send.call(this, data);
+ };
+ });
+
+ await t3.open("/");
+ const branchPicker = browser
+ .locator('[data-slot="combobox-trigger"][aria-label^="Branch:"]:visible')
+ .first();
+ await branchPicker.click();
+ await screen.getByRole("option", /^feature\b/).waitFor();
+ await browser.locator('html[data-ref-refresh="done"]').waitFor({ state: "attached" });
+ await browser.keyboard.press("Escape");
+ // The server coalesces forced snapshot reads for five seconds.
+ await runPromise(Effect.sleep("6 seconds"));
+
+ await git("worktree", "add", "../other-checkout", "feature");
+ try {
+ await branchPicker.click();
+ const feature = screen.getByRole("option", /^feature\b/);
+ await feature.waitFor();
+ await app.screenshot("branch-picker-after-external-worktree");
+ await expect(feature).toContainText("worktree");
+ } finally {
+ await git("worktree", "remove", "../other-checkout");
+ }
+ },
+);pnpm scenarios:prove scripts/scenarios/branch-picker-sees-external-worktree.e2e.ts --base mainWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.


Activity