Repository navigation
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
chcodex
marked this pull request as draft
November 6, 2026 09:44
chcodex
force-pushed
the
feat/agui-session-log-hydrate
branch
2 times, most recently
from
November 6, 2026 14:13
32102ac to
4318a50
Compare
This was referenced Nov 7, 2026
chcodex
force-pushed
the
feat/agui-session-log-hydrate
branch
from
November 8, 2026 07:12
c21d7e9 to
78818d4
Compare
chcodex
added a commit
to chcodex/agentscope-java
that referenced
this pull request
Nov 8, 2026
4 of 5 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a reconnect path for an AG-UI run: when the browser refreshes or the connection drops, the client can reattach to a run that is still executing and keep receiving its events, without starting a new run.
attachis a read-only observer. It never starts, resumes or interrupts an agent, never calls a model, and never writes to the session log. The same cursor always produces the same events, so retrying a reconnect is safe.API
AguiRequestProcessor.attach(AguiRuntimeContextRequest)— cursor and execution run id both resolved from the request (Last-Event-IDorforwardedProps.agentscope.*).AguiSessionLogReplay.attach(input, log, after, executionRunId, config)— for applications that resolve theSessionLogthemselves.AguiFramedEventcarries the AG-UI event plus the nativeSessionEvent.seq(), exposed as the SSEid.How it works
attachreplays committed events after the cursor, projecting eachSessionEventinto AG-UI events (text, reasoning, tool calls/results, interactions, interrupts).run/end; when the run has already ended it drains the remaining events and finishes withRUN_FINISHEDorRUN_ERROR.RUN_ERRORframes rather than transport errors, so the caller can decide how to degrade.run/startstill opens with a synthetic, uncursoredRUN_STARTED, so official AG-UI clients accept the stream.Cursors are native
SessionEvent.seq()values; they are not AG-UI fields and must not be mixed with another session or the Service SSE cursor.Message ids
Replayed assistant messages use the committed turn identity instead of the per-model-call id:
messageId=SessionEvent.turnId();messageId=SessionEvent.turnId() + ":reasoning", so reasoning never shares the text id;modelCallIdremains only for tool-call attribution (lastToolCallByModelCall), never for text or reasoning ids.One turn can span several model calls. The first text segment opens the turn id with
TEXT_MESSAGE_START,model/endcloses it withTEXT_MESSAGE_END, and text after a tool call reopens the same id with a newTEXT_MESSAGE_START. A chunk that arrives while the id is still open does not emit anotherTEXT_MESSAGE_START. Reasoning follows the same lifecycle under its:reasoningnamespace, so streamed and replayed SessionLog projections produce the same ids for the same committed events.Relation to #4068
#4068 pins one live assistant text message id per assistant reply in
AguiStreamContext/TextBlockEventConverter; this PR applies the same one-id-per-turn rule to the SessionLog replay projection and does not touch those live-path files. The changes are complementary and can land independently: #4068 removes per-model-call ids from the live stream, and this PR removes them from replay. #4068 currently pins the outerAgentStartEvent.replyId; if it later switches toevent.getExecution().turnId(), live and replay will also share the exact id value, not only the rule.Tests
AguiSessionLogAttachTest— replay, cursor-ahead waiting, uncommitted boundaries, error frames, terminal status, run isolation, syntheticRUN_STARTED.AguiSessionPresentationTest— projection of text/reasoning/tool/interaction events, turn-scoped text and reasoning ids, reopen-without-duplicate-START, streamed/replayed id parity.AguiSessionCursorTest,AguiRequestProcessorSessionLogTest.agentscope-extensions-agui: 546 passing.agentscope-coreis unchanged.Known limitations
idis emitted on completed events (model/end, interactions) so a reconnect resumes at a message boundary; a follow-up will also cover tool results and run lifecycle frames.HarnessAgentwithSessionHistoryMode.EVENT_LOG.Merge order
feat/agui-live-handoff(verified withgit merge-base --is-ancestor).