chore: enusre the logic that creates ConfigLayerStack has access to cwd (#8353)

`load_config_layers_state()` should load config from a
`.codex/config.toml` in any folder between the `cwd` for a thread and
the project root. Though in order to do that,
`load_config_layers_state()` needs to know what the `cwd` is, so this PR
does the work to thread the `cwd` through for existing callsites.

A notable exception is the `/config` endpoint in app server for which a
`cwd` is not guaranteed to be associated with the query, so the `cwd`
param is `Option<AbsolutePathBuf>` to account for this case.

The logic to make use of the `cwd` will be done in a follow-up PR.
This commit is contained in:
Michael Bolin
2025-12-19 20:11:27 -08:00
committed by GitHub
parent f0dc6fd3c7
commit a6974087e5
12 changed files with 143 additions and 44 deletions

View File

@@ -34,6 +34,11 @@ impl AbsolutePathBuf {
Ok(Self(absolute_path.into_owned()))
}
pub fn current_dir() -> std::io::Result<Self> {
let current_dir = std::env::current_dir()?;
Self::from_absolute_path(current_dir)
}
pub fn join<P: AsRef<Path>>(&self, path: P) -> std::io::Result<Self> {
Self::resolve_path_against_base(path, &self.0)
}