Files
Jiang Bohan 989c11ed7c fix(execenv): keep idempotent codex-home self-heal on reuse
Eve's review on #1147 correctly pointed out that prepareCodexHome is
already idempotent — skipping it on reuse removed the self-heal path
for broken auth.json / sessions symlinks and missing config.toml
without fixing any real bug (perceived 're-init' was superficial,
state was never being churned).

Revert the skip-on-exists branch so reuse continues to repair a
partially corrupt codex-home. Document the actual semantics in code
and in CLI_AND_DAEMON.md: content is preserved (user edits, rollouts,
per-session cache), links and missing scaffolding are repaired.

Replace the misleading preservation test with two tighter ones:
- TestReuseIsIdempotentForCodexHome locks in that user edits and
  accumulated rollouts survive reuse.
- TestReuseHealsCorruptedCodexHome covers the regression Eve called
  out: reuse must still heal a codex-home that lost its sessions
  symlink, auth.json link, and config.toml.
2026-04-16 17:40:10 +08:00
..