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
apps/web
Steps to reproduce
- Open a thread's terminal drawer in one client.
- Create a second terminal as a separate tab.
- Open the same thread's terminal drawer in another client connected to the same environment.
- Select the first terminal in the second client.
- Close the second terminal from the first client.
Expected behavior
The closed tab disappears from the second client's drawer.
Actual behavior
The inactive tab for the closed terminal stays in the drawer.
Impact
Minor bug or occasional failure. This affects users who close a shared terminal from another client while its tab is in the background.
Version or commit
main at c4dc9ed55b. The cause is at apps/web/src/components/PersistentThreadTerminals.tsx:173.
Environment
Linux x64 boat.dev default machine, a fresh checkout.
Logs or stack traces
Expected the "closed-elsewhere" button to be hidden, but it is visible.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/terminal-closed-elsewhere-leaves-drawer.e2e.ts b/scripts/scenarios/terminal-closed-elsewhere-leaves-drawer.e2e.ts
new file mode 100644
index 0000000000..938f062b1f
--- /dev/null
+++ b/scripts/scenarios/terminal-closed-elsewhere-leaves-drawer.e2e.ts
@@ -0,0 +1,70 @@
+import * as NodeWS from "@effect/platform-node/NodeWS";
+import { ORCHESTRATION_PROTOCOL_VERSION, ThreadId, WsRpcGroup } from "@t3tools/contracts";
+import { expect } from "e2e";
+import * as Effect from "effect/Effect";
+import * as Layer from "effect/Layer";
+import * as Schema from "effect/Schema";
+import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
+import { RpcClient, RpcSerialization } from "effect/rpc";
+import { Socket } from "effect/socket";
+
+import { T3_HOME } from "../e2e.config.ts";
+import { makeState, runPromise, test, WEB } from "./t3.ts";
+
+const terminalClient = Effect.fn("scenario.terminalClient")(function* (origin: string) {
+ const issued = yield* makeState(T3_HOME).cli(["auth", "session", "issue", "--token-only"]);
+ const { ticket } = yield* HttpClient.execute(
+ HttpClientRequest.post(`${origin}/api/auth/websocket-ticket`).pipe(
+ HttpClientRequest.bearerToken(issued.stdout.trim()),
+ ),
+ ).pipe(
+ Effect.flatMap(HttpClientResponse.filterStatusOk),
+ Effect.flatMap(HttpClientResponse.schemaBodyJson(Schema.Struct({ ticket: Schema.String }))),
+ Effect.provide(FetchHttpClient.layer),
+ );
+ const protocol = yield* Layer.build(
+ RpcClient.layerProtocolSocket().pipe(
+ Layer.provide(
+ Socket.layerWebSocket(
+ `${origin.replace(/^http/, "ws")}/ws?orchestrationProtocol=${ORCHESTRATION_PROTOCOL_VERSION}&wsTicket=${encodeURIComponent(ticket)}`,
+ ),
+ ),
+ Layer.provide(RpcSerialization.layerJson),
+ Layer.provide(NodeWS.layerWebSocketConstructor),
+ ),
+ );
+ return yield* RpcClient.make(WsRpcGroup).pipe(Effect.provideContext(protocol));
+});
+
+test("The drawer removes a terminal closed by another client", WEB, async ({ t3, app, screen }) => {
+ const cwd = await t3.project("demo");
+ const thread = await t3.thread({ project: cwd, title: "Shared terminals", messages: ["first"] });
+ const threadId = ThreadId.make(thread.threadId);
+ const origin = app.baseUrl ?? "";
+ const kept = "kept-shell";
+ const closed = "closed-elsewhere";
+
+ await runPromise(
+ Effect.gen(function* () {
+ const client = yield* terminalClient(origin);
+ for (const terminalId of [kept, closed]) {
+ yield* client["terminal.open"]({ threadId, terminalId, cwd });
+ }
+ }).pipe(Effect.scoped),
+ );
+ await t3.open(thread);
+ await screen.getByRole("button", "Toggle terminal drawer").tap();
+ await screen.getByRole("button", kept, { exact: true }).tap();
+ const closedTab = screen.getByRole("button", closed, { exact: true });
+ await closedTab.waitFor();
+
+ await runPromise(
+ Effect.gen(function* () {
+ const client = yield* terminalClient(origin);
+ yield* client["terminal.close"]({ threadId, terminalId: closed, deleteHistory: true });
+ }).pipe(Effect.scoped),
+ );
+
+ await app.screenshot("after-close-from-another-client");
+ await expect(closedTab).toBeHidden();
+});pnpm scenarios:prove scripts/scenarios/terminal-closed-elsewhere-leaves-drawer.e2e.ts --base mainWorkaround
No response
Metadata
Metadata
Assignees
Labels
vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.


Activity