From d952dfe3a2f827e81fb6e0bb87dfb80d09363f3e Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Sat, 13 Jun 2026 01:16:56 +0000 Subject: [PATCH] =?UTF-8?q?fix(#4024):=20trifecta=20round-2=20=E2=80=94=20?= =?UTF-8?q?rehydrate=20root-turn,=20always-preserve=20detail=20tab,=20drop?= =?UTF-8?q?=20redundant=20Running:=20name=20prefix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - C1-r2 (both Codex+Opus): _rehydrateTransparentStreamDom now also rewires the root element when it IS the assistant turn (querySelectorAll only matched descendants), so turn-toggle + event-controls re-bind after a live-turn restore. - O-Bug2-r2: preserve the Full/Output detail tab regardless of open state. - r2 #4: drop the 'Running: ' name prefix — the legible status badge already carries it (V6 redundancy class). --- static/ui.js | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/static/ui.js b/static/ui.js index f84cfca5..20e7e525 100644 --- a/static/ui.js +++ b/static/ui.js @@ -6842,7 +6842,13 @@ function _syncTransparentEventControls(turn){ } function _rehydrateTransparentStreamDom(root){ if(!root||!isTransparentStream()) return; - root.querySelectorAll('.assistant-turn').forEach(turn=>{ + // Handle BOTH a container root and a root that IS itself an assistant turn + // (the live-turn restore path passes the #liveAssistantTurn element directly, + // which querySelectorAll('.assistant-turn') would not match). (Trifecta C1 r2.) + const turns=[]; + if(root.matches&&root.matches('.assistant-turn')) turns.push(root); + root.querySelectorAll('.assistant-turn').forEach(turn=>turns.push(turn)); + turns.forEach(turn=>{ _wireTransparentTurnToggle(turn); _syncTransparentEventControls(turn); }); @@ -6878,7 +6884,10 @@ function _decorateTransparentEventRow(row, opts){ if(card) card.classList.add('transparent-event-card'); if(header){ const nameEl=header.querySelector('.tool-card-name'); - if(nameEl) nameEl.textContent=(status==='Running'?`Running: ${_toolShortName(name)}`:_toolShortName(name)); + // The status badge (now legible per V2) already carries "Running", so don't + // also prefix the name with "Running:" — that's the same redundancy class + // V6 removed from the detail body. (Trifecta r2 #4.) + if(nameEl) nameEl.textContent=_toolShortName(name); let statusEl=header.querySelector('.transparent-event-status'); if(!statusEl){ statusEl=document.createElement('span'); @@ -10394,19 +10403,21 @@ function appendLiveToolCard(tc){ replacement.dataset.liveTid=tid; // Preserve the user's expand state + detail tab across tool completion: // the running row is rebuilt fresh on toolComplete, which would otherwise - // snap an expanded row shut and reset its Full/Output tab. (Trifecta O-Bug2.) + // snap an expanded row shut and reset its Full/Output tab. The detail-mode + // is preserved regardless of open state (a user who picked Output then + // collapsed should still get Output on re-open). (Trifecta O-Bug2 + r2.) try{ const _oldCard=existing.querySelector('.tool-card,.thinking-card'); const _newCard=replacement.querySelector('.tool-card,.thinking-card'); + const _oldDetail=existing.querySelector('.tool-card-detail'); + const _newDetail=replacement.querySelector('.tool-card-detail'); + const _mode=_oldDetail&&_oldDetail.getAttribute('data-transparent-detail-mode'); + if(_newDetail&&_mode){ + const _tab=_newDetail.querySelector(`.transparent-detail-mode[data-mode="${_mode}"]`); + if(_tab) _setTransparentDetailMode(_tab,_mode); + } if(_oldCard&&_newCard&&_oldCard.classList.contains('open')){ _setTransparentCardOpen(_newCard,true); - const _oldDetail=existing.querySelector('.tool-card-detail'); - const _newDetail=replacement.querySelector('.tool-card-detail'); - const _mode=_oldDetail&&_oldDetail.getAttribute('data-transparent-detail-mode'); - if(_newDetail&&_mode){ - const _tab=_newDetail.querySelector(`.transparent-detail-mode[data-mode="${_mode}"]`); - if(_tab) _setTransparentDetailMode(_tab,_mode); - } } }catch(_){ /* non-fatal: completion still renders, just collapsed */ } existing.replaceWith(replacement);