mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 13:11:38 +00:00
* fix(ai): prevent websocket cache clobber on concurrent acquire The WebSocket session cache acquire path (expired or non-reusable cached entry) used unconditional delete/set around the connectWebSocket() await. A concurrent request could install a newer entry during that await, which the resuming acquire then clobbered, orphaning the socket that carried the real previous_response_id continuation and corrupting multi-turn Codex conversations. Mirror the release path's owner-checked helpers: delete via deleteOwnedWebSocketSession, and install via a new setOwnedWebSocketSession that only writes when the cache still matches what this acquire left behind (the stale entry, or undefined after removing it / on first connect). A different cached entry means a concurrent request already won the session. The busy-cached branch is unaffected: it returns a transient socket and never writes the cache. * fix(ai): close CAS loser websocket promptly without leaking its socket * fix(ai): correct verifyClient callback type in race regression test * fix(ai): remove unused variable and fix lint in race regression test * test(ai): prove concurrent websocket loser closes --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org>