fix: terminal quota leak and dead-terminal reuse; error boundary against blank panel
- Terminals were never destroyed when their tab closed (socket drop only
detached listeners), so the per-session quota (3) filled up and new
terminals failed to mount with 'terminal limit reached'. Now the client
sends a {type:'close'} control frame on tab teardown and the host releases
the pty immediately; a bare socket drop (refresh/switch) keeps the process
for a 30s grace period, and a reconnect within it cancels the pending
close. open() also respawns a process whose shell already exited instead
of reusing a dead handle (input sink).
- The sidebar portal renders inside an error boundary: a render failure now
shows a dismissible error strip with the message (console.error with the
component stack) instead of a silent blank panel.
- Tests: +2 real-pty smoke specs (close releases quota + respawn after
exit; reconnect cancels pending close).
This commit is contained in:
1 parent
56a27990d7
commit
0621504e1b
6 files changed
+158
-9
No files matched your search
@@ -99,6 +99,12 @@ export function TerminalView(props: { sessionId: string; tabId: string }) {
|
||||
window.clearTimeout(retry)
|
||||
observer.disconnect()
|
||||
inputSub.dispose()
|
||||
// Tell the host the owning tab is gone so it releases the terminal
|
||||
// quota immediately (best effort; a dropped socket gets the grace
|
||||
// period on the host side instead).
|
||||
if (socket !== null && socket.readyState === WebSocket.OPEN) {
|
||||
socket.send(JSON.stringify({ type: 'close' }))
|
||||
}
|
||||
socket?.close()
|
||||
term.dispose()
|
||||
connectRef.current = null
|
||||
|
||||
Reference in new issue
Block a user