Skip to content

fix(cli): make refresh_interval configurable, default to 0 (disabled) - #48319

Closed
Elshayib wants to merge 2 commits into
NousResearch:mainfrom
Elshayib:fix/cli-refresh-interval-default
Closed

fix(cli): make refresh_interval configurable, default to 0 (disabled)#48319
Elshayib wants to merge 2 commits into
NousResearch:mainfrom
Elshayib:fix/cli-refresh-interval-default

Conversation

@Elshayib

Copy link
Copy Markdown
Contributor

Summary

prompt_toolkit refresh_interval=1.0 (introduced in 6724daa2c for idle clock ticking) causes a full UI redraw every second in non-fullscreen CLI mode. Terminal emulators with "auto-scroll on output" (Xshell, iTerm2, Windows Terminal) interpret this as new content and snap the viewport to the bottom, fighting the user's manual scroll position.

Fixes #48309.

Changes

  • hermes_cli/config.py: Added "cli_refresh_interval": 0 to the display config defaults. Default 0 = disabled (no background redraw), preserving pre-6724daa2c behavior.
  • cli.py: Replaced hardcoded refresh_interval=1.0 with float(CLI_CONFIG.get("display", {}).get("cli_refresh_interval", 0)). Users who want the idle clock ticking can set display.cli_refresh_interval: 1.0 in config.yaml.
  • tests/hermes_cli/test_config.py: Added TestCliRefreshIntervalConfig verifying the default is 0.

Test plan

  • tests/hermes_cli/test_config.py::TestCliRefreshIntervalConfig — PASSED
  • Full tests/hermes_cli/test_config.py — 101/101 PASSED

islam666 added 2 commits June 18, 2026 08:04
…le lock healing

When _release_session_guard skips cleanup due to guard mismatch
(e.g., reset/new command swapped the interrupt_event), the finally
block in _process_message_background was deleting _session_tasks[key]
before attempting to release the guard. This left _active_sessions
with a stale guard but no _session_tasks entry, making
_session_task_is_stale() return False (task=None → not stale).

The stale lock was never healed, causing permanent deadlock: subsequent
messages were received but never dispatched to the agent.

Fix: only delete _session_tasks[key] if _release_session_guard
actually removed _active_sessions[key]. When the guard mismatches,
the _session_tasks entry is preserved so _session_task_is_stale can
detect the done task and _heal_stale_session_lock clears both entries
on the next inbound message.

Regression test: test_guard_mismatch_preserves_session_task_for_stale_detection

Refs: #48300
prompt_toolkit's refresh_interval=1.0 causes a full UI redraw every
second in non-fullscreen mode. Terminal emulators with "auto-scroll on
output" interpret this as new content and snap the viewport to the
bottom, fighting the user's manual scroll position.

Fix: add display.cli_refresh_interval config key (default 0 = disabled).
Users who want the idle clock ticking can set a positive value in
config.yaml.

Fixes #48309.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists labels Jun 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Competing with #48321 for the same fix (#48309). This PR makes the idle redraw configurable via a new display.cli_refresh_interval key (default 0 = disabled) with config defaults + test coverage; #48321 hardcodes refresh_interval=0 in non-fullscreen mode (1 line). Same goal, different mechanism — maintainer picks one. Note: this PR's diff also touches gateway/platforms/base.py and an unrelated test file (minor stacked-branch contamination); the core fix in cli.py/hermes_cli/config.py is clean.

@Elshayib

Copy link
Copy Markdown
Contributor Author

Thanks for flagging. I'm aware of #48321 — both PRs address the same root cause (the auto-scroll fight from idle redraw), but the approaches differ:

This PR is strictly a superset of #48321's behavior — same default, but configurable. I'd suggest we merge this one and close #48321, since anyone who wants the clock ticking can set display.cli_refresh_interval: 1.0. Happy to discuss if maintainers prefer the simpler approach.

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor

Acknowledged: noted competing PR(s) #48321, #48309, #48321. My approach differs and is complementary, not mutually exclusive. Open to consolidating if reviewers prefer one direction.

teknium1 added a commit that referenced this pull request Jun 19, 2026
Follow-up to the salvaged #48312 — adds the config-default test (ported
from #48319) and the AUTHOR_MAP entry for the cherry-picked commit.
@teknium1

Copy link
Copy Markdown
Contributor

Resolved via the config knob added in #49056 and finalized in #49087 (commit d7bff94). We kept the default at 1.0 (live status bar) rather than 0 after testing, and your config-default test approach was salvaged into the change. Your unrelated gateway base.py change wasn't part of this fix. Thanks for the contribution and credit on the test pattern!

@teknium1 teknium1 closed this Jun 19, 2026
xyshanren pushed a commit to xyshanren/hermes-agent-cn that referenced this pull request Jun 25, 2026
Follow-up to the salvaged NousResearch#48312 — adds the config-default test (ported
from NousResearch#48319) and the AUTHOR_MAP entry for the cherry-picked commit.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
Follow-up to the salvaged NousResearch#48312 — adds the config-default test (ported
from NousResearch#48319) and the AUTHOR_MAP entry for the cherry-picked commit.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
Follow-up to the salvaged NousResearch#48312 — adds the config-default test (ported
from NousResearch#48319) and the AUTHOR_MAP entry for the cherry-picked commit.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
Follow-up to the salvaged NousResearch#48312 — adds the config-default test (ported
from NousResearch#48319) and the AUTHOR_MAP entry for the cherry-picked commit.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
Follow-up to the salvaged NousResearch#48312 — adds the config-default test (ported
from NousResearch#48319) and the AUTHOR_MAP entry for the cherry-picked commit.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
Follow-up to the salvaged NousResearch#48312 — adds the config-default test (ported
from NousResearch#48319) and the AUTHOR_MAP entry for the cherry-picked commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: refresh_interval=1.0` causes terminal auto-scroll-to-bottom in non-fullscreen mode

4 participants