You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the agent finishes streaming its reply, the event stream stays open for several seconds. SSE/HTTP consumers keep the "generating" state until the stream completes. Root cause: MemoryFlushMiddleware.onAgent appends a synchronous LLM extraction call to the agent event stream via .concatWith():
concatWith semantics require the appended flushMemories (an extra model.stream call in MemoryFlushManager) to finish before the main stream completes. subscribeOn(boundedElastic) only moves the work to another thread — it does not shorten the completion wait.
Secondary impact: HarnessGateway.withGatedStream serialises turns per gateKey; while a flush is pending, the next user message in the same session is blocked until it completes.
Repro
Default MemoryConfig.FlushTrigger.always() (flush after every call).
Observe the gap between the last text event and stream onComplete / SSE connection close ≈ duration of one extra LLM round-trip.
Expected
The event stream should complete immediately after the last agent event; memory extraction should run in the background (e.g. fire-and-forget on a daemon executor, like SkillCuratorMiddleware), with pending flushes drained on HarnessAgent.close() so no memory is lost on shutdown.
I would like to work on this issue. I plan to move the memory extraction off the user-visible stream, serialize background flushes to protect shared memory files, and add a regression test proving the agent stream completes before a slow flush. I will also add a graceful shutdown drain so pending flushes are not abandoned.
I would like to work on this issue. I plan to move the memory extraction off the user-visible stream, serialize background flushes to protect shared memory files, and add a regression test proving the agent stream completes before a slow flush. I will also add a graceful shutdown drain so pending flushes are not abandoned.
#2777
Look here, it seems my issue submission was duplicated.
Closing as resolved by #2777 (merged) — memory flush is now fire-and-forget, unblocking conversation completion. #2774 tracked the same root cause and was closed by the same PR. If conversations still hang after a flush, please reopen with details.
Activity
dangzitou commentedon Aug 25, 2026
I would like to work on this issue. I plan to move the memory extraction off the user-visible stream, serialize background flushes to protect shared memory files, and add a regression test proving the agent stream completes before a slow flush. I will also add a graceful shutdown drain so pending flushes are not abandoned.
chcodex commentedon Aug 26, 2026
#2777
Look here, it seems my issue submission was duplicated.
juruoO-o commentedon Nov 12, 2026
Closing as resolved by #2777 (merged) — memory flush is now fire-and-forget, unblocking conversation completion. #2774 tracked the same root cause and was closed by the same PR. If conversations still hang after a flush, please reopen with details.