feat: seamless account switching without restarting the app#103
Open
Loongphy wants to merge 16 commits into
Open
feat: seamless account switching without restarting the app#103Loongphy wants to merge 16 commits into
Loongphy wants to merge 16 commits into
Conversation
# Conflicts: # docs/commands/README.md # src/cli/commands/root.zig # src/cli/help.zig # src/cli/types.zig # src/workflows/preflight.zig
@loongphy/codex-auth-darwin-arm64
@loongphy/codex-auth-darwin-x64
@loongphy/codex-auth-linux-arm64
@loongphy/codex-auth-linux-x64
@loongphy/codex-auth-win32-arm64
@loongphy/codex-auth-win32-x64
@loongphy/codex-auth
commit: |
# Conflicts: # src/cli/commands/root.zig # src/cli/help.zig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces
codex-auth appsupport, enabling seamless Codex App account switching without requiring a restart of the desktop application.By leveraging the official
CODEX_CLI_PATHenvironment variable for each launch, this integration routes the Codex App through a customized, enhanced version of thecodex-clibinary (namedcodext) that handles active session hot-swapping, cache invalidation, and UI synchronization automatically.Key Features
CODEX_HOMEandCODEX_CLI_PATH.Technical Implementation
Non-Invasive Hooking via
CODEX_CLI_PATHThe Codex desktop app launches its local app-server through a backend helper CLI, allowing its location to be overridden via the
CODEX_CLI_PATHenvironment variable.Rather than modifying the closed-source desktop application bundle or installing a persistent app patch, this PR utilizes this built-in hook by setting
CODEX_CLI_PATHfor the launched process to point to a custom, optimized binary replacement for the originalcodex-cli- specifically, the forkedcodextbuild from Loongphy/codext.Core Engine Enhancements (Loongphy/codext@a504dcc)
thread/start,thread/resume, andturn/start. Reloads are explicitly deferred while a turn is actively running to prevent hot-swapping in-flight requests.AccountUpdatedevent so that the desktop user interface instantly aligns with the new account snapshot.Managed CLI Resolution
When
--codex-cli-pathis omitted,codex-auth appresolves the latest compatiblecodextrelease asset for the selected platform, caches it underCODEX_HOME/accounts/codext-cli, and uses that managed binary as the launch-specificCODEX_CLI_PATHtarget. The command does not reuse an unrelatedCODEX_CLI_PATHvalue from the current shell.Usage & CLI Reference
Command Syntax
Command Details
codex-auth app: Launches the Codex App. By default, it starts the app quietly via the platform GUI launcher without locking the terminal.Options & Parameters
--app-path <path>OpenAI.CodexAppX package on Windows, andcom.openai.codexbundle on macOS).--codex-cli-path <path>CODEX_CLI_PATHto use the customcodextbinary. If omitted,codex-authautomatically resolves and downloads the latest compatiblecodextasset.--codex-home <path>CODEX_HOMEdirectory for cache resolution and launching.--platform <win|wsl|mac>.codex-global-state.jsonand auto-selectwslifrunCodexInWindowsSubsystemForLinuxis true; otherwise, it defaults towin.--std