[codex] Rename Python SDK AppServerConfig to CodexConfig (#24800)

## Why

`AppServerConfig` is exported as part of the ergonomic Python SDK
surface and passed to `Codex(...)` and `AsyncCodex(...)`. That name
exposes the underlying app-server transport at the same layer where
users are configuring the Codex client. `CodexConfig` makes the common
callsite read naturally and names the object it configures.

## What changed

- Renamed the public configuration dataclass from `AppServerConfig` to
`CodexConfig`.
- Updated `Codex`, `AsyncCodex`, and the transport clients to accept
`CodexConfig`.
- Updated binary-resolution messages, package exports, docs, examples,
and related coverage to use the new public name.

## API impact

```python
from openai_codex import Codex, CodexConfig

with Codex(config=CodexConfig(codex_bin="/path/to/codex")) as codex:
    ...
```

Callers should now import and construct `CodexConfig`; `AppServerConfig`
is no longer part of the Python SDK surface.

## Validation

- `uv run --frozen --extra dev ruff check src/openai_codex scripts
examples tests`
- Tests are deferred to online CI for this PR.
This commit is contained in:
Ahmed Ibrahim
2026-05-27 16:10:15 -07:00
committed by GitHub
Unverified
parent 090144e0ec
commit 0db49a7e6a
22 changed files with 127 additions and 126 deletions
+12 -12
View File
@@ -3,11 +3,11 @@ from __future__ import annotations
from typing import Any
class AppServerError(Exception):
class CodexError(Exception):
"""Base exception for SDK errors."""
class JsonRpcError(AppServerError):
class JsonRpcError(CodexError):
"""Raw JSON-RPC error wrapper from the server."""
def __init__(self, code: int, message: str, data: Any = None):
@@ -17,35 +17,35 @@ class JsonRpcError(AppServerError):
self.data = data
class TransportClosedError(AppServerError):
"""Raised when the app-server transport closes unexpectedly."""
class TransportClosedError(CodexError):
"""Raised when the Codex transport closes unexpectedly."""
class AppServerRpcError(JsonRpcError):
class CodexRpcError(JsonRpcError):
"""Base typed error for JSON-RPC failures."""
class ParseError(AppServerRpcError):
class ParseError(CodexRpcError):
pass
class InvalidRequestError(AppServerRpcError):
class InvalidRequestError(CodexRpcError):
pass
class MethodNotFoundError(AppServerRpcError):
class MethodNotFoundError(CodexRpcError):
pass
class InvalidParamsError(AppServerRpcError):
class InvalidParamsError(CodexRpcError):
pass
class InternalRpcError(AppServerRpcError):
class InternalRpcError(CodexRpcError):
pass
class ServerBusyError(AppServerRpcError):
class ServerBusyError(CodexRpcError):
"""Server is overloaded / unavailable and caller should retry."""
@@ -104,7 +104,7 @@ def map_jsonrpc_error(code: int, message: str, data: Any = None) -> JsonRpcError
return ServerBusyError(code, message, data)
if _contains_retry_limit_text(message):
return RetryLimitExceededError(code, message, data)
return AppServerRpcError(code, message, data)
return CodexRpcError(code, message, data)
return JsonRpcError(code, message, data)