feat(sandbox): stale session detection & lazy reconnect#39
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update design doc: channels kept assigned across disconnect (not released), enabling seamless keystroke-triggered reconnect. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Reviewed commit: Critical Issues1. Race Condition in Reconnection Logic (WormholeServer.ts:105-108)Severity: High The // Line 105-108
} else if (!this.reconnecting.has(ptyId)) {
// Terminal disconnected — lazy reconnect
await this.reconnectTerminal(ptyId, payload);
}Issue: The check and the Impact: Multiple concurrent sandbox wake requests, wasted resources, possible state corruption if both succeed. Recommendation: Add the ptyId to 2. Missing Resize Propagation for Disconnected Panes (WormholeServer.ts:364-368)Severity: Medium
private async handlePaneResize(msg: Protocol.PaneResizeMessage): Promise<void> {
this.paneSizes.set(msg.paneId, {cols: msg.cols, rows: msg.rows});
const termWs = this.terminals.get(msg.paneId);
if (!termWs) return; // ← silently drops resize
termWs.send(JSON.stringify({type: "resize", cols: msg.cols, rows: msg.rows}));
}Issue: If a pane is disconnected when the user resizes it, the new dimensions are saved to Impact: Low in practice since 3. Unbounded Memory Growth in
|
…sions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
connected: Record<string, boolean>to protocol state/layout messages, removeSessionExitMessagethis.terminals, keep buffers/channels on disconnect, broadcast layout updatereconnectTerminal()wakes the sandboxpaneConnectedstate, thread through PaneLayout, render "Disconnected — press any key to reconnect" overlay on stale panesTest plan
turbo run typecheckpasses (confirmed locally)🤖 Generated with Claude Code