Practical technical guides / Recent development: google/adk-python issue 7971 and commit f4fa73e (2026-11-04)

ADK Python Sessions Paused on 2.10 Could Not Resume After Fenced JSON: One Parser for Live and Replay

ADK Python issue 7971: sessions stored by 2.10 failed to resume after a fenced JSON reply. Measured before and after commit f4fa73e, and the upgrade-resume test to add.

By Sandeep Belgavi · Published 2026-11-04

ADK Python issue 7971: sessions stored by 2.10 failed to resume after a fenced JSON reply. Measured before and after commit f4fa73e, and the upgrade-resume test to add.

What happened

On 3 November 2026 an issue was filed against ADK Python, google/adk-python 7971, with a precise title: a workflow paused on ADK 2.10 or earlier fails to resume when an output_schema agent's stored reply is fenced JSON. The fix, "strip the JSON code fence when replaying schema output on resume", landed on main as commit f4fa73e at 00:12 UTC on 4 November, and the issue was closed. As of 4 November the latest tagged release was 2.13.0, published on 23 October, so the fix was on main and not in a release.

This guide explains the mechanism, which sessions are affected, what was measured locally, and the test every durable agent workflow should have, whatever framework it uses: pause on the old version, upgrade, resume.

The two paths that parse one reply

An LlmAgent node with an output_schema asks the model for JSON matching a schema. Models sometimes wrap that JSON in a Markdown code fence, three backticks and a json tag, especially when tools are configured alongside the schema. ADK's live path handles this. According to the issue, process_llm_agent_output parses the reply with validate_schema, which calls a helper, _strip_json_code_fence, before validating. The live run therefore accepts a fenced reply.

A workflow that pauses, for example on a RequestInput waiting for a person to approve, stores its events in a session service. On resume, ADK does not call the model again. It rehydrates each completed node's output from the stored events and replays it. The issue traces that path: the replay interceptor passes the stored message to _process_rehydrated_output, which validated the text with Pydantic's TypeAdapter(...).validate_json without stripping the fence, and its plain json.loads fallback failed too. The resumed run raised WorkflowDataError with "Invalid JSON: expected value at line 1 column 1".

So one reply was parsed by two code paths with different rules. The live path was lenient. The replay path was strict.

Which sessions are affected

The issue is careful about scope. Since 2.11.0, change 6b96ba1, a schema node no longer sets message_as_output, so new sessions store the parsed output and resume without parsing the text again. Sessions stored by 2.10 and earlier kept only the raw, fenced text with output=None, and those go through the replay parser. The issue also says this is not a regression: with 2.9.2 and 2.10.0, a resume after a fenced schema reply failed even when the pause and the resume ran on the same version. What 2.11 changed was that new sessions avoid the path.

The practical effect, in the issue's words: an app with a persistent session store that upgraded from 2.10 or earlier "cannot resume the sessions that were paused after such a reply".

The fix

The change is two lines in _process_rehydrated_output:

# The live path strips the fence in validate_schema; replay must match.
text = _strip_json_code_fence(text)

The pull request that proposed it, 7972, describes the result as the live path and the replay path sharing one fence helper. Only the schema branch changes; unfenced text comes back from the helper unchanged, and nodes with no schema, or with output_schema=str, still receive raw text. The author reports that three of nine new test cases failed on main before the change and all nine passed after.

The helper itself is worth reading for a second reason. Its comment warns against the obvious one-line regular expression for removing a fence, because overlapping whitespace quantifiers make it backtrack in cubic time on an unclosed fence, which is reachable from model output. It uses string operations instead.

Measured locally

The issue includes a reproduction that needs no API key: a scripted model that replies with fenced JSON, a schema agent, a pause for input, and a SQLite session store. Running it with uv on CPython 3.13.5 on Windows 11, one session was paused on 2.10.0 and each resume used a fresh copy of the session database:

Paused onResumed onResult
2.10.02.13.0 from PyPIWorkflowDataError, invalid JSON
2.10.0main at d5ecb99, the parent of the fixWorkflowDataError, invalid JSON
2.10.0main at f4fa73e, the fixresumed; the approve node received the parsed dict

The package built from f4fa73e still reports version 2.13.0, which is consistent with a fix on main before any release.

What to do if you run ADK Python

  1. Find out whether your session store holds sessions written by 2.10 or earlier that are paused after a schema node. If none exist, new sessions on 2.11 and later do not take this path.
  2. If they do, resuming them on 2.11 through 2.13.0 fails when the stored reply was fenced. Until a release contains the fix, options are to pin a build that includes f4fa73e, to finish or cancel those sessions on the old version before upgrading, or to rewrite the stored events offline to the parsed shape after testing on a copy.
  3. Keep a copy of the session database before any of these. A failed resume should not be the first test.

The general lesson: one parser per contract

The bug is a specific case of a pattern that appears in every durable agent system. A reply is accepted by the live path, stored, and later interpreted again by a different path: replay, a migration, an audit export, a second service. If the two paths parse with different rules, data that was valid when written becomes invalid when read.

The companion example builds a tiny stand-in for a workflow engine, not ADK code, with the same two storage shapes. It runs every combination of three replies, two shapes and two replay parsers:

ReplyStored asReplay parserResult
fenced, with json tagraw messagewithout fence handlingresume fails
fenced, without tagraw messagewithout fence handlingresume fails
anyparsed outputeithersame as live
anyraw messagethe shared parsersame as live

Only the old storage shape combined with the old parser fails, which is exactly the population the issue describes. The fix in the example is the same as in ADK: both paths call one function, parse_schema_reply, and the replay path is never allowed its own copy of the rules.

The test every durable workflow needs

Add an upgrade-resume test to the release checklist of any agent workflow that persists sessions:

  • run the workflow on the currently deployed version until it pauses, with a scripted model whose replies include the awkward shapes seen in production, fenced JSON among them;
  • copy the session store;
  • install the candidate version and resume from the copy;
  • assert that the next node receives exactly what it received live, and that the model was not called again.

A test like this would have caught the gap at 2.11.0, when new sessions changed shape and old ones did not. It costs one scripted model and a temporary database, because, as the issue's reproduction shows, no provider call is needed.

What remains uncertain

Neither the issue nor the pull request says how many deployments were affected. The issue's environment was macOS with Python 3.11; the local run above used Windows with Python 3.13.5 and reproduced the same result. Other replay paths, such as base64 bytes in rehydrated outputs, have had their own recent fixes, so treat this as one instance of a class rather than the last one.

Primary references and authorship

Sources dated on or before 4 November 2026. Original explanation and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/live_replay_one_parser. Views are my own and do not represent any employer, past or present.