Repository navigation
feat(tui): notify when GAIA needs you, and keep the PC awake - #5235
kovtcharov wants to merge 1 commit into
Conversation
… turn Long local turns made people switch windows and miss approval prompts and questions, and a laptop could sleep mid-turn. The terminal UI now sends a desktop notification through the terminal (OSC 777 or OSC 9, with the bell as fallback) when a step needs approval, the agent asks a question, or a turn finishes, and only while the terminal is in the background. Each event has its own setting (notify_approval, notify_question, notify_finished in ~/.gaia/config.json). While GAIA works on a turn the PC is kept from idle-sleeping (SetThreadExecutionState, caffeinate, systemd-inhibit), released when the turn ends or waits on the user; a failure is reported once in the chat. keep_awake turns it off. A wrapper around the root model watches ChatModel.Attention() and acts on edges, so the chat view makes no calls. Notifications share a locked stdout with the renderer so they never land inside a frame. Focus comes from focus reports, except on Windows, where Bubble Tea drops console focus events and the foreground window is compared instead. Closes amd#5231
|
Verdict: Approve The terminal UI now sends a desktop notification when a step needs approval, the agent asks a question, or a turn finishes, and only while the terminal is in the background. It also keeps the PC from idle-sleeping during a turn. I found no correctness or safety problems. Agent text is cleaned before it goes into the terminal escape sequence, approval notifications never include the command line, sensitive questions stay out of the OS notification history, and the keep-awake hold is released whenever a prompt waits on the user. All four new settings are on by default and can each be turned off with Real-world evidenceN/A: no evidence bundle was produced for this run. The PR description reports a live Windows Terminal 1.24 run with a scripted agent. With the TUI in front, a finished turn sent nothing; with another window in front, it sent OSC 777 + BEL. Keep-awake held and released around each turn. Two paths still lack live proof: the approval notification (unit tests only, because the scripted agent can't raise an approval) and the real popup on Windows Terminal 1.26. Those are fair to leave until after merge. For everything outside the author's run, this verdict rests on reading the code. 🔍 Technical detailsIssues found (minor only, none blocking)
Strengths
|
Long local turns run for minutes, so people switch windows and miss approval prompts and questions. The turn then sits waiting, and a laptop can idle-sleep in the middle of it. Now the terminal UI sends a desktop notification through the terminal when a step needs approval, the agent asks a question, or a turn finishes, but only while the terminal is in the background. It also keeps the PC awake while GAIA works on a turn, and reports once in the chat if the OS refuses.
Builds on #5155 (base is its branch, so this diff is only this work) and lands after v0.25.0.
Closes #5231
🔍 Technical details
ChatModel.Attention()after every update and acts on edges. The chat view makes no calls;model.gogains 4 lines, so it can route a one-off notice past overlays.;. Approval notifications omit the command line, because the OS keeps notifications in its history and on the lock screen.tea.WithOutput), so one can never land inside a frame's escape sequence.CSI ?1004h) arrive asFocusMsg/BlurMsg. Bubble Tea v1.3.10 drops console focus events on Windows, so there the foreground window is compared with the console's root owner. Another tab of the same Windows Terminal window counts as focused. A terminal that never reports focus never notifies (documented, including tmuxfocus-events).caffeinate -i -w <pid>on macOS;systemd-inhibit --what=idle:sleepon Linux, released by closing a pipe. Linux therefore also holds off a manual suspend; the docs say so. The hold drops while a prompt waits on the user. A helper that fails at start or dies mid-turn is reported once.notify_approval,notify_question,notify_finished,keep_awakein~/.gaia/config.json, all on by default, declared inGaiaConfigsogaia config setaccepts them as strict booleans.compatibility.allowOSC777turned on; earlier versions get the bell.Test plan
cd tui && go test ./...andgo vet ./...pass;GOOS=linuxandGOOS=darwingo vetpass for the new packagespython -m pytest tests/unit/test_cli_config.pypasses;python util/lint.py --black --isortpasses;util/check_doc_links.py --internal-onlypassesknown=true)compatibility.allowOSC777on (this machine has 1.24, which only rings the bell)-race(TUI Build & Test). The realcaffeinatehold passes on macOS; on the Linux runnersystemd-inhibitis refused (no login session), so that one platform test skips with the plain-words error