Give a rate-limit flush its own run, linked to the run that held the value

A flush ran its cascade under no id, so its executions and failures belonged
to no run. It now records a run with source "flush", and the holding run's id
travels on the queue item into a new `flow_run.parent` column, also on the
`/observability/runs` rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
2026-10-15 09:37:30 +02:00
co-authored by Claude Opus 5.5
parent c7e38a8a44
commit 13567f8990
10 changed files with 157 additions and 26 deletions
+7 -8
View File
@@ -440,13 +440,6 @@ class ExecutionService:
self.queue.park(node.flow, item)
return True
if item.kind == "flush":
# A rate-limit window ended; nothing to replay, only to let out.
# ponytail: no run record for a flush — it is the tail of the run
# that scheduled it, not a run of its own.
pipeline.flush(node)
return True
if item.guard_key and str(node.recall(item.guard_key, "")) != item.guard_value:
# The node moved on while this waited — a restarted timer, say.
logger.debug("Guard no longer holds for '%s', dropped", item.node)
@@ -461,6 +454,7 @@ class ExecutionService:
"flow": item.flow,
"node": item.node,
"cause": item.cause,
"parent": item.parent,
"deliveries": item.deliveries,
"ts": now,
}
@@ -483,6 +477,11 @@ class ExecutionService:
replay = item.deliveries > 1
emission = item.kind == "emission"
try:
if item.kind == "flush":
# A rate-limit window ended; nothing to replay, only to let out.
# A run of its own, so what it sets off is recorded somewhere.
pipeline.flush(node, item.entry_id)
return True
# An emission's values went into state when the node produced them;
# this item carries them so its readers get the chunk that caused
# the wave rather than whichever is newest by the time they run.
@@ -491,7 +490,7 @@ class ExecutionService:
published = (
set(item.outputs)
if emission
else pipeline.apply_outputs(node, item.outputs or None)
else pipeline.apply_outputs(node, item.outputs or None, item.entry_id)
)
pipeline.run_downstream(
node,