Resumable Workflow: answering a RequestInput in a looping graph hangs 15 s and fails with "Replay divergence detected" (since 6dbe5bb6d)
Maintainer antworten meist innerhalb von 3 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 15/100
Rechercherichtung
Start with the standalone repro in the issue and the commit 6dbe5bb6d ("coalesce node status checkpoints per scheduler tick"), then find where ReplaySequenceBarrier gets its list of sequence keys on resume. The barrier times out waiting for asker@1, which is listed after later loop iterations. Done means the script's turn 2 finishes in under a second with no divergence error, and the reporter's fuzzer case passes.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
🔴 Required Information
Describe the Bug:
Since 6dbe5bb6d ("coalesce node status checkpoints per scheduler tick"), a resumable Workflow that loops through a router, has a JoinNode, and has a node whose dynamic child asks for input can no longer be resumed a second time. The second answer waits for ReplaySequenceBarrier's 15 s timeout and then fails with:
WorkflowInvariantError: Replay divergence detected: Timed out waiting for sequence key 'asker@1' to be unblocked.
The first answer still works. On the parent of 6dbe5bb6d the same script answers three questions and finishes normally.
Steps to Reproduce:
- Check out main (4e3aff79a).
- Run the script below. It answers each
RequestInputwith{'ok': True}and prints one line per turn.
Expected Behavior (parent of 6dbe5bb6d, 7d2c7b75d):
turn 0: 0.0s interrupts=1 errors=[]
turn 1: 0.0s interrupts=1 errors=[]
turn 2: 0.0s interrupts=1 errors=[]
turn 3: 0.0s interrupts=0 errors=[]
Observed Behavior (6dbe5bb6d and current main):
turn 0: 0.0s interrupts=1 errors=[]
turn 1: 0.0s interrupts=1 errors=[]
turn 2: 15.0s interrupts=0 errors=["WorkflowInvariantError: Replay divergence detected: Timed out waiting for sequence key 'asker@1' to be unblocked.", ...]
Environment Details:
- ADK Library Version: main at 4e3aff79a (bisected to 6dbe5bb6d)
- Desktop OS: macOS
- Python Version: 3.12.13
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A (function nodes only)
🟡 Optional Information
Regression:
Yes. 7d2c7b75d (parent of 6dbe5bb6d) works; 6dbe5bb6d and later fail.
Minimal Reproduction Code:
"""Standalone repro: resumable workflow with a loop, a JoinNode and a dynamic
child that asks for input. After 6dbe5bb6d, answering the question raises
"Replay divergence detected" after a 15 s wait."""
import asyncio
import time
from google.adk.agents.context import Context
from google.adk.apps.app import App
from google.adk.apps.app import ResumabilityConfig
from google.adk.events._interrupts import extract_event_interrupt_ids
from google.adk.events.event import Event
from google.adk.events.request_input import RequestInput
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
from google.adk.workflow import JoinNode
from google.adk.workflow import node
from google.adk.workflow import START
from google.adk.workflow import Workflow
from google.adk.workflow.utils._workflow_hitl_utils import create_request_input_response
from google.genai import types
@node()
def first(node_input):
return 'first'
@node()
async def a(node_input):
for _ in range(3):
await asyncio.sleep(0)
return 'a'
@node()
async def b(node_input):
for _ in range(3):
await asyncio.sleep(0)
return 'b'
@node()
def c(node_input):
return 'c'
@node()
def loop(ctx: Context, node_input):
visits = (ctx.state.get('visits') or 0) + 1
ctx.state['visits'] = visits
yield Event(output=visits, route='back' if visits < 3 else 'done')
@node(rerun_on_resume=True)
def ask(ctx: Context, node_input):
if ctx.resume_inputs:
yield 'answered'
return
yield RequestInput(message='ok?')
@node(rerun_on_resume=True)
async def asker(ctx: Context, node_input):
answer = await ctx.run_node(ask, node_input=node_input)
yield f'asker:{answer}'
@node()
def end(node_input):
return 'end'
join = JoinNode(name='join')
wf = Workflow(
name='wf',
edges=[
(START, first),
(first, a),
(a, b),
(first, b),
(b, join),
(a, join),
(b, c),
(a, asker),
(c, loop),
(loop, {'back': first}),
(join, end),
(asker, end),
],
)
async def main():
ss = InMemorySessionService()
runner = Runner(
app=App(
name='app',
root_agent=wf,
resumability_config=ResumabilityConfig(is_resumable=True),
),
session_service=ss,
)
s = await ss.create_session(app_name='app', user_id='u')
msg = types.UserContent('go')
for turn in range(6):
ids, errors = [], []
t = time.monotonic()
try:
async for e in runner.run_async(
user_id='u', session_id=s.id, new_message=msg
):
ids += sorted(extract_event_interrupt_ids(e))
if e.error_code:
errors.append(f'{e.error_code}: {e.error_message}')
except Exception as ex:
errors.append(f'raised {type(ex).__name__}: {ex}')
print(f'turn {turn}: {time.monotonic() - t:.1f}s interrupts={len(ids)} errors={errors}')
if not ids:
break
msg = types.Content(
role='user',
parts=[create_request_input_response(ids[0], {'ok': True})],
)
asyncio.run(main())
Additional Context:
Found with a random-graph resume fuzzer and shrunk from there. Removing the join or the loop makes it pass, and so does stopping the loop after 2 visits instead of 3. The replay barrier on turn 2 lists asker@1 after the later loop iterations (..., loop@6, asker@1, asker@2, end@4) while the run is waiting on keys that come before it. I haven't tracked down which part of the checkpoint change causes that ordering; happy to dig further or test a fix.
How often has this issue occurred?:
- Always (100%)
- Vorherrschende Sprache
- Python
- Sterne
- 22.3k
- Forks
- 4.4k
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 6
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus google/adk-python
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
google/adk-python#8360 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
google/adk-python#8359 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Can pin to litellm version be changed?Evtl. vergeben @llalitkumarrr hat das vor 10 Tagen übernommen. Offenmodels
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
google/adk-python#8129 · 2 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
OpenAPI tools ignore operation- and path-level server overridesEvtl. vergeben @sanketpatil06 hat das vor 14 Tagen übernommen. Offentools
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
google/adk-python#8064 · 4 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Two docstrings in openapi_tool document parameters the signatures do not acceptEvtl. vergeben @surajksharma07 hat das vor 17 Tagen übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
google/adk-python#8024 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in google/adk-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
vllm-project/vllm#70030 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
TigreGotico/tugaphone#408 ·
Maintainer antworten meist innerhalb von 1 Tag
-
needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
gke-labs/kube-agents#7308 ·
Maintainer antworten meist innerhalb von 1 Tag
-
t: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 3 Tagen
-
chore
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
lugassawan/swe-workbench#841 ·