Skip to content

engine/codergen: seed codex auth when HOME is unset#43

Open
danshapiro wants to merge 2 commits intomainfrom
fix/codex-home-fallback
Open

engine/codergen: seed codex auth when HOME is unset#43
danshapiro wants to merge 2 commits intomainfrom
fix/codex-home-fallback

Conversation

@danshapiro
Copy link
Owner

Summary

  • fix codex home discovery for auth/config seeding to work when HOME is unset (common in Windows PowerShell)
  • add fallbacks to USERPROFILE, HOMEDRIVE+HOMEPATH, and os.UserHomeDir()
  • use the same fallback in codexStateBaseRoot() so isolated codex state defaults under the real user home instead of a relative run directory
  • add regression tests for USERPROFILE fallback seeding and state-base fallback

Validation

  • go test ./internal/attractor/engine -run "TestBuildCodexIsolatedEnv_SeedsFromUserProfileWhenHomeUnset|TestCodexStateBaseRoot_FallsBackToUserProfileWhenHomeUnset"
  • go test ./internal/attractor/engine -run "TestCodexStateBaseRoot_FallsBackToUserProfileWhenHomeUnset|TestCodexCLIInvocation_StateRootIsAbsolute"

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41cfd85bd9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1520 to +1521
windowsHomeFromParts(envSliceValue(baseEnv, "HOMEDRIVE"), envSliceValue(baseEnv, "HOMEPATH")),
windowsHomeFromParts(os.Getenv("HOMEDRIVE"), os.Getenv("HOMEPATH")),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate Windows home fallbacks to Windows hosts

codexSourceHome always considers HOMEDRIVE/HOMEPATH, even on Linux/macOS. When HOME and USERPROFILE are unset but those Windows vars are present (for example in mixed-shell or WSL-launched environments), windowsHomeFromParts can return C:\Users\..., which is not an absolute Unix path; this candidate is selected before os.UserHomeDir(), so codexStateBaseRoot() can resolve state under the current working directory with a literal C:\... segment and auth/config seeding will target the wrong directory.

Useful? React with 👍 / 👎.

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.

2 participants