8a5b49d86a
_CodexCompletionsAdapter.create arms a daemon threading.Timer that calls client.close() when the aux Responses stream exceeds its timeout. On a stalled stream -- the failure the timeout exists for -- the Timer is the only thing that fires, so the close runs on a thread that does not own the in-flight httpx connection. That is the FD-ownership violation the repo already fixed twice on the main transport (#29507, #67142, #70773): close() releases the raw TLS fd while the owner's OpenSSL BIO still caches that integer, the kernel recycles it into the next open() in the process -- a SessionDB or kanban.db handle -- and the owner's unwinding TLS flush writes an application-data record into that database file. agent/auxiliary_client.py had no thread-ownership machinery at all: the guarded twins (_retire_shared_openai_client, _abort_request_openai_client) live in run_agent.py and are unreachable from this adapter, which holds no AIAgent reference. Dispatch on ownership the way chat_completion_helpers already does: from a stranger thread only force_close_tcp_sockets() (shutdown(SHUT_RDWR), which is FD-safe from any thread), and let the owning thread release the FDs when it unwinds. The owner-thread caller (_check_cancelled) keeps closing directly. Cache eviction (#23432) is unchanged.