mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Preserve foreign paths in background terminal listings (#35850)
## Why Background terminal working directories can use a path convention from a different platform than the app-server host. Converting them to host-native absolute paths can reject otherwise valid terminal entries and fail the list request. ## What changed - Represent `ThreadBackgroundTerminal.cwd` with `LegacyAppPathString` at the protocol boundary. - Convert terminal `PathUri` values directly to their inferred native path strings instead of validating them against the host platform. ## Testing Add protocol round-trip coverage for POSIX, Windows drive, and Windows UNC working directories. GitOrigin-RevId: d766d54bdc191e75955fb419bec6e60c65f52298
This commit is contained in:
1 parent
03edf16f0b
commit
101d6b8cb2
4 files changed
+63
-18
No files matched your search
@@ -72,6 +72,57 @@ fn test_absolute_path() -> AbsolutePathBuf {
|
||||
absolute_path("readable")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_background_terminals_list_response_round_trips_foreign_paths() {
|
||||
for (uri, expected_cwd) in [
|
||||
("file:///home/alice/repo", "/home/alice/repo"),
|
||||
(
|
||||
"file:///C:/Users/Alice%20Smith/repo",
|
||||
r"C:\Users\Alice Smith\repo",
|
||||
),
|
||||
("file://server/share/repo", r"\\server\share\repo"),
|
||||
] {
|
||||
let response = ThreadBackgroundTerminalsListResponse {
|
||||
data: vec![ThreadBackgroundTerminal {
|
||||
item_id: "item_123".to_string(),
|
||||
process_id: "42".to_string(),
|
||||
command: "run server".to_string(),
|
||||
cwd: PathUri::parse(uri)
|
||||
.expect("cross-platform path URI should parse")
|
||||
.into(),
|
||||
os_pid: None,
|
||||
cpu_percent: None,
|
||||
rss_kb: None,
|
||||
}],
|
||||
next_cursor: None,
|
||||
};
|
||||
let expected = json!({
|
||||
"data": [{
|
||||
"itemId": "item_123",
|
||||
"processId": "42",
|
||||
"command": "run server",
|
||||
"cwd": expected_cwd,
|
||||
"osPid": null,
|
||||
"cpuPercent": null,
|
||||
"rssKb": null,
|
||||
}],
|
||||
"nextCursor": null,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
serde_json::to_value(&response).expect("response should serialize"),
|
||||
expected,
|
||||
"serializing {uri}",
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::from_value::<ThreadBackgroundTerminalsListResponse>(expected)
|
||||
.expect("response should deserialize"),
|
||||
response,
|
||||
"deserializing {uri}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn thread_sources_round_trip_as_scalar_labels() {
|
||||
for (source, label) in [
|
||||
|
||||
Reference in new issue
Block a user