refactor(codex): PathResolver::new takes a required home argument - #207
Draft
ecalifornica wants to merge 2 commits into
Draft
refactor(codex): PathResolver::new takes a required home argument#207ecalifornica wants to merge 2 commits into
ecalifornica wants to merge 2 commits into
Conversation
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.
|
🔍 Preview deployed: https://e0593d1f.toolpath.pages.dev |
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.
toolpath-codexreads no environment variable. The caller supplies the home directory and the strict-parsing flag. The crate keeps the layout below the home directory: Codex data is in<home>/.codex.toolpath-codex, breaking, 0.7.0
PathResolver::new(home)takes the home directory as a required argument.CodexConvo::new(home)andConvoIO::new(home)take the same argument.Defaultimpls onPathResolver,ConvoIO, andCodexConvo;PathResolver::with_home; the privatedirs::home_dirhelper; theNoHomeDirectoryerror variant.with_codex_dirstays as the full override.Result. The CHANGELOG lists them.list_rollout_filesandfind_rollout_filekeep theirResult. Their error is a failed directory read or an unresolved session id, not a missing home.Strict rollout parsing:
~/.codex/sessions/**/rollout-*.jsonl). Lenient reading skips a line it cannot parse; strict reading reports the line as an error. The flag is in this PR because$CODEX_ROLLOUT_STRICTselects it, and this refactor moves every environment read out of the crate.RolloutReader::read_session_with(path, strict)takes the flag directly.RolloutReader::read_session(path)stays lenient.ConvoIO::with_strict(bool)andCodexConvo::with_strict(bool)store the flag, default false, and pass it to the reader.path-cli
providers::codex_resolverreturnsOption<PathResolver>.NonemeansConfigcarries no home directory, so the Codex harness is out of reach.harness_bundleomits the Codex manager when the resolver isNone.providers::require_codex_resolverturnsNoneinto an error. The 5 commands that target Codex use it:p list codex,p import codex,p export codex --project,show codex, and the single-session derive.Configreads$CODEX_ROLLOUT_STRICT.providers::codex_strictturns its presence into the flag everyCodexConvoreceives, so the variable keeps its behavior for CLI users.Second commit: delete the unused
CodexDirectoryNotFoundvariantis_not_found_codex, but constructed nowhere.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.