[Design] GOD_OBJECT: CodexClient and AsyncCodexClient violate single responsibility (56 / 42 methods)

Open 💬 0 comments Opened Jun 16, 2026 by Moonsehwan

Summary

AINA Scan (AI-powered Python SAST) flagged GOD_OBJECT violations in the Python SDK client classes.

Affected Files

| File | Class | Non-dunder Methods |
|------|-------|--------------------|
| sdk/python/src/openai_codex/client.py:212 | CodexClient | 56 |
| sdk/python/src/openai_codex/async_client.py:52 | AsyncCodexClient | 42 |

Risk

A class with 40+ methods is a God Object - it handles authentication, session management, thread control, goal operations, model listing, connection I/O, and more. This makes the class:

  • Hard to test in isolation
  • Difficult to extend without breaking unrelated features
  • A maintenance bottleneck (any change touches this file)

Recommendation

Split into focused classes:

CodexClient
  ??? CodexAuthManager        (login, logout, tokens)
  ??? CodexThreadManager      (start, list, read, archive)
  ??? CodexGoalManager        (register, pause, cancel, operations)
  ??? CodexConnectionIO       (_reader_loop, turn_interrupt, notifications)
Found by aina-scan - AI-powered Python SAST (13 vuln types, L3 causal chains)

View original on GitHub ↗