refactor(codex): PathResolver::new takes a required home argument - #207
Open
ecalifornica wants to merge 2 commits into
Open
refactor(codex): PathResolver::new takes a required home argument#207ecalifornica wants to merge 2 commits into
ecalifornica wants to merge 2 commits into
Conversation
|
🔍 Preview deployed: https://3586681d.toolpath.pages.dev |
ecalifornica
force-pushed
the
robert/config-codex
branch
from
August 14, 2026 19:49
ee7b057 to
1bb7c5b
Compare
ecalifornica
marked this pull request as ready for review
August 17, 2026 17:06
toolpath-codex reads no environment variable. The caller supplies the home directory; the crate keeps the layout below it (`<home>/.codex`). Library (breaking, 0.7.0): - `PathResolver::new(home)` takes the home directory as a required argument. `CodexConvo::new(home)` and `ConvoIO::new(home)` take the same argument. - Delete the `Default` impls on the three types, `with_home`, the private `dirs::home_dir` helper, and the `NoHomeDirectory` error variant. - Keep `with_codex_dir` as the full override. - The home directory is always present, so `home_dir()`, `codex_dir()`, `sessions_root()`, `history_file()`, `log_file()`, and `ConvoIO::codex_dir_path()` return a path, not a `Result`. Callers inside the crate drop the dead error arms. - Strict rollout parsing is a `bool` parameter. `RolloutReader::read_session_with(path, strict)` takes it directly. `ConvoIO::with_strict` and `CodexConvo::with_strict` store it and pass it down. `RolloutReader::read_session(path)` stays lenient. path-cli: - `providers::codex_resolver` returns `Option<PathResolver>`. `None` means `Config` carries no home directory, so Codex is out of reach. - `harness_bundle` omits the Codex manager in that case. - `providers::require_codex_resolver` reports "cannot determine the home directory" for the 5 commands that target Codex. - `Config` reads `$CODEX_ROLLOUT_STRICT`. `providers::codex_strict` turns its presence into the flag every `CodexConvo` receives, so the variable keeps its behavior for CLI users. Version bump per the release checklist: crate manifest, workspace dependency, site/_data/crates.json, CHANGELOG.md.
…nt (#185) The variant is declared and matched in path-cli's is_not_found_codex but constructed nowhere. Deleting a public enum variant is breaking; it rides the toolpath-codex 0.7.0 bump on this branch.
ecalifornica
force-pushed
the
robert/config-codex
branch
from
August 18, 2026 20:09
1bb7c5b to
cf23ee6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #185: the crate reads no environment variable,
Configowns every read, and the caller supplies what the crate used to resolve itself.PathResolver::new(home)takes the home directory as a required argument. The crate keeps the layout knowledge (<home>/.codex); the caller owns "what is home". With the home always present, the pure path accessors drop theirResultand theDefaultimpls go with them.Judgment calls:
read_session(path)stays lenient. Context: a rollout file is a Codex session log (~/.codex/sessions/**/rollout-*.jsonl), and a writer can leave a truncated last line. The short spelling of the API keeps the crash-tolerant read; strict is an explicit opt-in viawith_strict(bool)orread_session_with(path, strict).$CODEX_ROLLOUT_STRICTset, whatever its value. This matches the deletedstd::env::var(...).is_ok()check exactly.Configstores the rawOption<String>;providers::codex_strictowns the presence-is-the-signal interpretation. The variable keeps its behavior for CLI users.providers::codex_resolverreturnsOption<PathResolver>, the harness bundle silently omits Codex, and the 5 commands that target Codex error throughrequire_codex_resolver. This is a behavior decision, not part of the mechanical refactor.CodexDirectoryNotFoundseparately: it turned out to be constructed nowhere, so its removal is independent of the home change.Both commits are breaking for
toolpath-codexand ride one 0.7.0 bump. The CHANGELOG lists the affected API.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.