6da970f15d
session.close only closed the slash_worker subprocess but never called agent.close() on the AIAgent instance. In the long-lived TUI gateway process, this left httpx clients for GC to finalize. When the OS recycled a closed FD number for a new active connection, the stale finalizer would close the live socket, causing intermittent [Errno 9] Bad file descriptor on subsequent LLM API calls. Call agent.close() (which properly shuts down the httpx transport pool and TCP sockets) before closing the slash_worker.