Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Stop terminal close from auto-reopening with replayed history

Julius Marminge2cd92ae6f510
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 70f248b70..c57ef71b7 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -320,7 +320,7 @@ export default function ChatView() {
.catch(() => undefined);
if ("close" in api.terminal && typeof api.terminal.close === "function") {
void api.terminal
- .close({ threadId: activeThreadId, terminalId })
+ .close({ threadId: activeThreadId, terminalId, deleteHistory: true })
.catch(() => fallbackExitWrite());
} else {
void fallbackExitWrite();
diff --git a/apps/web/src/store.test.ts b/apps/web/src/store.test.ts
index eb8662dd9..e2e083e3b 100644
--- a/apps/web/src/store.test.ts
+++ b/apps/web/src/store.test.ts
@@ -301,13 +301,13 @@ describe("store reducer thread continuity", () => {
});
expect(next.threads[0]?.terminalOpen).toBe(true);
- expect(next.threads[0]?.terminalIds).toEqual([`${DEFAULT_THREAD_TERMINAL_ID}-next`]);
+ expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]);
expect(next.threads[0]?.runningTerminalIds).toEqual([]);
- expect(next.threads[0]?.activeTerminalId).toBe(`${DEFAULT_THREAD_TERMINAL_ID}-next`);
+ expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID);
expect(next.threads[0]?.terminalGroups).toEqual([
{
- id: `group-${DEFAULT_THREAD_TERMINAL_ID}-next`,
- terminalIds: [`${DEFAULT_THREAD_TERMINAL_ID}-next`],
+ id: `group-${DEFAULT_THREAD_TERMINAL_ID}`,
+ terminalIds: [DEFAULT_THREAD_TERMINAL_ID],
},
]);
});
diff --git a/apps/web/src/store.ts b/apps/web/src/store.ts
index ad5564979..44d2ff02d 100644
--- a/apps/web/src/store.ts
+++ b/apps/web/src/store.ts
@@ -164,13 +164,6 @@ function fallbackGroupId(terminalId: string): string {
return `group-${terminalId}`;
}
-function replacementTerminalId(closedTerminalId: string): string {
- const normalizedId = closedTerminalId.trim();
- return normalizedId === DEFAULT_THREAD_TERMINAL_ID
- ? `${DEFAULT_THREAD_TERMINAL_ID}-next`
- : DEFAULT_THREAD_TERMINAL_ID;
-}
-
function assignUniqueGroupId(groupId: string, usedGroupIds: Set<string>): string {
if (!usedGroupIds.has(groupId)) {
usedGroupIds.add(groupId);
@@ -276,7 +269,7 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread {
const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId);
if (remainingTerminalIds.length === 0) {
- const nextTerminalId = replacementTerminalId(terminalId);
+ const nextTerminalId = terminalId;
const nextTerminalGroupId = fallbackGroupId(nextTerminalId);
return normalizeThreadTerminals({
...thread,