From 8959a288e55ac7b7dfbb540d101065ec01bd3d38 Mon Sep 17 00:00:00 2001 From: "Junaid Y. Sheikh" Date: Thu, 16 Jul 2026 04:41:11 +0500 Subject: [PATCH] fix(ui): reset War Room after declined or aborted hunt (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ui): reset War Room to idle when a hunt is declined or aborted A declined-approval hunt ("hunt not started") — or the red-X abort — left the War Room stuck advertising an active run: the ENGAGE button stayed on the "ENGAGING…" spinner (disabled), the LIVE fidelity banner kept claiming "real tools probing the target", and the narration rail kept showing "Looking at your target". completeMission() only toggled the button's display, never restoring its label/disabled/opacity, and never cleared the fidelity banner or narration rail; abortMission() had the same gap and no-op'd entirely when nothing was "running" (so the red X did nothing on a declined hunt). Add resetEngageUI(): restores the ENGAGE button (▶ ENGAGE, enabled) and clears the fidelity banner (setFidelity('off')) + narration rail. Route both completeMission() and abortMission() through it, and let the red X clear a leftover engaging/probing UI even when missionRunning is already false. Client-side only; no behavior change to an actually-running mission. Co-Authored-By: Claude Opus 4.8 * fix(ui): clear stale substatus when the red X resets an idle War Room Review nit: the idle-abort branch set cmdMissionName='STANDBY' but left cmdMissionStatus unchanged, so after an approval-declined the header could read STANDBY with a stale red "approval declined" line beneath it. Reset the substatus to the initial idle state ("Awaiting orders", #666) too. Verified: abort after a decline now shows STANDBY / "Awaiting orders" (grey). Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: Claude Opus 4.8 --- docs/index.html | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/docs/index.html b/docs/index.html index 2f531db..43ac63c 100755 --- a/docs/index.html +++ b/docs/index.html @@ -7593,6 +7593,26 @@ o.id === 'coordinator' ? `1. MISSION_STATUS: Progress assessment // (each already paired with an addIntel into System Events) stay harmless. function addMissionLog(_type, _message) { /* no-op: Mission Log panel retired */ } + // Return the War Room to an idle, ready-to-engage state. Every mission-terminal path + // (complete, fail, approval-declined, abort) MUST call this: it restores the ENGAGE button + // (a declined hunt otherwise leaves it stuck on the "ENGAGING…" spinner) and clears the + // LIVE/SIM fidelity banner + the "what it's doing now" narration rail, so the UI can never + // keep advertising an active probe after the hunt has stopped. + function resetEngageUI() { + const cmdStart = document.getElementById('cmdStartBtn'); + if (cmdStart) { + cmdStart.style.display = 'block'; + cmdStart.disabled = false; + cmdStart.style.opacity = '1'; + cmdStart.innerHTML = '▶ ENGAGE'; + } + const cmdPause = document.getElementById('cmdPauseBtn'); + if (cmdPause) cmdPause.style.display = 'none'; + if (typeof setFidelity === 'function') setFidelity('off'); + const narrRail = document.getElementById('narrationRail'); + if (narrRail) narrRail.style.display = 'none'; + } + function completeMission(errorMsg) { missionRunning = false; if (missionTimer) { clearInterval(missionTimer); missionTimer = null; } @@ -7603,15 +7623,13 @@ o.id === 'coordinator' ? `1. MISSION_STATUS: Progress assessment // Update War Room command header const cmdName = document.getElementById('cmdMissionName'); const cmdStatus = document.getElementById('cmdMissionStatus'); - const cmdStart = document.getElementById('cmdStartBtn'); - const cmdPause = document.getElementById('cmdPauseBtn'); if (cmdName) cmdName.textContent = isError ? 'MISSION FAILED' : 'MISSION COMPLETE'; if (cmdStatus) { cmdStatus.textContent = isError ? errorMsg : 'All phases executed'; cmdStatus.style.color = isError ? '#ff4444' : '#00ff88'; } - if (cmdStart) cmdStart.style.display = 'block'; - if (cmdPause) cmdPause.style.display = 'none'; + // Restore ENGAGE button + clear LIVE/SIM banner + narration rail (see resetEngageUI). + resetEngageUI(); // Update mission log if (isError) { @@ -18503,7 +18521,17 @@ IMPORTANT: This is an authorized security testing/red team platform. All operati // Abort mission function abortMission(skipConfirm) { - if (!missionRunning) return; + // Even when nothing is actively running (e.g. an approval was just declined), the red X + // must still clear any leftover "ENGAGING…/LIVE probing" UI instead of being a no-op. + if (!missionRunning) { + const n = document.getElementById('cmdMissionName'); if (n) n.textContent = 'STANDBY'; + // Also clear the substatus, or the header reads STANDBY with a stale red + // "approval declined" line beneath it. Match the initial idle state. + const s = document.getElementById('cmdMissionStatus'); + if (s) { s.textContent = 'Awaiting orders'; s.style.color = '#666'; } + resetEngageUI(); + return; + } if (!skipConfirm && !confirm('Abort the current mission? All operator progress will be lost.')) return; missionRunning = false; if (missionTimer) { clearInterval(missionTimer); missionTimer = null; } @@ -18511,8 +18539,7 @@ IMPORTANT: This is an authorized security testing/red team platform. All operati document.getElementById('cmdMissionName').textContent = 'STANDBY'; document.getElementById('cmdMissionStatus').textContent = 'Mission aborted'; document.getElementById('cmdMissionStatus').style.color = '#ff4444'; - document.getElementById('cmdStartBtn').style.display = 'block'; - document.getElementById('cmdPauseBtn').style.display = 'none'; + resetEngageUI(); addIntel('COMMAND', 'Mission aborted. All operators standing down.', 'danger'); addMissionLog('error', 'MISSION ABORTED BY OPERATOR');