bb7cb66bd9
The LoadSession, NewSession, Cancel, and Prompt methods were holding a.mu.Lock() while waiting for client.Call() to return. The codex client's readLoop processes incoming messages synchronously, and when codex sends notifications (like mcp_startup_complete), handleNotification tries to acquire a.mu.RLock() - which blocks because the exclusive lock is held. This prevents readLoop from processing the RPC response, causing deadlock. Fix: Don't hold the mutex while waiting for RPC calls. Instead: 1. Acquire lock briefly to read client and needed fields 2. Release lock before RPC call 3. Acquire lock briefly to write results after call completes Also reverts codex-agent SessionConfig to ResumeViaACP: true since thread/resume works correctly when not deadlocked.