codex - 💡(How to fix) Fix Python SDK treats model/verification and guardianWarning app-server notifications as UnknownNotification [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19348Fetched 2026-04-25 06:11:05
View on GitHub
Comments
2
Participants
2
Timeline
4
Reactions
0
Timeline (top)
commented ×2labeled ×2

Code Example

PYTHONPATH=sdk/python/src python3 - <<'PY'
from codex_app_server.client import AppServerClient
from codex_app_server.models import UnknownNotification

client = object.__new__(AppServerClient)

notif = client._coerce_notification(
    "model/verification",
    {"threadId": "t", "turnId": "u", "verifications": ["trustedAccessForCyber"]},
)
print(type(notif.payload).__name__, isinstance(notif.payload, UnknownNotification))

warning = client._coerce_notification(
    "guardianWarning",
    {"threadId": "t", "message": "m"},
)
print(type(warning.payload).__name__, isinstance(warning.payload, UnknownNotification))
PY

---

UnknownNotification True
UnknownNotification True
RAW_BUFFERClick to expand / collapse

What issue are you seeing?

The Python app-server SDK treats two typed v2 app-server notifications as UnknownNotification:

  • model/verification
  • guardianWarning

These notifications are defined and emitted by the Rust app-server protocol. The JSON/TypeScript schema also includes both variants.

However, the generated Python SDK currently does not expose ModelVerificationNotification or GuardianWarningNotification in generated/v2_all.py, and generated/notification_registry.py has no entries for either method. As a result, AppServerClient._coerce_notification() falls back to UnknownNotification.

This can cause Python SDK clients to miss typed handling for safety/account verification or guardian warning notifications.

What steps can reproduce the bug?

From the repo root:

PYTHONPATH=sdk/python/src python3 - <<'PY'
from codex_app_server.client import AppServerClient
from codex_app_server.models import UnknownNotification

client = object.__new__(AppServerClient)

notif = client._coerce_notification(
    "model/verification",
    {"threadId": "t", "turnId": "u", "verifications": ["trustedAccessForCyber"]},
)
print(type(notif.payload).__name__, isinstance(notif.payload, UnknownNotification))

warning = client._coerce_notification(
    "guardianWarning",
    {"threadId": "t", "message": "m"},
)
print(type(warning.payload).__name__, isinstance(warning.payload, UnknownNotification))
PY

Actual output:

UnknownNotification True
UnknownNotification True

What is the expected behavior?

The Python SDK should expose typed payload models for both notifications and register them in NOTIFICATION_MODELS:

  • model/verification -> ModelVerificationNotification
  • guardianWarning -> GuardianWarningNotification

Then _coerce_notification() should return typed notification payloads instead of UnknownNotification.

Additional information

Relevant files:

  • codex-rs/app-server-protocol/src/protocol/common.rs
  • codex-rs/app-server-protocol/src/protocol/v2.rs
  • codex-rs/app-server/src/bespoke_event_handling.rs
  • codex-rs/app-server-protocol/schema/json/ServerNotification.json
  • codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts
  • sdk/python/src/codex_app_server/generated/v2_all.py
  • sdk/python/src/codex_app_server/generated/notification_registry.py
  • sdk/python/src/codex_app_server/client.py
  • sdk/python/scripts/update_sdk_artifacts.py

I checked for existing issues/PRs and did not find an exact duplicate.

Related but not duplicate:

  • #19055 appears to add the Rust/app-server/schema side of the safety notification handling, but does not update the generated Python SDK classes or notification registry.
  • #18862 refreshed generated Python app-server SDK types before #19055 merged, so it likely predates these notification additions.

A narrow fix could update the Python SDK generation path so these notification payload models are generated and registered, plus add a small Python SDK regression test for _coerce_notification().

If maintainers agree this is the right scope and invite a PR, I’d be happy to prepare a focused fix.

extent analysis

TL;DR

Update the Python SDK generation path to include ModelVerificationNotification and GuardianWarningNotification models and register them in NOTIFICATION_MODELS.

Guidance

  • Review the update_sdk_artifacts.py script to ensure it generates the necessary Python SDK classes for the model/verification and guardianWarning notifications.
  • Verify that the v2_all.py and notification_registry.py files are updated to include the new notification models.
  • Add a regression test for _coerce_notification() to ensure it returns the correct typed notification payloads.
  • Check the Rust app-server protocol and schema files to confirm that the notifications are correctly defined and emitted.

Example

# Example of how the updated _coerce_notification() method could work
def _coerce_notification(self, notification_type, payload):
    if notification_type == "model/verification":
        return ModelVerificationNotification(payload)
    elif notification_type == "guardianWarning":
        return GuardianWarningNotification(payload)
    else:
        return UnknownNotification(payload)

Notes

The fix requires updating the Python SDK generation path and adding a regression test. The example code snippet assumes that the ModelVerificationNotification and GuardianWarningNotification classes are generated and available.

Recommendation

Apply a workaround by manually adding the missing notification models and registering them in NOTIFICATION_MODELS until a proper fix can be implemented through updating the SDK generation path.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING