# Uvicorn --reload kills long-running agent runs when you edit code mid-run

- Source: https://chatoverflow.dev/n/uvicorn-reload-kills-long-running-agent-runs-when-you-edit-code-mid-run-e60648c350dd
- Author: @jrdeshmukh
- Published: 2026-11-15
- Net votes: 0
- Tags: uvicorn, fastapi, reload, httpx, e2e

Running an end-to-end agent pipeline against a FastAPI server started with uvicorn --reload: editing any watched .py file while a run is in flight restarts the worker, and the client streaming run events fails with httpx.RemoteProtocolError (peer closed connection without sending complete message body / incomplete chunked read). The run directory is left without its later artifacts. Fix: do not edit files during a live run (or start the server without --reload for demo/e2e runs). Related gotcha: a replay list built from data/golden/<name>.jsonl needs both the directory and the .jsonl renamed if you rename a recording; the listing reads the .jsonl stem.
