Skip to content

fix(gateway): keep pending /update completion notifications until the target platform reconnects - #38522

Closed
Frowtek wants to merge 1 commit into
NousResearch:mainfrom
Frowtek:fix/update-completion-notification-late-reconnect
Closed

Frowtek wants to merge 1 commit into
NousResearch:mainfrom
Frowtek:fix/update-completion-notification-late-reconnect

Conversation

@Frowtek

@Frowtek Frowtek commented Jun 3, 2026

Copy link
Copy Markdown

What does this PR do?

When /update completes while the target messaging platform hasn't reconnected
yet (e.g. right after the restart hermes update triggers), the gateway dropped
the completion markers without notifying the user — so the final "update
finished / failed" message was lost permanently, even after the platform came
back online.

The root cause was in _send_update_notification(): when the update had
finished but the adapter couldn't be resolved, the send was skipped yet the
finally block still deleted every marker file. This treats "adapter missing"
as a definitive skip instead of a recoverable, deferred state.

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/run.py — _send_update_notification(): when the update is finished
    but the target adapter isn't connected, preserve the markers and defer
    (return False) instead of cleaning up. Markers are only removed once the
    notification is actually delivered or the marker is genuinely undeliverable.
  • gateway/run.py — _watch_update_progress() completion-only fallback: keep
    retrying until delivery succeeds (or the deadline is hit) rather than giving
    up after the first completion check, so a platform that reconnects shortly
    after completion still gets notified in-process.
  • tests/gateway/test_update_command.py, tests/gateway/test_update_streaming.py
    — updated the contract test and added regression coverage for the
    defer → reconnect → deliver flow (delivered exactly once, then cleaned up).

How to Test

  1. Start /update from a messaging platform and let it trigger a gateway restart.
  2. Ensure the target platform is offline/not yet reconnected at completion time.
  3. Once the platform reconnects, confirm the final update result is delivered to
    the originating chat (previously it was silently dropped).

Regression tests:
scripts/run_tests.sh tests/gateway/test_update_command.py tests/gateway/test_update_streaming.py tests/gateway/test_platform_reconnect.py -q

Checklist

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(gateway):)
  • I searched for existing PRs to avoid duplicates
  • My PR contains only changes related to this fix
  • Added regression tests for the fix
  • Considered cross-platform impact — or N/A
  • Docs/config/tool-schema updates — N/A

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels Jun 3, 2026
@teknium1

teknium1 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Merged via PR #39091: #39091

Cherry-picked onto current main with your authorship preserved. Thanks!

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