mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
Expose Daybreak availability in model discovery (#62499)
## Why Clients need to distinguish a caller who must enroll in Daybreak from a model that does not support it. The list of accepted access programs alone cannot express that distinction. ## What changed Carry the server-resolved status for each caller and model from the model catalog into `model/list` as `availableAccessPrograms.daybreakAvailability`. Update the JSON schemas, TypeScript bindings, and Python SDK to expose the field. Rust decoders use `default` for missing or unrecognized statuses. The Python SDK also defaults missing statuses and preserves new strings from newer hosts. ## Testing Cover catalog decoding, app-server response serialization, and Python SDK round trips with known, missing, and future status values. GitOrigin-RevId: c1e5ddef68fd19b25e583bb6996a93fd78ab9d18
This commit is contained in:
committed by
copyberry
parent
b0ecad9cf9
commit
1826d80eca
@@ -608,6 +608,7 @@ def generate_v2_all(schema_dir: Path, *, format_output: bool = True) -> None:
|
||||
_preserve_inline_media_class_names(out_path)
|
||||
_add_legacy_image_generation_thread_item_alias(out_path)
|
||||
_preserve_open_enum(out_path, "CodexErrorInfoValue", allow_empty=True)
|
||||
_preserve_open_enum(out_path, "DaybreakAvailability")
|
||||
_preserve_reasoning_effort_enum(out_path)
|
||||
_preserve_thread_source_enum(out_path)
|
||||
_preserve_open_enum(out_path, "PlanType")
|
||||
|
||||
@@ -1214,6 +1214,22 @@ class CyberAccessProgram(Enum):
|
||||
daybreak_red = "daybreakRed"
|
||||
|
||||
|
||||
class DaybreakAvailability(str, Enum):
|
||||
available = "available"
|
||||
enrollment_required = "enrollmentRequired"
|
||||
unavailable_for_model = "unavailableForModel"
|
||||
default = "default"
|
||||
|
||||
@classmethod
|
||||
def _missing_(cls, value: object) -> DaybreakAvailability | None:
|
||||
if not isinstance(value, str) or not value:
|
||||
return None
|
||||
member = str.__new__(cls, value)
|
||||
member._name_ = value
|
||||
member._value_ = value
|
||||
return member
|
||||
|
||||
|
||||
class DeprecationNoticeNotification(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@@ -2936,6 +2952,13 @@ class ModelAccessPrograms(BaseModel):
|
||||
populate_by_name=True,
|
||||
)
|
||||
cyber: Annotated[list[CyberAccessProgram], Field(description="Accepted explicit selections.")]
|
||||
daybreak_availability: Annotated[
|
||||
DaybreakAvailability | None,
|
||||
Field(
|
||||
alias="daybreakAvailability",
|
||||
description="Server-resolved Daybreak availability for this caller and model.",
|
||||
),
|
||||
] = "default"
|
||||
|
||||
|
||||
class ModelAvailabilityNux(BaseModel):
|
||||
|
||||
@@ -328,6 +328,43 @@ def test_generated_v2_bundle_has_single_shared_plan_type_definition() -> None:
|
||||
assert source.count("class PlanType(") == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"availability",
|
||||
[None, "available", "enrollmentRequired", "unavailableForModel", "default", "futureStatus"],
|
||||
)
|
||||
def test_model_list_preserves_daybreak_availability_from_older_and_newer_hosts(
|
||||
monkeypatch: pytest.MonkeyPatch, availability: str | None
|
||||
) -> None:
|
||||
access_programs: JsonObject = {"cyber": ["standard", "daybreakBlue", "daybreakRed"]}
|
||||
if availability is not None:
|
||||
access_programs["daybreakAvailability"] = availability
|
||||
wire = {
|
||||
"data": [
|
||||
{
|
||||
"id": "model-id",
|
||||
"model": "model-id",
|
||||
"displayName": "Model",
|
||||
"description": "A caller-visible model",
|
||||
"hidden": False,
|
||||
"isDefault": False,
|
||||
"defaultReasoningEffort": "medium",
|
||||
"supportedReasoningEfforts": [],
|
||||
"availableAccessPrograms": access_programs,
|
||||
}
|
||||
],
|
||||
"nextCursor": None,
|
||||
}
|
||||
client = CodexClient()
|
||||
monkeypatch.setattr(client, "_request_raw", lambda _method, _params: wire)
|
||||
|
||||
response = client.model_list()
|
||||
|
||||
assert response.model_dump(mode="json", by_alias=True, exclude_unset=True) == wire
|
||||
programs = response.data[0].available_access_programs
|
||||
assert programs is not None
|
||||
assert programs.daybreak_availability == (availability or "default")
|
||||
|
||||
|
||||
def test_plan_type_accepts_business_prolite_from_newer_runtime() -> None:
|
||||
"""New runtime plan values should remain typed when using a codex_bin override."""
|
||||
plan_type = "self_serve_business_prolite"
|
||||
|
||||
Reference in New Issue
Block a user