mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
ResponsesWsSession.persistHistory() guarded on a single historyLogged boolean set once for the lifetime of the WebSocket connection. When a Codex client reuses one connection for multiple sequential response.create turns, only the first terminal event was persisted to call_logs — every subsequent turn's usage/history was silently dropped. firstResponseBody had the same per-connection freeze (||=), so even a hypothetical second log entry would still carry turn 1's request body. Replace the boolean with a Set keyed by the terminal event's response.id (falling back to a session-scoped sentinel for session-ending failure paths that don't carry a response id: prepare failure, upstream error/close, connect failure), and track each turn's own request body via currentRequestBody instead of freezing on firstResponseBody. This logs exactly once per logical turn while keeping session-ending failures logged exactly once, and each logged call now carries its own terminal response id and request payload. Regression test: tests/unit/responses-ws-proxy-multi-turn-history.test.ts opens one WS connection, sends two response.create turns, and asserts two distinct call-log entries land at the internal bridge, each with its own response id and request body. Closes #7388