-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add ItemStarted/ItemCompleted events for UserInputItem #5306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…t item events protocol: update ItemStartedEvent and ItemCompletedEvent to use ConversationId state: enhance ItemCollector to send item started/completed events via session
…d ItemCollector - Emit ItemStarted and ItemCompleted EventMsg for user message input using new ItemCollector. - Pass ItemCollector into turn/session context; send events via channel. - Ensure ItemCollector is used in all turn/session creation and review/child tasks. - Add utility for started_completed for single user messages. - Exclude ItemStarted/ItemCompleted from event persistence and human output processing. - Refactor UserMessageItem to
# Conflicts: # codex-rs/core/src/codex.rs # codex-rs/core/src/tasks/compact.rs # codex-rs/core/src/tasks/mod.rs # codex-rs/core/src/tasks/regular.rs # codex-rs/core/src/tasks/review.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
codex/codex-rs/core/src/codex.rs
Lines 1351 to 1357 in 8da0400
| turn_context | |
| .client | |
| .get_otel_event_manager() | |
| .user_prompt(&items); | |
| // attempt to inject input into current task | |
| if let Err(items) = sess.inject_input(items).await { | |
| // Derive a fresh TurnContext for this turn using the provided overrides. |
The new ItemCollector::started_completed call in the UserTurn handler only runs inside the if let Err(items) = sess.inject_input(items).await branch. When a user turn is injected into an already running task (the normal case for multi‑step turns), the injection succeeds and this branch is skipped, so no ItemStarted/ItemCompleted events are emitted despite the commit message promising those events for user messages. This makes user‑initiated messages silently invisible to consumers whenever a task is active, breaking event stream consistency.
ℹ️ 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".
# Conflicts: # codex-rs/core/src/codex.rs
… tests This commit updates the Session::make_turn_context signature to require a tx_event argument and passes it through to ItemCollector initialization. All callsites and related tests are adjusted for the updated API. Also standardizes test usage to pass tx_event and updates input-related types in tests for consistency (InputItem -> UserInput).
| tx_event: Sender<Event>, | ||
| } | ||
|
|
||
| impl ItemCollector { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't pay too much attention to this. I imagine it'll change a lot when we add more interesting items
# Conflicts: # codex-rs/protocol/src/models.rs # codex-rs/protocol/src/protocol.rs
…dEvent, ItemCompletedEvent, and UserInput
…tion_call_over_95_percent_usage
# Conflicts: # codex-rs/core/src/codex.rs
Adds a new ItemStarted event and delivers UserMessage as the first item type (more to come).
Renames
InputItemtoUserInputconsidering we're using theItemsuffix for actual items.