Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- Reconnecting clients and durable task state
- The connection carries progress notifications, and task status is persisted by the backend. Reconnection only restores the observation position. Repeated submission, cancellation and business completion require independent and clear semantics.
How does the mechanism work?
Step-by-step explanation
- What should I do if the last completed event is lost?
After separating the task from the stream, handle lost terminal-state notifications.
- How to deal with the backlog logs of slow clients?
Progress persistence also requires resource and retention boundaries.
- Should closing the page automatically cancel it?
A user's connection status does not automatically express an intent to cancel the business operation.
Design · Explain the trade-offs
Design integration and release boundaries
Objectives of this level: Define event retention and business-run recovery separately.
Visual guide · Advance only through continuity
A display cursor resumes observation, not business execution. Bind tenant and trace; a gap must not be hidden by jumping to the largest sequence. Select the figure to open it at full size.
Design snapshot-plus-events recovery
An application event service needs stable task-scoped event IDs, authorization on each subscription, retention bounds and a snapshot fallback when a cursor expires. Commit the durable progress/event intent together where possible, then deliver at least once; the UI must tolerate replay. A transport cursor is still not a write deduplication key.
Keep unfinished suffix events after a gap, or reread them from an authoritative log. Store a client checkpoint only after applying the same contiguous prefix. Concurrent tabs need a defined local persistence policy; an event from a different run must not overwrite a current run just because its sequence number is larger.
Trace task lifetime separately from HTTP/SSE connection lifetime. Distinguish disconnect, explicit cancellation request, accepted cancellation and already committed effects. Test cursor expiry, revocation between reconnects, duplicate done and process recovery with a missing presentation event. The current pure function assembles provided chunks; it does not implement an event server, queue, outbox or a browser reconnect test.
Continue the same implementation
Use the complete function contract and reproduction commands in the implementation layer. Public cases remain in cases/agent-streaming-resume.json inside the existing extended-agent-practice-v1.zip. These are local fixtures, not remote-model or production-load measurements.
code example
Design integration and release boundaries
Design snapshot-plus-events recovery
An application event service needs stable task-scoped event IDs, authorization on each subscription, retention bounds and a snapshot fallback when a cursor expires. Commit the durable progress/event intent together where possible, then deliver at least once; the UI must tolerate replay. A transport cursor is still not a write deduplication key.
Keep unfinished suffix events after a gap, or reread them from an authoritative log. Store a client checkpoint only after applying the same contiguous prefix. Concurrent tabs need a defined local persistence policy; an event from a different run must not overwrite a current run just because its sequence number is larger.
Trace task lifetime separately from HTTP/SSE connection lifetime. Distinguish disconnect, explicit cancellation request, accepted cancellation and already committed effects. Test cursor expiry, revocation between reconnects, duplicate done and process recovery with a missing presentation event. The current pure function assembles provided chunks; it does not implement an event server, queue, outbox or a browser reconnect test.
Acceptance task for this level
Change the stated condition, predict the branch before running, and write a300-word ADR distinguishing implemented local behavior, missing integration proof and the owner of each production invariant.
Reading this browser’s record…
Hide the answer and check your understanding
Does discarding old seq validate its historical content?
Expand reference derivation
No. This checkpoint retains no event hash. Historical content integrity needs an additional persisted contract.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.