Skip to content

Fix desktop IME enter handling and gateway restart guards - #37603

Open
nickytod wants to merge 1 commit into
NousResearch:mainfrom
nickytod:ari/fix-ime-gateway-restart
Open

Fix desktop IME enter handling and gateway restart guards#37603
nickytod wants to merge 1 commit into
NousResearch:mainfrom
nickytod:ari/fix-ime-gateway-restart

Conversation

@nickytod

@nickytod nickytod commented Jun 2, 2026

Copy link
Copy Markdown

Summary

  • Add shared desktop IME composition detection and use it for Enter handlers in composer, edit composer, rename, and onboarding inputs.
  • Hard-block raw systemctl stop/restart of hermes-gateway services from inside gateway sessions, even with yolo or approvals off.
  • Change generated systemd gateway units to KillMode=control-group and assert that generated units no longer use KillMode=mixed.

Fixes #37483
Fixes #37453
Fixes #37454

Verification

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 /opt/homebrew/bin/python3.11 -m pytest tests/tools/test_approval.py::TestGatewaySystemctlRestartGuard tests/hermes_cli/test_gateway_service.py::TestGeneratedSystemdUnits::test_user_unit_avoids_recursive_execstop_and_uses_extended_stop_timeout tests/hermes_cli/test_gateway_service.py::TestGeneratedSystemdUnits::test_system_unit_avoids_recursive_execstop_and_uses_extended_stop_timeout -q -o 'addopts='
  • npm run type-check --workspace apps/desktop
  • npm run test:ui --workspace apps/desktop -- src/lib/ime.test.ts
  • npx eslint src/app/chat/composer/index.tsx src/components/assistant-ui/thread.tsx src/app/chat/sidebar/session-actions-menu.tsx src/components/desktop-onboarding-overlay.tsx src/lib/ime.ts src/lib/ime.test.ts

@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 comp/gateway Gateway runner, session dispatch, delivery labels Jun 2, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the multi-surface fix. Current main already covers the primary composer and gateway-restart reports, but this branch still contains useful desktop sibling-path coverage.

Problems

  • hermes_cli/gateway.py:2381 and :2416 change KillMode away from the current remediation. Current main intentionally retains KillMode=mixed in hermes_cli/gateway.py:2764/:2798 and reaps orphans through ExecStopPost plus gateway/cgroup_cleanup.py:1-12 (commit e551da6ddb39a712c93e6c48a16aa748e2c7bc95).
  • The raw-restart approval guard is now redundant: tools/terminal_tool.py:2250-2271 blocks lifecycle commands before approval or execution, including force=True (commit 245b95b09470bb3887943122a7d0de5bf20da055).
  • Two desktop files changed here no longer exist on main. The live edit composer is now apps/desktop/src/components/assistant-ui/thread/user-edit-composer.tsx; its Enter paths at :545 and :573 remain unguarded. Current rename and onboarding Enter handlers are likewise unguarded at session-actions-menu.tsx:329-336, onboarding/flow.tsx:82-88, and onboarding/index.tsx:642-664.

Suggested changes

  • Salvage the remaining IME guards and tests onto those current desktop paths, while dropping the superseded gateway/systemd portions.

Automated hermes-sweeper review.

Comment thread hermes_cli/gateway.py
@@ -2381,7 +2381,7 @@ def generate_systemd_unit(system: bool = False, run_as_user: str | None = None)
RestartMaxDelaySec=300

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not change this to KillMode=control-group. Current main intentionally preserves KillMode=mixed and adds ExecStopPost=-...gateway.cgroup_cleanup to reap orphaned per-PID processes after shutdown; see hermes_cli/gateway.py:2764-2768 and gateway/cgroup_cleanup.py:1-12 (commit e551da6ddb39a712c93e6c48a16aa748e2c7bc95).

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 comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

3 participants