The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 18:30 UTC
Stop terminal close from auto-reopening with replayed history
Co-authored-by: codex <codex@users.noreply.github.com>
Julius Marminge committed
Feb 15, 2026 at 00:10 UTC
2cd92ae6f510f5b9b44175fad3f96cb872eb41c1
3 files changed
+6
-13
apps/web/src/components/ChatView.tsx
+1
-1
@@ -320,7 +320,7 @@ export default function ChatView() {
320
.catch(() => undefined);
321
if ("close" in api.terminal && typeof api.terminal.close === "function") {
322
void api.terminal
323
- .close({ threadId: activeThreadId, terminalId })
323
+ .close({ threadId: activeThreadId, terminalId, deleteHistory: true })
324
.catch(() => fallbackExitWrite());
325
} else {
326
void fallbackExitWrite();
apps/web/src/store.test.ts
+4
-4
@@ -301,13 +301,13 @@ describe("store reducer thread continuity", () => {
301
});
302
303
expect(next.threads[0]?.terminalOpen).toBe(true);
304
- expect(next.threads[0]?.terminalIds).toEqual([`${DEFAULT_THREAD_TERMINAL_ID}-next`]);
304
+ expect(next.threads[0]?.terminalIds).toEqual([DEFAULT_THREAD_TERMINAL_ID]);
305
expect(next.threads[0]?.runningTerminalIds).toEqual([]);
306
- expect(next.threads[0]?.activeTerminalId).toBe(`${DEFAULT_THREAD_TERMINAL_ID}-next`);
306
+ expect(next.threads[0]?.activeTerminalId).toBe(DEFAULT_THREAD_TERMINAL_ID);
307
expect(next.threads[0]?.terminalGroups).toEqual([
308
{
309
- id: `group-${DEFAULT_THREAD_TERMINAL_ID}-next`,
310
- terminalIds: [`${DEFAULT_THREAD_TERMINAL_ID}-next`],
309
+ id: `group-${DEFAULT_THREAD_TERMINAL_ID}`,
310
+ terminalIds: [DEFAULT_THREAD_TERMINAL_ID],
311
},
312
]);
313
});
apps/web/src/store.ts
+1
-8
@@ -164,13 +164,6 @@ function fallbackGroupId(terminalId: string): string {
164
return `group-${terminalId}`;
165
}
166
167
-function replacementTerminalId(closedTerminalId: string): string {
168
- const normalizedId = closedTerminalId.trim();
169
- return normalizedId === DEFAULT_THREAD_TERMINAL_ID
170
- ? `${DEFAULT_THREAD_TERMINAL_ID}-next`
171
- : DEFAULT_THREAD_TERMINAL_ID;
172
-}
173
-
167
function assignUniqueGroupId(groupId: string, usedGroupIds: Set<string>): string {
168
if (!usedGroupIds.has(groupId)) {
169
usedGroupIds.add(groupId);
@@ -276,7 +269,7 @@ function closeThreadTerminal(thread: Thread, terminalId: string): Thread {
269
270
const remainingTerminalIds = thread.terminalIds.filter((id) => id !== terminalId);
271
if (remainingTerminalIds.length === 0) {
279
- const nextTerminalId = replacementTerminalId(terminalId);
272
+ const nextTerminalId = terminalId;
273
const nextTerminalGroupId = fallbackGroupId(nextTerminalId);
274
return normalizeThreadTerminals({
275
...thread,