chore: handle all cases for EventMsg (#936)

For now, this removes the `#[non_exhaustive]` directive on `EventMsg` so
that we are forced to handle all `EventMsg` by default. (We may revisit
this if/when we publish `core/` as a `lib` crate.) For now, it is
helpful to have this as a forcing function because we have effectively
two UIs (`tui` and `exec`) and usually when we add a new variant to
`EventMsg`, we want to be sure that we update both.
This commit is contained in:
Michael Bolin
2025-05-14 13:36:43 -07:00
committed by GitHub
parent 497c5396c0
commit 34aa1991f1
5 changed files with 36 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ use codex_core::protocol::McpToolCallBeginEvent;
use codex_core::protocol::McpToolCallEndEvent;
use codex_core::protocol::PatchApplyBeginEvent;
use codex_core::protocol::PatchApplyEndEvent;
use codex_core::protocol::SessionConfiguredEvent;
use owo_colors::OwoColorize;
use owo_colors::Style;
use shlex::try_join;
@@ -180,8 +181,6 @@ impl EventProcessor {
}
println!("{}", truncated_output.style(self.dimmed));
}
// Handle MCP tool calls (e.g. calling external functions via MCP).
EventMsg::McpToolCallBegin(McpToolCallBeginEvent {
call_id,
server,
@@ -372,8 +371,12 @@ impl EventProcessor {
EventMsg::ApplyPatchApprovalRequest(_) => {
// Should we exit?
}
_ => {
// Ignore event.
EventMsg::AgentReasoning(agent_reasoning_event) => {
println!("thinking: {}", agent_reasoning_event.text);
}
EventMsg::SessionConfigured(session_configured_event) => {
let SessionConfiguredEvent { session_id, model } = session_configured_event;
println!("session {session_id} with model {model}");
}
}
}