Skip to content

Conversation

@pakrym-oai
Copy link
Collaborator

@pakrym-oai pakrym-oai commented Oct 17, 2025

Adds a new ItemStarted event and delivers UserMessage as the first item type (more to come).

Renames InputItem to UserInput considering we're using the Item suffix for actual items.

…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
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

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.

P1 Badge Emit user item events even when injected into active task

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 {
Copy link
Collaborator Author

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
# Conflicts:
#	codex-rs/core/src/codex.rs
@pakrym-oai pakrym-oai merged commit 9c903c4 into main Oct 20, 2025
20 checks passed
@pakrym-oai pakrym-oai deleted the pakrym/add-useritem-event branch October 20, 2025 20:34
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants