Skip to content

Commit e94d3aa

Browse files
Merge current v1 tracing and CI fixes
2 parents eff6e53 + cbde5dd commit e94d3aa

1 file changed

Lines changed: 34 additions & 31 deletions

File tree

‎tests/test_tracing_native.py‎

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,46 +1242,49 @@ def response(original=original, fresh=fresh, steer=steer):
12421242
[first] = await handles(session, 1)
12431243
initial_wait = asyncio.create_task(first.get_result())
12441244
entered_wait = asyncio.create_task(model.entered["alpha"].wait())
1245-
ready, _ = await asyncio.wait(
1246-
(initial_wait, entered_wait), return_when=asyncio.FIRST_COMPLETED
1247-
)
1248-
if initial_wait in ready:
1249-
entered_wait.cancel()
1250-
await asyncio.gather(entered_wait, return_exceptions=True)
1251-
try:
1252-
await initial_wait
1253-
except Exception as error:
1245+
try:
1246+
ready, _ = await asyncio.wait(
1247+
(initial_wait, entered_wait), return_when=asyncio.FIRST_COMPLETED
1248+
)
1249+
if initial_wait in ready:
1250+
try:
1251+
await initial_wait
1252+
except Exception as error:
1253+
raise AssertionError(
1254+
(
1255+
mode,
1256+
len(model.requests),
1257+
seen,
1258+
"child failed before its response hold",
1259+
)
1260+
) from error
12541261
raise AssertionError(
12551262
(
12561263
mode,
12571264
len(model.requests),
12581265
seen,
1259-
"child failed before its response hold",
1266+
"child completed before its response hold",
12601267
)
1261-
) from error
1262-
raise AssertionError(
1263-
(
1264-
mode,
1265-
len(model.requests),
1266-
seen,
1267-
"child completed before its response hold",
12681268
)
1269-
)
1270-
with telemetry.trace(
1271-
"unrelated child caller",
1272-
options=telemetry.TraceOptions(
1273-
trace_id="f" * 32, include_sensitive_data=True
1274-
),
1275-
):
1276-
try:
1269+
with telemetry.trace(
1270+
"unrelated child caller",
1271+
options=telemetry.TraceOptions(
1272+
trace_id="f" * 32, include_sensitive_data=True
1273+
),
1274+
):
12771275
await first.steer(steer)
1278-
finally:
12791276
model.release["alpha"].set()
1280-
assert (await initial_wait).final_output == "alpha complete"
1281-
[child] = [child async for child in session.subagents()]
1282-
later = await child.start(fresh)
1283-
assert later.turn_id != first.turn_id
1284-
assert (await later.get_result()).final_output == "alpha complete"
1277+
assert (await initial_wait).final_output == "alpha complete"
1278+
[child] = [child async for child in session.subagents()]
1279+
later = await child.start(fresh)
1280+
assert later.turn_id != first.turn_id
1281+
assert (await later.get_result()).final_output == "alpha complete"
1282+
finally:
1283+
model.release["alpha"].set()
1284+
for waiter in (initial_wait, entered_wait):
1285+
if not waiter.done():
1286+
waiter.cancel()
1287+
await asyncio.gather(initial_wait, entered_wait, return_exceptions=True)
12851288
assert {row[0] for row in seen} == {"initial", "steer", "fresh"}, seen
12861289
assert all(
12871290
row[1:] == (origin_id, disabled, mode != "metadata") for row in seen

0 commit comments

Comments
 (0)