()
| 219 | } |
| 220 | |
| 221 | async def _iter() -> AsyncIterator[Any]: |
| 222 | # With no `serve` the session completes on its own (no tool |
| 223 | # calls) once the lease heartbeat has had a chance to land, and |
| 224 | # the run ends via the normal session-completion path; the |
| 225 | # heartbeat keeps the lease alive throughout and is stopped on the |
| 226 | # way out. |
| 227 | if serve is not None: |
| 228 | await serve() |
| 229 | else: |
| 230 | await asyncio.sleep(0.05) |
| 231 | record["send_retry_window"] = send_retry_window() if send_retry_window else None |
| 232 | return |
| 233 | yield # pragma: no cover (makes this an async generator function) |
| 234 | |
| 235 | yield _iter() |
| 236 |
no test coverage detected