Skip to content

fix(agent): surface silent partial-stream recovery (salvage #41498) - #53686

Closed
infinitycrew39 wants to merge 2 commits into
NousResearch:mainfrom
infinitycrew39:fix/partial-stream-recovery-41498
Closed

fix(agent): surface silent partial-stream recovery (salvage #41498)#53686
infinitycrew39 wants to merge 2 commits into
NousResearch:mainfrom
infinitycrew39:fix/partial-stream-recovery-41498

Conversation

@infinitycrew39

@infinitycrew39 infinitycrew39 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Salvage of NousResearch/hermes-agent#41498 by @0-CYBERDYNE-SYSTEMS-0, rebased onto current main (explainer logic moved to turn_finalizer.py).

Fixes Hermes stopping mid-sentence when OAuth/Codex streaming dies after partial delivery — users previously saw a truncated reply with no explanation and had to manually type continue.

  • partial_stream_recovery: set response_previewed=False so gateway fallback delivery can send recovered text + explainer footer.
  • turn_finalizer: always append turn-completion explainer for partial_stream_recovery (not only ≤24-char fragments).
  • Detached /restart: launch helper before drain, idempotent, bounded by restart_drain_timeout + 5s.

Closes #41498.

Test plan

  • test_run_conversation_partial_stream_recovery_surfaces_explanation
  • test_partial_stream_recovery_on_empty_stub / test_partial_stream_recovery_preempts_prior_turn_fallback (updated assertions)
  • test_request_restart_is_idempotent / test_detached_restart_helper_is_idempotent
  • CI full suite

…d restart

Salvage of NousResearch#41498 (0-CYBERDYNE-SYSTEMS-0).

- Leave response_previewed false on partial_stream_recovery so gateway
  fallback delivery can send the recovered fragment plus explanation.
- Always append the turn-completion explainer for partial_stream_recovery,
  not only for empty or very short fragments (NousResearch#34452 gap).
- Launch the detached /restart helper before drain, idempotently, with a
  bounded wait of restart_drain_timeout + 5s.
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/gateway Gateway runner, session dispatch, delivery sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages P2 Medium — degraded but workaround exists labels Jun 27, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Salvage of #41498 (rebased onto current main, explainer logic moved to turn_finalizer.py). Related to the stream-recovery family: merged interrupt-partial-reply #52854 and merged guardrail-halt streaming #31448. Not a duplicate — this is the active rebased version of #41498.

@teknium1

Copy link
Copy Markdown
Contributor

Merged via #53987. The salvage was rebased onto current main (the branch here was 62 commits behind, producing a 100-file phantom diff). Your two commits landed with authorship preserved (e860a40 + 1fa4657). Thanks!

@teknium1 teknium1 closed this Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants