-
Notifications
You must be signed in to change notification settings - Fork 6.8k
chore: rework unified exec events #7775
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
|
@codex review |
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
Here are some automated review suggestions for this pull request.
ℹ️ 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".
|
|
||
| let open_call_id = "uexec-delayed-open"; | ||
| let open_args = json!({ | ||
| "cmd": "sleep 5 && echo MARKER1 && sleep 5 && echo MARKER2", |
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.
anything we can do to avoid a 15 second test?
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.
like start a tail -f and write to a file that's being tailed?
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.
If we don't want it to be flaky, not easily. Would be cool to have a custom shell command that waits for a signal from us
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.
Does mkfifo work?
| /// events) can reference the exact PTY bytes corresponding to this tool call, | ||
| /// while the `output` field remains the human‑oriented, possibly truncated | ||
| /// representation used in tool responses. | ||
| pub raw_output: Vec<u8>, |
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.
Similar question to above, do we need separate output on TerminalInteraction?
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.
Same answer. I would argue that yes because this can contain truncation or so
| let yield_time_ms = clamp_yield_time(request.yield_time_ms); | ||
|
|
||
| let start = Instant::now(); | ||
| // For the initial exec_command call, we both stream output to events |
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.
can we read from CommandTranscript ? So there is only one way for output to flow. Similarly with exit code, is it better to have a single thing watching for exit?
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.
We would beed a notify in there then...
pakrym-oai
left a comment
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.
The flow of output/error codes feels a bit complicated with two paralel systems used to serve events and write_stdin.
…ts-2 # Conflicts: # codex-rs/core/src/tools/handlers/unified_exec.rs
|
@codex review |
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
Here are some automated review suggestions for this pull request.
ℹ️ 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".
| tokio::spawn(async move { | ||
| exit_token.cancelled().await; | ||
|
|
||
| let exit_code = session.exit_code().unwrap_or(-1); | ||
| let duration = Instant::now().saturating_duration_since(started_at); |
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.
Clean up unified exec sessions after exit watcher emits end
Long‑running unified exec sessions are inserted into the session store (and their process IDs reserved) but when the background exit watcher fires it only emits ExecCommandEnd and returns, never removing the session entry or releasing the process ID. If a command finishes without any subsequent write_stdin poll, the stale entry stays counted toward the session limits, causing unnecessary "Waiting for …" warnings and eventual pruning of newer sessions even though the completed PTY has already exited. The watcher here needs to clean up the store/reserved IDs once it sends the end event.
Useful? React with 👍 / 👎.
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.
This is on purpose
No description provided.