mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Run write_stdin concurrently across terminal sessions (#33645)
## What changed - Allow parallel `write_stdin` tool calls to interact with independent terminal sessions. - Serialize reads and writes within each session so its output buffer and process lifecycle remain consistent. - Prevent active sessions from being pruned while a `write_stdin` interaction is in progress. ## Testing - Added unified exec and code mode coverage that uses two terminal sessions concurrently and verifies output from both. GitOrigin-RevId: 618f5503f4c4670421f680c0f0c27414bc6b2ddd
This commit is contained in:
1 parent
f722a7ebcf
commit
f64233d142
5 files changed
+154
-4
No files matched your search
@@ -82,6 +82,7 @@ pub(crate) struct UnifiedExecProcess {
|
||||
output_closed_notify: Arc<Notify>,
|
||||
cancellation_token: CancellationToken,
|
||||
output_drained: Arc<Notify>,
|
||||
interaction_lock: Arc<Mutex<()>>,
|
||||
state_tx: watch::Sender<ProcessState>,
|
||||
state_rx: watch::Receiver<ProcessState>,
|
||||
output_task: Option<JoinHandle<()>>,
|
||||
@@ -123,6 +124,7 @@ impl UnifiedExecProcess {
|
||||
output_closed_notify,
|
||||
cancellation_token,
|
||||
output_drained,
|
||||
interaction_lock: Arc::new(Mutex::new(())),
|
||||
state_tx,
|
||||
state_rx,
|
||||
output_task: None,
|
||||
@@ -178,6 +180,10 @@ impl UnifiedExecProcess {
|
||||
Arc::clone(&self.output_drained)
|
||||
}
|
||||
|
||||
pub(super) fn interaction_lock(&self) -> Arc<Mutex<()>> {
|
||||
Arc::clone(&self.interaction_lock)
|
||||
}
|
||||
|
||||
pub(super) fn has_exited(&self) -> bool {
|
||||
let state = self.state_rx.borrow().clone();
|
||||
match &self.process_handle {
|
||||
|
||||
Reference in new issue
Block a user