codex: resolve config read cwd relative to process

This commit is contained in:
pakrym-oai
2026-04-06 23:14:55 -07:00
parent a215cfe658
commit a958a1741a
2 changed files with 15 additions and 1 deletions

View File

@@ -156,7 +156,7 @@ impl ConfigService {
) -> Result<ConfigReadResponse, ConfigServiceError> {
let layers = match params.cwd.as_deref() {
Some(cwd) => {
let cwd = AbsolutePathBuf::try_from(PathBuf::from(cwd)).map_err(|err| {
let cwd = AbsolutePathBuf::relative_to_current_dir(cwd).map_err(|err| {
ConfigServiceError::io("failed to resolve config cwd to an absolute path", err)
})?;
crate::config::ConfigBuilder::default()

View File

@@ -232,6 +232,20 @@ async fn read_includes_origins_and_layers() {
));
}
#[tokio::test]
async fn read_accepts_relative_cwd() {
let tmp = tempdir().expect("tempdir");
let service = ConfigService::without_managed_config_for_tests(tmp.path().to_path_buf());
service
.read(ConfigReadParams {
include_layers: false,
cwd: Some(".".to_string()),
})
.await
.expect("relative cwd should resolve");
}
#[cfg(target_os = "macos")]
#[tokio::test]
async fn write_value_succeeds_when_managed_preferences_expand_home_directory_paths() -> Result<()> {