fix: Operation Lightspeed review fixes — padding, dead code, tablet WebGL

- Add SSE padding to backpressure drain write for tunnel clients
- Remove dead SessionTerminal from broadcast padding check
- Trim whitespace in SSE session filter query params
- Remove unused _bufferLazyTerminalData scaffolding code
- Skip WebGL on tablets too, not just phones (canvas fallback)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-03-07 06:40:09 +01:00
co-authored by Claude Opus 4.6
parent 1f30ed445c
commit 3268a12e5e
3 changed files with 15 additions and 46 deletions
+2 -3
View File
@@ -624,8 +624,8 @@ class CodemanApp {
// oversized terminal.write() calls that triggered the stalls.
// Disable with ?nowebgl URL param if GPU issues return.
this._webglAddon = null;
const isMobile = MobileDetection.getDeviceType() === 'mobile';
if (!isMobile && !new URLSearchParams(location.search).has('nowebgl') && typeof WebglAddon !== 'undefined') {
const skipWebGL = MobileDetection.getDeviceType() !== 'desktop';
if (!skipWebGL && !new URLSearchParams(location.search).has('nowebgl') && typeof WebglAddon !== 'undefined') {
try {
this._webglAddon = new WebglAddon.WebglAddon();
this._webglAddon.onContextLoss(() => {
@@ -10157,7 +10157,6 @@ class CodemanApp {
windowEntry._lazyTerminal = true;
windowEntry._lazyPaneTarget = paneData.paneTarget;
windowEntry._lazySessionId = paneData.sessionId;
windowEntry._lazyBuffer = '';
}
} else {
this.initTeammateTerminal(windowId, paneData, win);
+3 -34
View File
@@ -471,13 +471,9 @@ Object.assign(CodemanApp.prototype, {
// restore → _restoreTeammateTerminalFromLazy() → re-creates Terminal
// create (hidden/minimized) → skip initTeammateTerminal, set _lazyTerminal
//
// The pane buffer is always re-fetched from the API on restore, so no
// client-side buffer accumulation is needed (the tmux pane is the source
// of truth). Regular (non-teammate) subagent windows use activity HTML
// and are unaffected by this optimization.
/** Max bytes to buffer for a minimized teammate terminal (256KB). */
_LAZY_TERMINAL_BUFFER_CAP: 256 * 1024,
// The tmux pane buffer is re-fetched from the API on restore. Regular
// (non-teammate) subagent windows use activity HTML and are unaffected
// by this optimization.
/**
* Dispose a teammate terminal when its window is minimized.
@@ -495,8 +491,6 @@ Object.assign(CodemanApp.prototype, {
windowData._lazyTerminal = true;
windowData._lazyPaneTarget = termData.paneTarget;
windowData._lazySessionId = termData.sessionId;
// Buffer for any data that arrives while minimized (from pendingData or future writes)
windowData._lazyBuffer = '';
}
// Dispose the resize observer
@@ -532,7 +526,6 @@ Object.assign(CodemanApp.prototype, {
windowData._lazyTerminal = false;
windowData._lazyPaneTarget = null;
windowData._lazySessionId = null;
windowData._lazyBuffer = null;
if (!paneTarget || !sessionId) return;
@@ -541,29 +534,6 @@ Object.assign(CodemanApp.prototype, {
this.initTeammateTerminal(agentId, paneInfo, windowData.element);
},
/**
* Append terminal data to a minimized teammate terminal's lazy buffer.
* Called when SSE data arrives for a minimized window. Caps at _LAZY_TERMINAL_BUFFER_CAP.
* Returns true if the data was buffered, false if the window is not in lazy mode.
*/
_bufferLazyTerminalData(agentId, data) {
const windowData = this.subagentWindows.get(agentId);
if (!windowData || !windowData._lazyTerminal) return false;
if (windowData._lazyBuffer === null || windowData._lazyBuffer === undefined) {
windowData._lazyBuffer = '';
}
// Append data, capping total size
windowData._lazyBuffer += data;
if (windowData._lazyBuffer.length > this._LAZY_TERMINAL_BUFFER_CAP) {
// Keep only the tail to stay under cap
windowData._lazyBuffer = windowData._lazyBuffer.slice(-this._LAZY_TERMINAL_BUFFER_CAP);
}
return true;
},
// ═══════════════════════════════════════════════════════════════
// Subagent Floating Windows
// ═══════════════════════════════════════════════════════════════
@@ -809,7 +779,6 @@ Object.assign(CodemanApp.prototype, {
windowEntry._lazyTerminal = true;
windowEntry._lazyPaneTarget = paneInfo.paneTarget;
windowEntry._lazySessionId = paneInfo.sessionId;
windowEntry._lazyBuffer = '';
}
} else {
this.initTeammateTerminal(agentId, paneInfo, win);