Problem
cli.py has three nearly-identical async startup functions (_run_dev_servers, _run_ui_servers, _run_headless_servers) that differ only in which servers they start. Any bug fix must be applied in three places.
Fix
Replace with one parameterized function:
async def _run_servers(*, api=True, otlp=False, ui=False) -> None:
tasks = []
if api: tasks.append(_start_uvicorn(api_app, host, api_port))
if otlp: tasks.append(_start_uvicorn(otlp_app, host, otlp_port))
if ui: tasks.append(_start_ui_dev_server(host, ui_port))
await asyncio.gather(*tasks)
Problem
cli.pyhas three nearly-identical async startup functions (_run_dev_servers,_run_ui_servers,_run_headless_servers) that differ only in which servers they start. Any bug fix must be applied in three places.Fix
Replace with one parameterized function: