Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1293,14 +1293,17 @@ async def test_execute_code_tool_clears_output_after_rejection(
max_output_file_bytes=3,
)
config = execute_code._build_run_config()
output_root = Path(cast(Any, execute_code._registry)._get_or_create_entry(config).output_dir.name)
registry = cast(Any, execute_code._registry)
output_root = Path(registry._get_or_create_entry(config).output_dir.name)

try:
contents = await execute_code.invoke(arguments={"code": "create-memory-output"})

_assert_bounded_output_error(contents, "per-file output limit")
remaining_outputs = await asyncio.to_thread(lambda: list(output_root.iterdir()))
assert remaining_outputs == []
# Rejection retires the entry and removes its directory on the single cleanup worker.
# Wait behind that cleanup before checking the directory, which may already be gone.
await asyncio.wrap_future(registry._cleanup_executor.submit(lambda: None))
assert not await asyncio.to_thread(output_root.exists)
finally:
_close_execute_code_registry(execute_code)

Expand Down
Loading