mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
core: load AGENTS.md from foreign environments (#28958)
## Why Make it possible to load AGENTS.md from remote exec-servers whose OS is different than app-server. ## What - keep `AGENTS.md` discovery and provenance as `PathUri`, with root-aware parent and ancestor traversal - expose lifecycle instruction sources as legacy app-server path strings in events while retaining `PathUri` internally - preserve and test mixed POSIX and Windows paths in model context and TUI status output - cover remote Windows loading end to end by seeding the Wine prefix through host filesystem APIs - fix bug in `PathUri`'s parent() implementation that would erase Windows drive letters
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
//! Test support for running the Windows exec-server under Wine.
|
||||
|
||||
use std::future::Future;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
@@ -12,16 +13,18 @@ use wine_test_support::WineTestCommand;
|
||||
pub struct WineExecServer;
|
||||
|
||||
impl WineExecServer {
|
||||
/// Starts the server, passes its WebSocket URL to `operation`, and tears it down afterward.
|
||||
/// Starts the server, passes its WebSocket URL and Wine prefix to `operation`, and tears it
|
||||
/// down afterward.
|
||||
pub async fn scope<T, F, Fut>(self, operation: F) -> Result<T>
|
||||
where
|
||||
F: FnOnce(String) -> Fut,
|
||||
F: FnOnce(String, PathBuf) -> Fut,
|
||||
Fut: Future<Output = Result<T>>,
|
||||
{
|
||||
let executable = codex_utils_cargo_bin::cargo_bin("wine-windows-exec-server")?;
|
||||
let mut exec_server = WineTestCommand::new(executable)
|
||||
.env("CODEX_HOME", r"C:\codex-home")
|
||||
.spawn()?;
|
||||
let wine_prefix = exec_server.prefix_path().to_path_buf();
|
||||
let stdout = exec_server.take_stdout();
|
||||
|
||||
exec_server
|
||||
@@ -36,7 +39,7 @@ impl WineExecServer {
|
||||
break line;
|
||||
}
|
||||
};
|
||||
operation(exec_server_url).await
|
||||
operation(exec_server_url, wine_prefix).await
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
|
||||
WineExecServer
|
||||
.scope(|exec_server_url| async move {
|
||||
.scope(|exec_server_url, _wine_prefix| async move {
|
||||
let mut command = Command::new(test_binary);
|
||||
command
|
||||
.env(TEST_ENVIRONMENT_ENV_VAR, "wine-exec")
|
||||
|
||||
Reference in New Issue
Block a user