Description
When a Codex conversation switches models while keeping the same WebSocket connection open, Headroom can record the response metrics under unknown instead of the model that handled each turn. This makes per-model usage, savings, and cost reports inaccurate.
Reproduce Steps
- Run the OpenAI Responses WebSocket proxy.
- Keep one WebSocket session open.
- Send a turn using
model-a and complete it.
- Send another turn on the same session using
model-b and complete it.
- Inspect the recorded request metrics.
Minimal client frames:
{"type":"response.create","response":{"model":"model-a","input":"first turn"}}
{"type":"response.create","response":{"model":"model-b","input":"second turn"}}
Expected Behavior
The recorded models should be model-a, then model-b.
Actual Behavior
Before the fix, the same session recorded unknown, unknown. The failure was reproduced against an archived copy of main.
Code Sample
response.completed.response.model = model-a
response.completed.response.model = model-b
recorded metrics = [model-a, model-b]
Error Output
No exception is raised. The failure is incorrect telemetry attribution:
assert ['unknown', 'unknown'] == ['model-a', 'model-b']
Environment
- Headroom version: source checkout at the pre-fix
main revision
- Python version: 3.13.3
- OS: Windows (win32)
- LLM Provider: OpenAI Codex Responses WebSocket
Additional Context
Codex can keep one connection open for a multi-turn conversation while the user changes models. Each completed turn should be attributed to the model that handled it so the dashboard and reports remain accurate across model changes.
Description
When a Codex conversation switches models while keeping the same WebSocket connection open, Headroom can record the response metrics under
unknowninstead of the model that handled each turn. This makes per-model usage, savings, and cost reports inaccurate.Reproduce Steps
model-aand complete it.model-band complete it.Minimal client frames:
{"type":"response.create","response":{"model":"model-a","input":"first turn"}} {"type":"response.create","response":{"model":"model-b","input":"second turn"}}Expected Behavior
The recorded models should be
model-a, thenmodel-b.Actual Behavior
Before the fix, the same session recorded
unknown,unknown. The failure was reproduced against an archived copy ofmain.Code Sample
Error Output
No exception is raised. The failure is incorrect telemetry attribution:
Environment
mainrevisionAdditional Context
Codex can keep one connection open for a multi-turn conversation while the user changes models. Each completed turn should be attributed to the model that handled it so the dashboard and reports remain accurate across model changes.