Skip to content
Agent Field Notes
Course contentsExpand a topic to choose a lesson.

SYSTEMATIC LEARNING / FOUR-LEVEL COURSE

MCP reconnection across protocol versions and business outcomes

Compare MCP 2025-11-25 and 2026-07-28; preserve the legacy fixture while designing stateless requests, task handles and safe write reconciliation.

Learning objectives: Choose recovery from a pinned protocol version and trusted send/outcome evidence. Keep cancellation, request correlation and delivery separate from durable business idempotency.

Content checked: 2026-10-30 · Each level has independent explanations, tasks and inspections

Choose a starting point based on your familiarity with this topic. Current level: Debugging · Diagnose failures. After completing the task, continue to the next level. Reading and self-checks alone do not establish mastery.

On this level

Review the prerequisites

Suitable for: Backend developers learning Agent applications.

Protocol era
Legacy initialization/session semantics and modern per-request semantics are separate adapters.
Unknown outcome
A sent write lacks a verified final business result; cancellation or reconnection alone cannot resolve it.
Task handle
An opted-in Tasks extension identifier locates asynchronous work; creation still needs business deduplication.

How does the mechanism work?

Step-by-step explanation
  1. Select the era before recovering

    2025-11-25 can use initialized sessions and optional replay; 2026-07-28 uses per-request metadata and has no Last-Event-ID replay.

  2. Cancellation cannot undo commit

    Modern HTTP SSE close cancels the request, but an already committed action still needs receipt reconciliation.

  3. Extensions have their own contracts

    Tasks is opt-in; core stateless capability declarations do not erase extension lifecycle requirements.

Debugging · Diagnose failures

Diagnose lost responses and ambiguous effects

Objectives of this level: Use counterexamples to reject unsafe write retries and cancellation assumptions.

Visual guide · Three identities, three jobs

Three identities, three jobs

Optional transport resumption restores messages only. An unknown sent write still needs same-operation reconciliation; a new session cannot prove noncommit. Select the figure to open it at full size.

Diagnose an ambiguous outcome before choosing a retry

Timeline A: the server checks refund-7, commits the refund and then loses the response. Timeline B: the request never reaches the server. Both can produce “connection reset” in the client log. Only trusted send-state evidence distinguishes before_send; lack of an application response is not that evidence. Record unknown, preserve the same operation_id and argument digest, and query the authorized receipt endpoint.

Fix three tempting but incorrect repairs

  1. Changing JSON-RPC id from write-1 to write-2 is correct request correlation for a new request, but does not deduplicate the refund. Reusing the business key works only when the executor binds that key to principal, parameters and a durable result.
  2. Modern SSE close is cancellation; it still cannot remove a refund committed before the close. Keep cancellation_requested and business_outcome as separate fields. For legacy streams, the disconnect is not itself cancellation.
  3. A lost Tasks creation response may hide a taskId even though work exists. Poll a known taskId after reconnect; if it was never received, reconcile through the business operation key instead of creating a second task blindly. TTL expiry or task lookup failure is not proof of no business effect.

A counterexample that the legacy grader can detect

A faulty implementation returning retry/not_sent for every after_send input fails session-replaced-write-reconcile. The correct fixed output preserves refund-1 and returns reconcile/write_result_unknown. Also test no-replay-write-reconcile and null-session-no-resume: the absence of replay eligibility must not create a new operation. These are fixture expectations, not measured network traces.

Separate protocol rejection from execution ambiguity

A conforming modern server rejects a malformed header/body pair before running the tool. That is different from a gateway disconnect after forwarding a valid request. Capture which component rejected or accepted it and when; a bare 400 or 502 without trustworthy provenance cannot justify resubmitting a high-impact write. For auth failure, repair authorization rather than silently downgrading protocol.

Failure experiment to perform on an actual integration

Inject loss after durable commit but before response, restart the client, then compare the original receipt and effect count. Repeat with a duplicate business key plus changed parameters (must conflict), wrong tenant (must deny), and no receipt service (must remain unknown). Record server build, protocol revision, request IDs, operation key digest and redacted events. This lesson supplies the test design only; no live MCP or remote business service was exercised here.

code example

Faulty blanket retry and its counterexample

A blanket retry/not_sent result is wrong for the following fixed case. Preserve the business key even when legacy replay cannot continue.

{
  "input": {
    "transport": "streamable_http",
    "phase": "after_send",
    "operation": "write",
    "session_id": "session-1",
    "new_session_id": "session-2",
    "resume_supported": true,
    "last_event_id": "stream1-event9",
    "operation_key": "refund-1"
  },
  "expected": {
    "action": "reconcile",
    "reason": "write_result_unknown",
    "operation_key": "refund-1",
    "last_event_id": null
  },
  "error": null
}

Acceptance task for this level

Trace the same lost write through legacy replay, modern SSE cancellation and a missing Tasks creation response; state what evidence resolves each unknown result.

Acceptance self-checks

Reading this browser’s record…

Hide the answer and check your understanding

Modern HTTP close cancelled the request. Is refund count zero?

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.