Feat: add model reroute notification#12001
Conversation
2af5e8e to
1c2e829
Compare
| .send_server_notification(ServerNotification::ItemStarted(started)) | ||
| .await; | ||
| let completed = ItemCompletedNotification { | ||
| EventMsg::Warning(_warning_event) => {} |
There was a problem hiding this comment.
Let me know if I should keep this.
There was a problem hiding this comment.
I think I should.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1c2e829b80
ℹ️ 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".
| EventMsg::ModelReroute(ModelRerouteEvent { | ||
| from_model: requested_model.clone(), | ||
| to_model: server_model.clone(), | ||
| reason: ModelRerouteReason::HighRiskCyberActivity, |
There was a problem hiding this comment.
Derive reroute reason from server evidence
maybe_warn_on_server_model_mismatch emits ModelRerouteReason::HighRiskCyberActivity for any model mismatch. The only guard is server_model != requested_model, so benign reroutes (e.g., alias/canonicalization/provider fallback) will be reported as a high-risk safety flag. This new structured signal can mislead clients and trigger incorrect UX/policy handling.
Useful? React with 👍 / 👎.
| pub struct ModelReroutedNotification { | ||
| pub thread_id: String, | ||
| pub turn_id: String, | ||
| pub from_model: String, | ||
| pub to_model: String, | ||
| pub reason: ModelRerouteReason, | ||
| } |
There was a problem hiding this comment.
We will construct the message, tooltip etc on the app side. This also allows up to be more dynamic in the future.
Summary
Builiding off https://github.com/openai/codex/pull/11964/files/5c75aa7b89a70bc2cc410a6fd238749306ec4c5e#diff-058ae8f109a8b84b4b79bbfa45f522c2233b9d9e139696044ae374d50b6196e0, we have created a
model/reroutednotification that captures the event so that consumers can render as expected. Keep theEventMsg::Warningpath in core so that this does not affect TUI rendering.model/reroutedis meant to be generic to account for future usage including capacity planning etc.