(cwd: str | None, include_system_context: bool)
| 65 | |
| 66 | |
| 67 | async def _warm(cwd: str | None, include_system_context: bool) -> None: |
| 68 | # The whole body is guarded: in loop mode a failure outside the |
| 69 | # gather (e.g. the import) would otherwise surface as an unretrieved |
| 70 | # task exception — prefetching is advisory and must never propagate. |
| 71 | try: |
| 72 | from src.context_system.prompt_assembly import ( |
| 73 | get_system_context, |
| 74 | get_user_context, |
| 75 | ) |
| 76 | |
| 77 | coros = [get_user_context(cwd)] |
| 78 | if include_system_context: |
| 79 | coros.append(get_system_context(cwd)) |
| 80 | results = await asyncio.gather(*coros, return_exceptions=True) |
| 81 | for result in results: |
| 82 | if isinstance(result, Exception): |
| 83 | logger.debug("deferred prefetch lane failed: %r", result) |
| 84 | except Exception as exc: |
| 85 | logger.debug("deferred prefetch failed: %r", exc) |
| 86 | |
| 87 | |
| 88 | def start_deferred_prefetches( |
no test coverage detected