From 6c1fe51ca62d7082e6974707616456a27155c19e Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Sat, 20 Jun 2026 22:09:34 +0000 Subject: [PATCH] =?UTF-8?q?fix(#4411):=20BRICK=20=E2=80=94=20infinite=20re?= =?UTF-8?q?cursion=20in=20live=20anchor-scene=20window=20exports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex ship-gate (CORE). ui.js:9241 re-exported three top-level functions via same-name wrappers (window.X = function(){ return X() }). In a classic script a top-level `function X(){}` IS window.X, so the wrapper reassigns that global to itself → infinite recursion → RangeError: Maximum call stack size exceeded on every live worklog render / session reattach / snapshot-restore path (send, sessions.js:1264/1375/570). Replace with direct assignments. JS-only brick the pytest suite can't catch (no JS execution) — confirmed by classic-script semantics + will verify live in-browser. Co-authored-by: franksong2702 --- static/ui.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/static/ui.js b/static/ui.js index a36cc783..accabb04 100644 --- a/static/ui.js +++ b/static/ui.js @@ -9238,15 +9238,15 @@ function _renderLiveAnchorActivitySceneSnapshotForStream(streamId, scene, sessio return renderLiveAnchorActivityScene(streamId,scene,{...(opts||{}),sessionId}); } if(typeof window!=='undefined'){ - window._renderLiveAnchorActivitySceneForStream=function(streamId, sessionId, opts){ - return _renderLiveAnchorActivitySceneForStream(streamId, sessionId, opts); - }; - window._renderLiveAnchorActivitySceneSnapshotForStream=function(streamId, scene, sessionId, opts){ - return _renderLiveAnchorActivitySceneSnapshotForStream(streamId, scene, sessionId, opts); - }; - window._projectLiveAnchorActivitySceneForStream=function(streamId, mode){ - return _projectLiveAnchorActivitySceneForStream(streamId, mode); - }; + // Direct assignment, NOT a same-name wrapper: these are top-level `function` + // declarations, which in a classic script are already window properties. + // Re-exporting via `window.X = function(){ return X() }` reassigns that same + // global property to the wrapper, so the inner call resolves to the wrapper + // itself → infinite recursion (RangeError: Maximum call stack size exceeded) + // on every live render / reattach / snapshot-restore path (#2715/#2771 class). + window._renderLiveAnchorActivitySceneForStream=_renderLiveAnchorActivitySceneForStream; + window._renderLiveAnchorActivitySceneSnapshotForStream=_renderLiveAnchorActivitySceneSnapshotForStream; + window._projectLiveAnchorActivitySceneForStream=_projectLiveAnchorActivitySceneForStream; window.isLiveAnchorActivitySceneOwner=isLiveAnchorActivitySceneOwner; } function _renderSettledAnchorSceneForMessage(message, segment, rawIdx){