Skip to content

fix(cli): repaint input area after inline /steer and /model submit#34839

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-61091be6
May 30, 2026
Merged

fix(cli): repaint input area after inline /steer and /model submit#34839
teknium1 merged 1 commit into
mainfrom
hermes/hermes-61091be6

Conversation

@teknium1

@teknium1 teknium1 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

/steer (and /model) submitted mid-run now reliably clear from the CLI input field instead of lingering as stale text that could be accidentally re-submitted. Fixes #34569.

Root cause: handle_enter dispatches /steer and /model inline on the UI thread while the agent is running — buffer.reset() then return. Unlike every other early-return branch in the handler (sudo, secret, approval, slash-confirm, model-picker, clarify), these two skipped event.app.invalidate(). process_command() prints through patch_stdout (scrolls output above the prompt, never redraws the input line), so the just-cleared input area could keep showing the submitted /steer <text> until an unrelated redraw fired — looking unsent and inviting a re-submit.

Changes

  • cli.py: add event.app.invalidate() after buffer.reset() in both inline-command branches of handle_enter, matching the sibling early-return branches.
  • tests/cli/test_steer_inline_repaint_34569.py: AST invariant — every reset-then-return branch in handle_enter must call event.app.invalidate() first.

Validation

Before After
Inline /steer early-return resets buffer, no repaint resets buffer + invalidate()
Sibling branches (sudo/approval/clarify/…) already invalidate unchanged
Live PTY repro (mid-run /steer) input area can show stale text empty placeholder, no re-submit
tests/cli/ steer tests 7 pass 8 pass (new guard fails when fix reverted)

Thanks to @twdevjim for the detailed report.

Infographic

cli-steer-repaint-fix

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels May 29, 2026
handle_enter dispatches /steer and /model inline on the UI thread while
the agent is running, calling buffer.reset() then returning. Unlike every
other early-return branch in the handler, these two skipped
event.app.invalidate(). process_command() prints through patch_stdout
(scrolls output above the prompt without redrawing the input line), so the
just-cleared input area could keep showing the submitted '/steer <text>'
until an unrelated redraw fired — looking unsent and inviting an accidental
re-submit.

Add event.app.invalidate() after reset in both inline branches to match
the sibling branches. AST regression test pins the invariant: every
reset-then-return branch in handle_enter must invalidate first.

Fixes #34569
@teknium1 teknium1 force-pushed the hermes/hermes-61091be6 branch from 4a195d6 to 0d6a355 Compare May 30, 2026 00:24
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-61091be6 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9457 on HEAD, 9457 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 4911 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1 teknium1 merged commit 04de307 into main May 30, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-61091be6 branch May 30, 2026 02:04
sradetzky pushed a commit to sradetzky/hermes-agent that referenced this pull request May 30, 2026
…ousResearch#34839)

handle_enter dispatches /steer and /model inline on the UI thread while
the agent is running, calling buffer.reset() then returning. Unlike every
other early-return branch in the handler, these two skipped
event.app.invalidate(). process_command() prints through patch_stdout
(scrolls output above the prompt without redrawing the input line), so the
just-cleared input area could keep showing the submitted '/steer <text>'
until an unrelated redraw fired — looking unsent and inviting an accidental
re-submit.

Add event.app.invalidate() after reset in both inline branches to match
the sibling branches. AST regression test pins the invariant: every
reset-then-return branch in handle_enter must invalidate first.

Fixes NousResearch#34569
KKT-OPT pushed a commit to KKT-OPT/hermes-agent that referenced this pull request May 31, 2026
…ousResearch#34839)

handle_enter dispatches /steer and /model inline on the UI thread while
the agent is running, calling buffer.reset() then returning. Unlike every
other early-return branch in the handler, these two skipped
event.app.invalidate(). process_command() prints through patch_stdout
(scrolls output above the prompt without redrawing the input line), so the
just-cleared input area could keep showing the submitted '/steer <text>'
until an unrelated redraw fired — looking unsent and inviting an accidental
re-submit.

Add event.app.invalidate() after reset in both inline branches to match
the sibling branches. AST regression test pins the invariant: every
reset-then-return branch in handle_enter must invalidate first.

Fixes NousResearch#34569
alt-glitch pushed a commit that referenced this pull request Jun 14, 2026
…34839)

handle_enter dispatches /steer and /model inline on the UI thread while
the agent is running, calling buffer.reset() then returning. Unlike every
other early-return branch in the handler, these two skipped
event.app.invalidate(). process_command() prints through patch_stdout
(scrolls output above the prompt without redrawing the input line), so the
just-cleared input area could keep showing the submitted '/steer <text>'
until an unrelated redraw fired — looking unsent and inviting an accidental
re-submit.

Add event.app.invalidate() after reset in both inline branches to match
the sibling branches. AST regression test pins the invariant: every
reset-then-return branch in handle_enter must invalidate first.

Fixes #34569
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.

/steer leaves submitted prompt in TUI input buffer, allows accidental re-submit

2 participants