Skip to content

Commit 4816a1a

Browse files
Keep detached dispatch synthesis top-level
From CoPilot review of #193: the prefix-general change over-generalized the detached subgraph / fan-out synthesis arms to any depth, but _trace_id_for still routes detached events by namespace[:1]. A nested detached fan-out would partially detach -- its dispatch in the new Trace but inner nodes in the main one. Re-gate both detached arms to depth == 1; only the non-detached fan-out arm and the dedup need to be prefix-general (what case 3 exercises). A nested detached fan-out now gets no synthesis, consistent with the prior behavior, until the deferred nested-dispatch-keying fix generalizes _trace_id_for too.
1 parent 6c2cf60 commit 4816a1a

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/openarmature/observability/langfuse/observer.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,16 +1023,19 @@ def _sync_subgraph_observations(
10231023
and (prefix + (str(event.fan_out_index),)) in inv_state.fan_out_instance_observations
10241024
):
10251025
continue
1026-
# Detached subgraph: detached_subgraphs holds bare node names, so
1027-
# match on prefix[-1] (the node-name segment) at any depth (at depth 1
1028-
# this coincides with prefix[0], so the depth-1 behavior is unchanged).
1029-
if prefix[-1] in self.detached_subgraphs:
1026+
# Detached subgraph: kept top-level (depth == 1). _trace_id_for routes
1027+
# detached events by namespace[:1], so a nested detached unit would
1028+
# partially detach (its dispatch in the new Trace, inner nodes in the
1029+
# main one). Nested-detached support rides with the deferred
1030+
# nested-dispatch-keying fix that generalizes _trace_id_for too.
1031+
if depth == 1 and prefix[0] in self.detached_subgraphs:
10301032
self._open_detached_subgraph_trace(inv_state, correlation_id, prefix, event)
10311033
continue
10321034
# Detached fan-out: the fan-out instance gets its own Trace per spec
10331035
# §8.5. The fan-out node's Span observation in the parent Trace
1034-
# already exists; the detached dispatch goes into the new Trace.
1035-
if event.fan_out_index is not None and prefix[-1] in self.detached_fan_outs:
1036+
# already exists; the detached dispatch goes into the new Trace. Kept
1037+
# top-level for the same reason as detached subgraphs above.
1038+
if depth == 1 and event.fan_out_index is not None and prefix[0] in self.detached_fan_outs:
10361039
self._open_detached_fan_out_instance_trace(inv_state, correlation_id, prefix, event)
10371040
continue
10381041
# Non-detached fan-out: synthesize the per-instance dispatch

0 commit comments

Comments
 (0)