[3/8] Add pushed exec process events#18020
[3/8] Add pushed exec process events#18020aibrahim-oai wants to merge 1 commit intodev/remote-mcp-exec-stdinfrom
Conversation
Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5c217e55a
ℹ️ 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".
| impl SessionState { | ||
| fn new() -> Self { | ||
| let (wake_tx, _wake_rx) = watch::channel(0); | ||
| let (event_tx, _event_rx) = broadcast::channel(PROCESS_EVENT_CHANNEL_CAPACITY); |
There was a problem hiding this comment.
Buffer events until first subscriber attaches
SessionState::new creates a broadcast channel and immediately drops the initial receiver. If a short-lived process outputs/exits before subscribe_events() is called, publish_event drops those events (no receivers), yet the sender remains alive on the process handle. An event-only consumer can then wait forever for Exited/Closed, which is a functional hang.
Useful? React with 👍 / 👎.
| @@ -645,6 +677,7 @@ async fn handle_server_notification( | |||
| let session = inner.remove_session(¶ms.process_id).await; | |||
There was a problem hiding this comment.
Keep session routed until ordered terminal events arrive
On exec/closed, the client removes the session before forwarding the event. Server notifications are emitted from concurrent tasks, so closed can arrive before lower-seq exited/output notifications. After removal, those delayed notifications are dropped, so remote event subscribers can miss exit status or tail output.
Useful? React with 👍 / 👎.
Summary
ExecProcessEventstream alongside retainedprocess/readoutput.Testing
cargo check -p codex-exec-servercargo check -p codex-rmcp-clientcargo testper repo instruction; CI will cover.Stack