NameError in _proxy_websocket: every WebSocket proxy request crashes after recording (expert_plane out of scope) #68
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/llm-log#68
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
_proxy_websocketreferencesexpert_planeat two call sites, butexpert_planeis abuild_appkwarg that is never passed into the function. Every WebSocket proxy request raisesNameError: name 'expert_plane' is not definedafter the CaptureEvent is recorded — on both the failure and success paths.Location (main @ HEAD)
llm_log/proxy.py:315— failure path (_schedule_expert_ingest(request.app, expert_plane, event, b"")after recording the 502)llm_log/proxy.py:391— success path (same call after recording the 101 event)_proxy_websocket's signature (line 269) has noexpert_planeparameter; the sibling HTTP path avoids this becauseproxy()closes overbuild_app's local.Observed impact (production, journalctl --user -u llm-log)
NameError: name 'expert_plane' is not defined. Did you mean: 'ExpertPlane'?tracebacks (2026-09-01), all viaproxy.py:315.502 "upstream websocket connection failed"(the exception escapes before the return).WSServerHandshakeError: 401onwss://api.openai.com/v1/responses); any successful WS session would hit line 391.Suggested fix
Thread
expert_plane(and optionallyrequire_expert_plane) through_proxy_websocket's parameters, mirroringproxy(), or stash it on the app like_INGEST_TASKS_KEY. One-line-ish fix at both call sites plus signature.Regression fixture
A fake upstream that accepts the WS upgrade; assert the relay completes, the 101 event is recorded, and no 500/NameError is logged.