fix: change EventMsg enum so every variant takes a single struct (#925)
https://github.com/openai/codex/pull/922 did this for the `SessionConfigured` enum variant, and I think it is generally helpful to be able to work with the values as each enum variant as their own type, so this converts the remaining variants and updates all of the callsites. Added a simple unit test to verify that the JSON-serialized version of `Event` does not have any unexpected nesting.
This commit is contained in:
@@ -4,6 +4,8 @@ use codex_core::Codex;
|
||||
use codex_core::ModelProviderInfo;
|
||||
use codex_core::config::Config;
|
||||
use codex_core::exec::CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR;
|
||||
use codex_core::protocol::ErrorEvent;
|
||||
use codex_core::protocol::EventMsg;
|
||||
use codex_core::protocol::InputItem;
|
||||
use codex_core::protocol::Op;
|
||||
use serde_json::Value;
|
||||
@@ -127,7 +129,7 @@ async fn keeps_previous_response_id_between_tasks() {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
if matches!(ev.msg, codex_core::protocol::EventMsg::TaskComplete) {
|
||||
if matches!(ev.msg, EventMsg::TaskComplete) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -149,8 +151,8 @@ async fn keeps_previous_response_id_between_tasks() {
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
match ev.msg {
|
||||
codex_core::protocol::EventMsg::TaskComplete => break,
|
||||
codex_core::protocol::EventMsg::Error { message } => {
|
||||
EventMsg::TaskComplete => break,
|
||||
EventMsg::Error(ErrorEvent { message }) => {
|
||||
panic!("unexpected error: {message}")
|
||||
}
|
||||
_ => (),
|
||||
|
||||
Reference in New Issue
Block a user