Skip to content

fix: queue busy gateway messages and preserve auto-reset continuity#8544

Closed
evan966890 wants to merge 1 commit into
NousResearch:mainfrom
evan966890:fix/gateway-busy-queue-reset-carryover
Closed

fix: queue busy gateway messages and preserve auto-reset continuity#8544
evan966890 wants to merge 1 commit into
NousResearch:mainfrom
evan966890:fix/gateway-busy-queue-reset-carryover

Conversation

@evan966890

Copy link
Copy Markdown

Summary

  • change gateway busy-input handling so the default behavior is to queue follow-up user messages instead of interrupting the active turn
  • preserve continuity across automatic session resets by extracting a compact carryover summary from the previous transcript and injecting it into the next session when appropriate
  • flush memory hooks before auto-reset boundaries and keep /stop semantics fresh by suppressing carryover for manual-stop suspensions

Problem / user-visible failures

This fixes two UX failures in the gateway:

  1. Incoming follow-up messages interrupted active work too aggressively

    • A user asking for progress, sending a quick follow-up, or receiving a media echo during an active turn could interrupt the model call mid-flight.
    • The gateway already had display.busy_input_mode: queue, but that behavior only applied during restart/stop drain mode, not during ordinary busy turns.
    • Result: users could accidentally cancel the very task they were waiting on.
  2. Automatic session reset felt like sudden amnesia

    • After a crash/interruption or other auto-reset boundary, the gateway would open a new session and tell the user the previous conversation history was cleared.
    • If the old session had not yet been distilled into durable memory, the next turn lost continuity even though the user expected the agent to keep going.
    • Result: the agent felt like it “forgot” what it had just been doing.

What changed

Busy-session behavior

  • busy_input_mode now governs normal active-session follow-ups, not only restart drain mode.
  • Default behavior is now queue, while explicit interrupt config/env still restores the old behavior.
  • Added an explicit interrupt phrase allowlist for busy turns so users can still deliberately interrupt without using /stop.
  • Kept restart/drain queueing behavior intact.

Auto-reset continuity

  • Added reset_context_summary to SessionEntry.
  • On auto-reset, SessionStore builds an extractive carryover summary from recent user/assistant transcript turns.
  • The next session injects that summary into the system context and updates the user-facing reset notice so it’s clear continuity was preserved.
  • Added pre-reset boundary handling to flush memory hooks before the session rolls over.
  • Manual /stop suspensions still start truly fresh: no carryover summary is injected for manual_stop suspensions.

Tests

Targeted tests run locally:

  • python -m pytest tests/gateway/test_restart_drain.py tests/gateway/test_session_reset_notify.py tests/gateway/test_session_race_guard.py tests/gateway/test_session_model_reset.py tests/gateway/test_async_memory_flush.py tests/gateway/test_clean_shutdown_marker.py tests/gateway/test_command_bypass_active_session.py -q -o addopts=''

Result:

  • 74 passed

Notes

  • I intentionally did not stage an unrelated local package-lock.json modification.
  • The carryover summary is transcript-derived and only used for auto-reset continuity, not for explicit /new resets.

@leigents

Copy link
Copy Markdown

I am experiencing exactly this issue. After the daily auto-reset at 4am, the agent completely forgets what we were working on in the previous session. The carryover summary approach would solve this. 👍

@teknium1

Copy link
Copy Markdown
Contributor

Closing as superseded by #14762 — the core busy_input_mode fix is now on main (commit 9d147f7). Your PR also included session.py auto-reset continuity changes that weren't part of this bug's scope; if that's still a live issue for you, please open a separate focused PR and we'll look at it. Thanks for flagging the underlying bug first (Apr 12).

@teknium1 teknium1 closed this Apr 23, 2026
@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 Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Superseded by #14762 which addressed the same bug and has been merged.

@alt-glitch alt-glitch added the duplicate This issue or pull request already exists label Apr 23, 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 duplicate This issue or pull request already exists 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.

4 participants