mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 08:59:40 +02:00
feat(split): Pane B reconnects as soon as the server is back
When SSE comes back after a server restart, handleInit's reconnect branch already re-opens the primary pane's socket; it now also calls the split pane tile's reconnectNow(), so Pane B no longer waits out its backoff (up to 10 s between tries) after every deploy. Live: Pane B was back 4.6 s after the server process respawned, i.e. as soon as it listened. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4581,6 +4581,10 @@ class CodemanApp {
|
|||||||
// a give-up) nothing else would re-establish it from here.
|
// a give-up) nothing else would re-establish it from here.
|
||||||
if (this._wsSessionId !== restoreId) this._connectWs(restoreId);
|
if (this._wsSessionId !== restoreId) this._connectWs(restoreId);
|
||||||
void this._onSessionNeedsRefresh({ id: restoreId });
|
void this._onSessionNeedsRefresh({ id: restoreId });
|
||||||
|
// The split pane's second terminal reconnects on its own backoff (up to
|
||||||
|
// 10 s between tries); the server is back now, so skip the wait. A no-op
|
||||||
|
// while its socket is open, stopped for good, or destroyed.
|
||||||
|
this._splitPane?.reconnectNow?.();
|
||||||
} else {
|
} else {
|
||||||
this.activeSessionId = null;
|
this.activeSessionId = null;
|
||||||
// `auto`: the app is restoring a session on load, not a human opening
|
// `auto`: the app is restoring a session on load, not a human opening
|
||||||
|
|||||||
@@ -676,3 +676,16 @@ describe('TerminalTile claims the keyboard for the app-level shortcuts', () => {
|
|||||||
expect(term.focusListeners).toEqual([]);
|
expect(term.focusListeners).toEqual([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('the server coming back kicks Pane B', () => {
|
||||||
|
it("handleInit's reconnect branch asks the split pane's tile to reconnect without waiting out its backoff", () => {
|
||||||
|
// handleInit needs a whole app to run, so the wiring is pinned by source;
|
||||||
|
// reconnectNow() itself is exercised above.
|
||||||
|
const appSource = readFileSync(resolve(import.meta.dirname, '../src/web/public/app.js'), 'utf8');
|
||||||
|
const start = appSource.indexOf('if (keepTerminal && restoreId === previousActiveId');
|
||||||
|
const branch = appSource.slice(start, appSource.indexOf('} else {', start));
|
||||||
|
|
||||||
|
expect(start).toBeGreaterThan(-1);
|
||||||
|
expect(branch).toContain('this._splitPane?.reconnectNow?.();');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user