Skip to content

fix(gateway): stop typing before post-delivery callbacks - #37556

Merged
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
konsisumer:fix/gateway-post-delivery-typing-timeout
Jun 10, 2026
Merged

fix(gateway): stop typing before post-delivery callbacks#37556
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
konsisumer:fix/gateway-post-delivery-typing-timeout

Conversation

@konsisumer

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a gateway cleanup ordering bug where a hung post-delivery callback could prevent _process_message_background() from stopping the platform typing indicator. The adapter now stops typing before running deferred callback work and bounds awaited callbacks to 30 seconds so callback I/O cannot keep the cleanup path stuck indefinitely.

Related Issue

Refs #24971

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • gateway/platforms/base.py: stop the _keep_typing task and explicitly clear platform typing before post-delivery callbacks run; wrap awaited post-delivery callbacks in a 30-second timeout.
  • tests/gateway/test_run_progress_topics.py: add regression coverage proving a hung post-delivery callback does not keep typing alive or block message processing indefinitely.

How to Test

  1. $VIRTUAL_ENV/bin/python -m pytest tests/gateway/test_run_progress_topics.py::test_base_processing_releases_post_delivery_callback_after_main_send tests/gateway/test_run_progress_topics.py::test_base_processing_stops_typing_before_hung_post_delivery_callback -q — passed.
  2. $VIRTUAL_ENV/bin/python -m pytest tests/ -q -x --timeout=60 — failed after 5:25 in tests/acp/test_approval_isolation.py::TestAcpExecAskGate::test_interactive_env_var_routes_to_callback, outside the gateway files touched by this PR.
  3. $VIRTUAL_ENV/bin/python -m ruff check gateway/platforms/base.py tests/gateway/test_run_progress_topics.py — passed.
  4. $VIRTUAL_ENV/bin/python scripts/check-windows-footguns.py gateway/platforms/base.py tests/gateway/test_run_progress_topics.py — passed.
  5. git diff --check — passed.
  6. $VIRTUAL_ENV/bin/python -m ruff format --check gateway/platforms/base.py tests/gateway/test_run_progress_topics.py — failed because these existing files would be reformatted wholesale; this PR leaves unrelated formatting untouched.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS 15.6 arm64 (Darwin 24.6.0)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A

Screenshots / Logs

N/A

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels Jun 2, 2026
@kshitijk4poor
kshitijk4poor merged commit 6a30cfc into NousResearch:main Jun 10, 2026
23 checks passed
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
davidgut1982 pushed a commit to davidgut1982/hermes-agent that referenced this pull request Jun 17, 2026
T02200059 pushed a commit to T02200059/hermes-agent that referenced this pull request Jun 18, 2026
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
donbowman pushed a commit to donbowman/hermes-agent that referenced this pull request Jul 13, 2026
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery 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.

3 participants