Fix linked worktree hook loading when the root .codex is a file (#63088)

## Why

When `.codex` in the root checkout is a regular file, reading
`.codex/config.toml` returns `NotADirectory`. That error aborts project
configuration loading for the linked worktree.

## What changed

Treat `NotADirectory` like a missing config when reading project hook
configuration from the root checkout.

## Testing

Cover a linked worktree that keeps its local project settings and inherits
hooks from the matching subdirectory in the root checkout even when the
root checkout's top-level `.codex` is a file.

GitOrigin-RevId: 2cb7fcb340ce85253641c016dace5177096ba205
This commit is contained in:
Eric Traut
2026-11-22 07:01:32 +00:00
committed by copyberry
parent 618d501ea0
commit e1ecb5c8fc
2 changed files with 26 additions and 9 deletions
+6 -1
View File
@@ -2076,7 +2076,12 @@ async fn load_root_checkout_project_config(
};
parsed
}
Err(err) if err.kind() == io::ErrorKind::NotFound => {
Err(err)
if matches!(
err.kind(),
io::ErrorKind::NotFound | io::ErrorKind::NotADirectory
) =>
{
TomlValue::Table(toml::map::Map::new())
}
Err(err) => {