Mission Control — Console Tab (Live Log Stream)
Added: Commit
ec309850— "What was built: A new Console tab in Mission Control" Segment: Infrastructure (between Servers and Radar) Backend route:/api/mc/console/logs
A new Mission Control tab that live-streams /root/botlog.log to the dashboard via 1.5s polling. Equivalent to "tail -f in the browser" with five operator conveniences layered on top.
🎯 Purpose
Replace SSH'ing into the bot host to tail -f /root/botlog.log for ad-hoc debugging. Operators get a one-click terminal in Mission Control with pause, filter, and colour-coding.
🛰️ Polling Architecture
| Phase | Behaviour |
|---|---|
First load (no offset) |
Handler reads last 256KB of the log file, splits into lines, returns up to 500 + current EOF byte position |
Subsequent polls (?offset=N) |
Handler seeks to byte N, reads to EOF, returns new lines + new EOF position |
| Incomplete trailing line (log mid-write) | Held back — offset rewinds to last \n so the next poll re-reads the line complete |
| File truncated/rotated (size < offset) | Resets to 0, returns last 500 lines, sets truncated: true so frontend clears the view |
🎛️ Operator Features (all 5)
| Feature | Behaviour |
|---|---|
| Auto-scroll toggle | Default on; button flips to "Manual" mode (stops pinning to bottom on new lines) |
| Pause/resume | Stops polling; pill changes to yellow "Paused"; resume triggers an immediate poll |
| Text filter | Case-insensitive substring filter applied live to existing + incoming lines |
| Log-level colour coding | [ERROR]→red, [WARN]→yellow, [Alert]→orange, FAILED→red bold, component tags ([ASSISTANT], [CCTV], [PersistentSSH], ...)→cyan, default→gray |
| Clear screen | Wipes the visible log (file untouched); new lines continue streaming |
Plus: 5000-line DOM cap (removes oldest), status bar (line count + file size + path), graceful "file not found" banner, HTML auto-escaping via textContent (log lines can't inject markup).
📁 Key Files
| File | Change |
|---|---|
assistant/missioncontrol.go |
New route /api/mc/console/logs + mcConsoleLogsHandler + readTailLines / readLinesFromOffset helpers + consoleTailLines const + io import |
assistant/templates/missioncontrol/tab_console.html |
New tab UI: terminal-style log viewer, control bar, status bar, inline <style> for colour classes |
assistant/static/mission_control_console.js |
New — initConsole() + 1500ms polling loop + all 5 operator features |
assistant/templates/missioncontrol/base.html |
Nav button added (Infrastructure segment) + {{ template "tab_console.html" . }} include + <script> tag |
assistant/static/mission_control.js |
switchTab hook for console tab |
🖥️ Dev Note
The log path is hardcoded to /root/botlog.log (Linux prod). On Windows dev you'll see the "Log file not found at /root/botlog.log" banner — expected. To verify against the bundled sample at assistant/logs/botlog.log, temporarily change the logPath constant in mcConsoleLogsHandler (assistant/missioncontrol.go, ~line 3630). On Linux prod with the real file present, it streams live immediately.
🔗 Related
- Mission Control API — Full endpoint reference
- System Logging — Where the log lines come from
- SHIELD System — Fellow Mission Control addition in June 2026