Skip to content
Agent Field Notes
Practice topicsFilter practice questions by topic.All practice →
knowledge unit 33AdvancedConceptsAbout 18 minutes

Understand → Implement → Debug → Design

Versioned transport recovery and business reconciliation

Compare legacy sessions/replay with modern stateless requests, cancellation, MRTR and optional Tasks without duplicating a committed write.

MCPStreamable HTTPDisconnection recovery

Knowledge content check2026-10-30 · Check the source of the original question2026-10-30

Which step do you want to learn from this knowledge point?

Select the starting point based on the current basis, or you can go deeper one by one. When you encounter an unfamiliar concept, go back to the core principles first; use the knowledge exercises to check your understanding when you are finished.

Understand first

New to this knowledge point

Complete the prerequisite concepts, read the principles and counterexamples, and then explain why in your own words.

Start with core principles →

Implement next

Prepare to write the principles into code

Understand implementation steps and boundaries, complete small tasks, and check results against acceptance requirements.

Reading implementation and trade-offs →

Debug failures

Need to handle failures and changes in conditions

Follow the continuous questioning to locate the failure premise, and then compare the migration cases to explain how the plan should be adjusted.

Continue to delve deeper into the problem →

Compare designs

Need to design or review plans

Combine engineering deductions and senior self-evaluation standards to explain the applicable conditions, costs and alternatives of the plan.

Analyze engineering scenarios →
Knowledge unit directory

LEARN · PRACTICE · REFLECT

Knowledge learning and personal records

My notes and review ↗

First read along the principles, Q&A and migration cases. When you need to check your understanding, switch to reinforcement exercises or start personal recording.

Answers and personal notes

Each modified commit will be kept as an independent history. Your level of mastery is up to you to evaluate yourself against the standards.

Core concept · Versioned transport recovery and business reconciliation

Understand the core principles first

Preparatory concepts:Version-pinned JSON-RPC and transport semantics, Trusted operation ledger and downstream idempotency, HTTP authorization and asynchronous task handles

Pin the revision first. MCP 2025-11-25 may recover an originating SSE stream by Last-Event-ID and reinitialize an expired session. MCP 2026-07-28 has no core initialize/session or event replay: attach per-request _meta, discover/validate capabilities, and use an opted-in Tasks handle when available. Closing modern HTTP SSE signals cancellation, not rollback. A lost write still needs its original business operation key and verified receipt; a new RPC id is only correlation.

Visual guide · Three identities solve three different problems

Three identities solve three different problems

Reconnect or replay messages before reconciling business state. A new protocol request ID cannot deduplicate an external effect. Select the figure to open it at full size.

Infer only what the evidence supports

A successful discovery probe establishes protocol compatibility, not business success. Legacy event replay restores deliveries; modern requests carry their capabilities every time. Neither guarantees that a new write is harmless.

Retain outcome independently

Persist sent/unknown/confirmed business state separately from cancellation_requested and protocol era. A task handle points at work, while the business key and executor ledger prevent repeated creation.

Respect the boundary

A safe client retries supported protocol errors only after correcting them, routes legacy traffic through its pinned adapter, and queries receipts for ambiguous writes. Core statelessness does not remove an adopted extension's own lifecycle or handshake requirements.

Check understanding with a question

MCP disconnected: which protocol revision and business facts govern recovery?

Compare with the reference answer

Pin the revision first. MCP 2025-11-25 may recover an originating SSE stream by Last-Event-ID and reinitialize an expired session. MCP 2026-07-28 has no core initialize/session or event replay: attach per-request _meta, discover/validate capabilities, and use an opted-in Tasks handle when available. Closing modern HTTP SSE signals cancellation, not rollback. A lost write still needs its original business operation key and verified receipt; a new RPC id is only correlation.

Implementation and trade-offs

One refund, two independent state machines

Suppose refund-7 committed remotely and its response never reached the client. A working connection answers “can messages travel now?”; an operation receipt answers “did this refund commit?” Neither a new socket nor a new JSON-RPC id answers the second question. Persist the tenant, operation_id, argument digest and outcome independently of the protocol adapter.

Name the protocol revision before reasoning

For this lesson, legacy means 2025-11-25, and modern means 2026-07-28. Legacy initialization can establish an HTTP session; optional event replay uses the originating stream's Last-Event-ID. Modern core removes initialize/initialized, protocol session IDs and Last-Event-ID replay. Each request declares its version and client capabilities in params._meta. server/discover is required on modern servers and optional for modern clients; a dual-era stdio client should probe before any ambiguous business call.

Stateless protocol does not mean stateless business. A task handle, protected requestState or operation ledger can outlive a connection. Tool lists may depend on the authorization supplied on each request, but must not vary because a socket previously called another method. Cache authorization-sensitive discovery separately by principal and scope.

Cancellation is version-specific

