The backend was logging every request (the chatty frontend polling of
/settings, /tools, /knowledge/list, /settings/llm-options, ...) as
`::1:0 - "GET ... 200 OK"`. uvicorn's per-request access log was only disabled
in run_server.py (access_log=False); the `deeptutor start` launcher and the
Docker entrypoints invoked uvicorn directly with it still on, so the 200s
leaked.
- launcher.py + Dockerfile (production start-backend.sh and the dev supervisord
program): add `--no-access-log` so all launch paths match run_server.py.
- Funnel access logging through the existing selective_access_log middleware
(non-200 only), but log via a `deeptutor.access` logger with its own INFO
stdout handler (propagate=False). Previously it used `uvicorn.access`, which
has no handler once uvicorn's access log is off, and the root console handler
runs at WARNING — so non-200s were being silently dropped. Now 200s are quiet
and 4xx/5xx still surface.
- Rewrite the middleware test to capture on the deeptutor.access logger directly
(it no longer propagates to root).
Verified: live server with --no-access-log logs nothing for 200s and prints
`127.0.0.1 - "GET /api/v1/... HTTP/1.1" 404` for a 404. ruff + pytest (2447) green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The selective_access_log middleware uses logging.getLogger('uvicorn.access'),
which inherits uvicorn's AccessFormatter. That formatter unpacks record.args
into five values (client_addr, method, full_path, http_version, status_code),
but the middleware only passed four — omitting http_version — causing a
ValueError ('not enough values to unpack') on every non-200 response.
Add the missing http_version argument from the ASGI scope, defaulting to
'1.1' when absent.
Fixes#334
Signed-off-by: kagura-agent <kagura.chen28@gmail.com>