fix(FN-771): reset disclosure state on task creation and preserve terminal sessions across reconnects
- Reset isDisclosureExpanded in QuickEntryBox resetForm so disclosure collapses after task creation - Remove sticky disclosure persistence from QuickEntryBox component - Preserve terminal sessions across transient WebSocket disconnects with buffer/replay - Buffer and replay initial terminal state for prompt visibility on reconnect - Update tests for non-persistent disclosure, terminal reconnect, and server routes - Remove unused UsageIndicator tests and TaskDetailModal test cleanup
This commit is contained in:
@@ -461,12 +461,10 @@ export function setupTerminalWebSocket(
|
||||
clearInterval(pingInterval);
|
||||
if (dataUnsub) dataUnsub();
|
||||
if (exitUnsub) exitUnsub();
|
||||
// Kill the PTY session to prevent session leaks
|
||||
try {
|
||||
terminalService.killSession(sessionId);
|
||||
} catch {
|
||||
// Ignore errors during cleanup — session may already be dead
|
||||
}
|
||||
// Do NOT kill the PTY session on WebSocket close — the session should
|
||||
// survive transient disconnects and modal close/reopen cycles. Sessions
|
||||
// are cleaned up through explicit kill paths (tab close, restart, shell
|
||||
// exit) or stale-session eviction.
|
||||
});
|
||||
|
||||
ws.on("error", () => {
|
||||
@@ -474,15 +472,28 @@ export function setupTerminalWebSocket(
|
||||
clearInterval(pingInterval);
|
||||
if (dataUnsub) dataUnsub();
|
||||
if (exitUnsub) exitUnsub();
|
||||
// Kill the PTY session to prevent session leaks
|
||||
try {
|
||||
terminalService.killSession(sessionId);
|
||||
} catch {
|
||||
// Ignore errors during cleanup — session may already be dead
|
||||
}
|
||||
// Do NOT kill the PTY session on WebSocket error — same rationale as
|
||||
// close: the session should persist for reconnection attempts.
|
||||
});
|
||||
});
|
||||
|
||||
// Periodic stale-session eviction (every 60 s) so that PTY sessions are
|
||||
// eventually cleaned up when clients disconnect permanently without going
|
||||
// through explicit kill paths. The eviction threshold is defined by
|
||||
// TerminalService (default 5 minutes of inactivity).
|
||||
const staleEvictionInterval = setInterval(() => {
|
||||
try {
|
||||
terminalService.evictStaleSessions();
|
||||
} catch {
|
||||
// Ignore errors during periodic eviction
|
||||
}
|
||||
}, 60_000);
|
||||
|
||||
// Stop eviction timer when the server shuts down
|
||||
server.once("close", () => {
|
||||
clearInterval(staleEvictionInterval);
|
||||
});
|
||||
|
||||
console.log("Terminal WebSocket server mounted at /api/terminal/ws");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user