Legacy disconnection does not itself cancel a request. In modern Streamable HTTP, closing that request's SSE response stream is its cancellation signal; the server must treat it as cancelled and should stop practical remaining work. Cancellation is not rollback: a refund already committed remains a business fact. Do not generalize “disconnect never cancels” across revisions, or “cancelled means no effect” across business tools.

Four identities with different jobs

JSON-RPC id correlates a request and response. A legacy session ID identifies legacy protocol state. An event cursor locates optional legacy delivery history. An application operation_id identifies one logical refund and requires downstream enforcement to prevent duplicates. Modern Tasks adds a fifth identity, taskId, which locates asynchronous work; it does not deduplicate creating that work.

The existing Python exercise deliberately retains the legacy teaching contract. It models a decision from trusted facts, not either revision's transport implementation. The next layer gives its exact reproduction entry; the later layers analyze failures and migration.

Recovery procedure

Persist the original operation before send. Probe era with a safe discovery request, never a write. In modern HTTP distinguish UnsupportedProtocolVersionError, missing capability and HeaderMismatch from legacy detection; 401/403 or a network timeout are not permission to downgrade. Parse resultType before accepting completion. MRTR input_required retries the same method with matched inputResponses and exact opaque requestState under a new JSON-RPC id; enforce bounded rounds and trusted user-input policy. A task result requires mutual Tasks support and polling the authorized taskId, not reissuing task creation.

Evidence and scope

If the write may have reached execution, query its authorized business receipt. Retry only with proven non-execution or actual downstream idempotency support under the same key and parameter digest; otherwise leave unknown and escalate for reconciliation. The linked stdlib fixture retains 13 legacy-style decisions and does not run a modern server. Wire examples and proposed fault tests in the migration article are unexecuted protocol illustrations.

Engineering deduction

scene
Hypothetical refund-7 commits just before modern HTTP SSE is closed.
design decisions
Record protocol cancellation separately, preserve operation_id and query the receipt.
Verify target
Expected design outcome: no second refund; unresolved evidence remains unknown.
applicable boundary
This is an interview scenario, not a measured remote integration; cancellation cannot guarantee rollback.

Continuous questions and answers

Continue reading along with the premises and constraints of the problem. Understand the reference answers first, then try to put away the answers and explain the cause and effect and trade-offs in your own words.

Draw inferences from one example: If the conditions change, how to deduce it?

First find out the conditions for change, and then determine which premises in the original plan still hold true. The following cases are teaching deductions to facilitate the transfer of principles to new problems.

Legacy session expires

Changing conditions:2025-11-25 session returns 404

Extended question:Can the earlier refund be discarded?

Derivation and reference solutions

No. Reinitialize the legacy protocol adapter if needed, but keep the operation ledger and authorized receipt query. A session lifetime is shorter than external business history. Do not use this rule to add sessions to the modern adapter.

The principles that remain unchanged:Replacing a protocol context cannot erase business effects.

Modern asynchronous work

Changing conditions:A modern server and client both opt into Tasks

Extended question:How does recovery differ from event replay?

Derivation and reference solutions

Poll the same taskId through tasks/get and fulfill input_required via tasks/update when authorized. Follow the extension's TTL and cancellation semantics. Tasks cancellation is cooperative; a request-stream close must not be confused with cancelling the separate durable task.

The principles that remain unchanged:A durable work handle changes recovery mechanics, not business authorization or deduplication.

Easy to make mistakes

  • Applying Last-Event-ID and initialize to 2026-07-28 core
  • Treating cancellation as rollback or RPC id as business deduplication
  • Falling back on every HTTP 400, authentication failure or network timeout

References

Original engineering interview design based on version-pinned public specifications reviewed 2026-10-30. Scenarios, scoring and proposed experiments are authored teaching material; no modern MCP interoperability or live business effects were measured. New Q&A and migration cases are added for principle explanation, and source verification and case operation verification are recorded separately.

Check how far you understand

After reading, you can explain the principles, boundaries, and trade-offs against these standards. It is up to you to evaluate your mastery; if further verification is needed, complete the small tasks below.

Basic standards met
Does not blindly repeat a potentially committed write.
Intermediate and advanced signals
Correctly separates 2025-11-25 session/replay from 2026-07-28 metadata/cancellation/Tasks.
Senior criteria
Designs dual-era probes, authorization-preserving rollback and fault evidence for lost task creation.

Hands-on verificationComplete on demand · Suggestions25 minutes

Draw both-era recovery for a committed refund with lost response. Annotate a modern discovery request, an input_required retry and a lost task creation response; list fault tests without presenting proposed results as measured.

Expand acceptance requirements and checkpoints
  • Version-specific cancellation and replay behavior is correct
  • MRTR uses a fresh RPC id with the same business identity and opaque state
  • Unknown outcome and authorized receipt lookup survive reconnect and rollback

Key inspections

  • Names the pinned legacy and modern revision and their different cancellation/replay rules
  • Separates request id, task handle and enforced business operation key
  • Inspects modern errors and resultType without unsafe fallback