Skip to content

refactor(codex): PathResolver::new takes a required home argument - #207

Draft
ecalifornica wants to merge 2 commits into
robert/config-geminifrom
robert/config-codex
Draft

refactor(codex): PathResolver::new takes a required home argument#207
ecalifornica wants to merge 2 commits into
robert/config-geminifrom
robert/config-codex

Conversation

@ecalifornica

@ecalifornica ecalifornica commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Part of #185.

toolpath-codex reads 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) and ConvoIO::new(home) take the same argument.
  • Deleted: the Default impls on PathResolver, ConvoIO, and CodexConvo; PathResolver::with_home; the private dirs::home_dir helper; the NoHomeDirectory error variant.
  • with_codex_dir stays as the full override.
  • The home directory is always present, so the 6 pure path accessors return a path instead of a Result. The CHANGELOG lists them.
  • list_rollout_files and find_rollout_file keep their Result. Their error is a failed directory read or an unresolved session id, not a missing home.

Strict rollout parsing:

  • Context: a rollout file is a Codex session log (~/.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_STRICT selects 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) and CodexConvo::with_strict(bool) store the flag, default false, and pass it to the reader.
  • The crate reads no environment variable for it.

path-cli

  • providers::codex_resolver returns Option<PathResolver>. None means Config carries no home directory, so the Codex harness is out of reach.
  • harness_bundle omits the Codex manager when the resolver is None.
  • providers::require_codex_resolver turns None into 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.
  • 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.

Second commit: delete the unused CodexDirectoryNotFound variant

  • 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 same 0.7.0 bump.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

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.
@github-actions

Copy link
Copy Markdown

🔍 Preview deployed: https://e0593d1f.toolpath.pages.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant