Repository navigation
fix(codex): look up session files under CODEX_HOME - #364
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
zpzjzj
left a comment
There was a problem hiding this comment.
The CODEX_HOME lookup change looks correct. Checked environment propagation and the default/custom/missing-session cases, including paths containing spaces; CI, Extended CI, and CodeQL are green. Local shell checks passed; full local Go validation was unavailable because this environment has no usable Go toolchain.
Merge sequencing: please merge #361 first (or include its parser fix before merging this PR). #361 is still open: without it, discovering the session under CODEX_HOME can switch selection from the stream to a session transcript that drops code-tool MCP/command calls. Holding queue entry until that dependency is satisfied.
|
Thanks. Agreed on the order. Once #361 is merged I'll rebase this onto main; the conflict is just the CHANGELOG line and one import block. |
Codex writes its session files under $CODEX_HOME, which defaults to $HOME/.codex. The lookup always searched $HOME/.codex/sessions, so a run with CODEX_HOME set (for example through environment.env, to keep skill-up's MCP servers out of the user's global Codex config) never found the session file and fell back to the stream transcript. Refs alibaba#360
369d637 to
e411034
Compare
Summary
Codex writes its session files under
$CODEX_HOME, which defaults to$HOME/.codex. skill-up always looked in$HOME/.codex/sessions. A run withCODEX_HOMEset, for example throughenvironment.envto keep skill-up's MCP servers out of the user's global Codex config (#360), never found its session file and fell back to the stream transcript.Related issues
Refs #360. This is the small part. The design for the rest of #360 is proposed on the issue.
Changes
internal/agent/codex.go: the lookup script uses$CODEX_HOME/sessionswhenCODEX_HOMEis set, and$HOME/.codex/sessionsotherwise. The script moved into a constant so a test can run it.internal/agent/codex_test.go: a test runs the script inshagainst temporary folders: withoutCODEX_HOMEit finds the file underHOME, with it it finds the file underCODEX_HOME, and with aCODEX_HOMEthat has no sessions it finds nothing. Skipped on Windows.CHANGELOG.md: one line under Unreleased, Fixed.Test plan
make testpassesmake verify: fmt and vet pass. Lint reports 4 staticcheck SA5011 findings ininternal/agent/custom_test.go, a file this PR does not touch; on my machine cleanmainreports the same 4.CODEX_HOMEcase; with this change it passes.Notes for reviewers
environment.envinto every command it runs, so the lookup sees the sameCODEX_HOMEascodex exec.CHANGELOG.md, Codex tests). I'll rebase whichever of them lands later.