Propagate safety buffering treatment metadata - #29473
Conversation
28cba3a to
5cd9fa9
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cd9fa92b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if let Some(headers) = event.headers.as_ref().and_then(Value::as_object) | ||
| && let Some(treatment) = | ||
| treatment_from_headers(&json_headers_to_http_headers(headers)) |
There was a problem hiding this comment.
Preserve array-valued websocket metadata headers
When the WebSocket response.metadata.headers object encodes header values as arrays, this path drops the safety-buffering headers before treatment_from_headers sees them, because json_headers_to_http_headers only converts scalar JSON values. The existing metadata header readers already accept arrays via json_value_as_string, so a response with headers like { "x-codex-safety-buffering-enabled": ["true"] } will still parse model/turn-state metadata but will emit showBufferingUi: false and no fasterModel.
Useful? React with 👍 / 👎.
| pub use_cases: Vec<String>, | ||
| pub reasons: Vec<String>, | ||
| pub show_buffering_ui: bool, | ||
| pub faster_model: Option<String>, |
There was a problem hiding this comment.
Keep fasterModel required in the JSON schema
Because this v2 notification does not skip None, fasterModel is always serialized on the wire as either a string or null, and the generated TypeScript/README now describe it as a required nullable field; however leaving the field as a plain Option makes the regenerated JSON schemas omit fasterModel from required. JSON-schema clients can therefore generate an optional property that does not match the actual app-server payload, so mark the field required for schemars and regenerate the fixtures.
AGENTS.md reference: AGENTS.md:L267-L270
Useful? React with 👍 / 👎.
Summary
showBufferingUiand nullablefasterModelthrough the existingmodel/safetyBuffering/updatedapp-server notificationThe public implementation contains no model mapping or real model identifier. Tests and protocol examples use generic
current-modelandfaster-modelplaceholders only.Dependencies
Validation
The broader app-server run compiled all changed crates and completed with 1,269 passing tests. Its remaining failures were unrelated environment limitations: macOS sandbox application was denied, one expected test binary was unavailable, and several existing subprocess tests timed out as a result.