mirror of
https://github.com/openai/codex.git
synced 2026-10-28 16:06:15 +00:00
refactor(protocol): map canonical tool items to legacy events (#31296)
## Description This PR adds legacy `EventMsg` mappings for the `TurnItem` types introduced in [#30282](https://github.com/openai/codex/pull/30282): - `CommandExecution` - `DynamicToolCall` - `CollabAgentToolCall` - `SubAgentActivity` When their producers move to canonical `ItemStarted` / `ItemCompleted`, raw core event consumers can still receive the existing begin/end-style events. The canonical item lifecycle remains the live source of truth. We also record the mapped legacy events in rollout trace so the producer migration preserves the existing tool-runtime trace entries. ## Why This is the compatibility layer for the follow-up producer migrations. Splitting it out first keeps each producer PR small and keeps the legacy mapping in one place. ## What changed - Added `TurnItem` → legacy `EventMsg` mappings in `protocol/src/legacy_events.rs`. - Added the command execution status conversion used by the exec mapping. - Added focused coverage for command execution and dynamic tool mappings.
This commit is contained in:
@@ -1794,6 +1794,9 @@ impl Session {
|
||||
|
||||
let show_raw_agent_reasoning = self.show_raw_agent_reasoning();
|
||||
for legacy in legacy_source.as_legacy_events(show_raw_agent_reasoning) {
|
||||
self.services
|
||||
.rollout_thread_trace
|
||||
.record_tool_call_event(turn_context.sub_id.clone(), &legacy);
|
||||
let legacy_event = Event {
|
||||
id: turn_context.sub_id.clone(),
|
||||
msg: legacy,
|
||||
|
||||
Reference in New Issue
Block a user