feat(gateway): background process notification modes + fix spinner line spam - #840
Merged
Conversation
Add display.background_process_notifications config option to control how chatty the gateway process watcher is when using terminal(background=true, check_interval=...) from messaging platforms. Modes: - all: running-output updates + final message (default, current behavior) - result: only the final completion message - error: only the final message when exit code != 0 - off: no watcher messages at all Also supports HERMES_BACKGROUND_NOTIFICATIONS env var override. Includes 12 tests (5 config loading + 7 watcher behavior). Inspired by @PeterFile's PR #593. Closes #592.
…atch_stdout The KawaiiSpinner animation would occasionally spam dozens of duplicate lines instead of overwriting in-place with \r. This happened because prompt_toolkit's StdoutProxy processes each flush() as a separate run_in_terminal() call — when the write thread is slow (busy event loop during long tool executions), each \r frame gets its own call, and the terminal layout save/restore between calls breaks the \r overwrite semantics. Fix: rate-limit flush() calls to at most every 0.4s. Between flushes, \r-frame writes accumulate in StdoutProxy's buffer. When flushed, they concatenate into one string (e.g. \r frame1 \r frame2 \r frame3) and are written in a single run_in_terminal() call where \r works correctly. The spinner still animates (flush ~2.5x/sec) but each flush batches ~3 frames, guaranteeing the \r collapse always works. Most visible with execute_code and terminal tools (3+ second executions).
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
…x spinner line spam - feat(gateway): configurable background_process_notifications (off/result/error/all) - fix(display): rate-limit spinner flushes to prevent line spam under patch_stdout Background notifications inspired by @PeterFile (PR NousResearch#593).
19 tasks
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
…x spinner line spam - feat(gateway): configurable background_process_notifications (off/result/error/all) - fix(display): rate-limit spinner flushes to prevent line spam under patch_stdout Background notifications inspired by @PeterFile (PR NousResearch#593).
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…x spinner line spam - feat(gateway): configurable background_process_notifications (off/result/error/all) - fix(display): rate-limit spinner flushes to prevent line spam under patch_stdout Background notifications inspired by @PeterFile (PR NousResearch#593).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two changes on this branch:
1. Configurable background process watcher notifications
Adds
display.background_process_notificationsconfig option to control how chatty the gateway process watcher is when usingterminal(background=true, check_interval=...)from Telegram/Discord/etc.Modes:
Also supports
HERMES_BACKGROUND_NOTIFICATIONSenv var override.Inspired by @PeterFile's PR #593 (stale branch, reimplemented on current main). Closes #592.
2. Fix spinner line spam under prompt_toolkit's patch_stdout
The KawaiiSpinner animation would occasionally spam dozens of duplicate lines instead of overwriting in-place with
\r. Root cause: prompt_toolkit'sStdoutProxyprocesses eachflush()as a separaterun_in_terminal()call — when the write thread is slow (busy event loop during long tool executions likeexecute_codeorterminal), each\rframe gets its own call, breaking the overwrite semantics.Fix: Rate-limit
flush()calls to every 0.4s. Between flushes,\r-frame writes accumulate in the buffer. Each flush batches ~3 frames into one write, guaranteeing the\rcollapse always works.Changes
gateway/run.py— new_load_background_notifications_mode()+ updated_run_process_watcher()agent/display.py— rate-limited spinner flush to prevent line spamcli-config.yaml.example— documented new config optionAGENTS.md— added background process notifications sectionTest plan
pytest tests/ -q # 2810 passed