fix(relay): keep orphan drain bounded by the scope-op timeout

The salvaged _close_scope_handle replaced direct scope.pop calls that
were bounded by _SCOPE_OP_TIMEOUT with an unbounded run_in_session
callback, regressing the bounded-finalization contract (CI:
tests/agent/test_relay_runtime_bounded_scope_ops.py — end_turn /
close_session / finish_logical_calls hung when the native pop wedged).
Pass timeout=_SCOPE_OP_TIMEOUT so the whole drain+close costs at most
one span and never blocks turn or session completion.
This commit is contained in:
Teknium
2026-08-14 21:39:30 -07:00
parent 3537ef9d01
commit 0b988b0118
+5
View File
@@ -669,6 +669,11 @@ class RelayRuntime:
session,
close_with_drain,
allow_closing=allow_closing,
# Bound the whole drain+close like the direct pops it
# replaced: a wedged native pipeline must cost at most one
# span, never block turn/session completion (see
# tests/agent/test_relay_runtime_bounded_scope_ops.py).
timeout=_SCOPE_OP_TIMEOUT,
)
except Exception as exc:
return f"{failure_label}: {exc}"