mirror of
https://github.com/openai/codex.git
synced 2026-09-11 20:36:49 +00:00
Generate Python SDK types from repository app-server schemas (#44032)
## Why Keep Python protocol models aligned with the checked-in app-server schemas and preserve reviewed generated artifacts when staging SDK releases. ## What changed - Generate SDK types from the schema directory configured in `pyproject.toml`, with a `--schema-dir` override, instead of invoking the pinned runtime binary. - Refresh Python artifacts through `just write-app-server-schema` for standard repository exports. Skip SDK updates for scratch and experimental exports. - Regenerate protocol models and notification dispatch, deriving the known payload union from the registry so `Notification.payload` covers every registered event. - Explicitly allowlist convenience API parameters so new protocol fields do not silently expand method signatures. Preserve existing approval path wrappers. - Stage SDK releases using checked-in generated files without regenerating them. ## Testing Add coverage for schema selection, refresh gating and failure handling, release artifact preservation, notification payload typing, and approval path compatibility. Update the generation drift test to use repository schemas. GitOrigin-RevId: fab350b07cf170258b91fbafa8da384aeb2e3bd7
This commit is contained in:
@@ -268,6 +268,23 @@ from openai_codex.types import (
|
||||
)
|
||||
```
|
||||
|
||||
### Notifications and generated models
|
||||
|
||||
Known notifications have typed `Notification.payload` values, including
|
||||
authentication recovery, thread queue/project changes, thread reversion, and
|
||||
realtime item updates. The `Notification.payload` type covers every registered
|
||||
event. Unknown methods and payloads that fail validation still produce
|
||||
`UnknownNotification`, with the raw data in
|
||||
`.params`. When an event gains a typed payload, read its named fields instead
|
||||
of `.params`.
|
||||
|
||||
Returned models include the current CLI's thread metadata, richer turn errors,
|
||||
and `functionCallOutput` history items. Code that imports generated
|
||||
`HookMetadata` directly must access the handler through `.root`, inspect its
|
||||
`handler_type`, and then read the fields for that handler. For example, only a
|
||||
`"command"` handler has a `command` field. This reflects the app-server's
|
||||
separate command, MCP tool, prompt, and agent hook variants.
|
||||
|
||||
## Retry + errors
|
||||
|
||||
```python
|
||||
|
||||
Reference in New Issue
Block a user