Skip to content

feat: support CODEX_HOME override#51

Merged
Loongphy merged 5 commits intoLoongphy:mainfrom
DRanger666:feat/codex-home-override
Apr 15, 2026
Merged

feat: support CODEX_HOME override#51
Loongphy merged 5 commits intoLoongphy:mainfrom
DRanger666:feat/codex-home-override

Conversation

@DRanger666
Copy link
Copy Markdown
Contributor

@DRanger666 DRanger666 commented Apr 11, 2026

Summary

  • Align codex-auth with Codex's CODEX_HOME behavior.
  • When CODEX_HOME is set, use it as the active Codex state root; otherwise fall back to HOME/.codex, then USERPROFILE/.codex on Windows.
  • Match Codex semantics by requiring an explicit CODEX_HOME to point to an existing directory.

Notes

  • Managed service definition files do not move into CODEX_HOME.
  • Linux systemd --user units, macOS LaunchAgent plists, and the Windows scheduled task still live in the platform-standard per-user locations.
  • The managed watcher process now keeps using the same codex_home that was active when config auto enable ran.

What Changed

  • add CODEX_HOME validation and canonicalization in the Codex home resolver
  • forward the active codex_home into managed watcher startup on Linux and macOS
  • pass an explicit --codex-home argument to the Windows helper task
  • add resolver coverage for explicit CODEX_HOME
  • add e2e coverage for HOME != CODEX_HOME
  • update docs to reflect the actual service-definition and watcher behavior

Validation

  • zig build run -- list
  • zig test src/main.zig -lc --test-filter "resolveCodexHomeFromEnv"
  • zig test src/main.zig -lc --test-filter "persistent daemon watcher"
  • zig test src/main.zig -lc --test-filter "mac plist"
  • zig test src/main.zig -lc --test-filter "windows task"
  • zig test src/main.zig -lc --test-filter "CODEX_HOME override when running login"

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 11, 2026

Open in StackBlitz

@loongphy/codex-auth-darwin-arm64

npx https://pkg.pr.new/@loongphy/codex-auth-darwin-arm64@51

@loongphy/codex-auth-darwin-x64

npx https://pkg.pr.new/@loongphy/codex-auth-darwin-x64@51

@loongphy/codex-auth-linux-arm64

npx https://pkg.pr.new/@loongphy/codex-auth-linux-arm64@51

@loongphy/codex-auth-linux-x64

npx https://pkg.pr.new/@loongphy/codex-auth-linux-x64@51

@loongphy/codex-auth-win32-arm64

npx https://pkg.pr.new/@loongphy/codex-auth-win32-arm64@51

@loongphy/codex-auth-win32-x64

npx https://pkg.pr.new/@loongphy/codex-auth-win32-x64@51

@loongphy/codex-auth

npx https://pkg.pr.new/@loongphy/codex-auth@51

commit: d3645be

@Loongphy
Copy link
Copy Markdown
Owner

Thanks for your contribution.

It was supported in early versions but was removed in a later release. It's meaningful and also convenient for testing, let's restore it.

@DRanger666
Copy link
Copy Markdown
Contributor Author

I pushed a follow-up commit (8737d12) that fixes the Windows CI failure by making the test path expectation platform-aware instead of hardcoding a POSIX-style path.

@Loongphy Loongphy merged commit 60e6af7 into Loongphy:main Apr 15, 2026
11 checks passed
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