fix(#4411): BRICK — infinite recursion in live anchor-scene window exports

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 <franksong2702@users.noreply.github.com>
This commit is contained in:
nesquena-hermes committed 2026-06-20 22:09:34 +00:00
1 parent 81a4945be8
commit 6c1fe51ca6
1 file changed
+9 -9
+9 -9
View File
@@ -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){