mirror of
https://github.com/openai/codex.git
synced 2026-10-21 17:48:44 +00:00
Scope code mode cell IDs to the host process
This commit is contained in:
@@ -49,6 +49,7 @@ async fn run() -> Result<(), String> {
|
||||
sessions: Mutex::new(HashMap::new()),
|
||||
next_session_id: AtomicU64::new(1),
|
||||
peer,
|
||||
host_id: std::process::id().to_string(),
|
||||
});
|
||||
|
||||
let writer = tokio::spawn(async move {
|
||||
@@ -110,8 +111,12 @@ impl HostState {
|
||||
});
|
||||
self.sessions.lock().await.insert(
|
||||
session_id,
|
||||
Arc::new(CodeModeService::with_delegate(delegate)),
|
||||
Arc::new(CodeModeService::with_delegate_and_cell_id_prefix(
|
||||
delegate,
|
||||
self.host_id.clone(),
|
||||
)),
|
||||
);
|
||||
host_id: String,
|
||||
self.respond(request_id, Ok(HostResponse::SessionCreated { session_id }))
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ async fn serves_code_mode_sessions_over_stdio() {
|
||||
.kill_on_drop(true)
|
||||
.spawn()
|
||||
.expect("spawn codex-code-mode-host");
|
||||
let host_id = child.id().expect("host process id");
|
||||
let mut stdin = child.stdin.take().expect("host stdin");
|
||||
let mut stdout = child.stdout.take().expect("host stdout");
|
||||
|
||||
@@ -70,6 +71,7 @@ async fn serves_code_mode_sessions_over_stdio() {
|
||||
}) => cell_id,
|
||||
message => panic!("unexpected execute response: {message:?}"),
|
||||
};
|
||||
assert_eq!(cell_id.as_str(), format!("{host_id}_1"));
|
||||
let response = match read_frame(&mut stdout)
|
||||
.await
|
||||
.expect("initial response frame")
|
||||
|
||||
Reference in New Issue
Block a user