Skip to content

OpenAI: integrate Sign in with ChatGPT plan usage through Codex app-server #76

Closed

Description

@CompleteDotTech

User outcome and triage

A user can choose Continue with ChatGPT inside Modex, authorize this local app, and run coding turns through Codex app-server using that grant.

Priority: P2 (normal); type: enhancement; status: design-ready, implementation gated on the network-boundary decision below. Official documentation establishes the integration; compatibility with Modex's installed CLI versions and real account entitlement has not been tested.

This specifically covers the new app-owned Sign in with ChatGPT registration. Existing Codex CLI login and app-server account/login/start are a separate credential mode; presenting that old flow alone does not complete this issue.

Verified integration and architecture decision

The open-source overview documents local/open-source use; paid or remotely hosted distribution has a separate access process. Registration provides public-client OAuth with PKCE and dynamic registration. Codex integration explicitly supports passing the app's token to a Codex child process, so coding execution can remain CLI-owned.

AGENTS.md currently limits non-CLI networking to the optional routing judge. Before implementation, record a maintainer decision permitting narrowly scoped authentication/discovery/token-refresh/revocation traffic, and update that rule in the implementation PR. Keep model execution in Codex; no direct Modex Responses backend. If that exception is declined, retain a documented CLI-login-only alternative and close or rescope this request explicitly.

Acceptance criteria

  • Provide a capability-gated account/settings flow, showing the selected auth mode, active account/workspace registration, plan-use permission, and a link to provider usage controls. Preserve the user's existing CLI-login option.
  • Implement the documented system-browser public-client flow with fresh state, nonce and S256 PKCE; a loopback-only listener, bounded cancellation/timeout, and callback replay/error handling. Use the specified 127.0.0.1 callback rules and exact per-attempt redirect URI.
  • Persist a stable host identifier. Use the registration entrypoint only initially; retain the issued client ID for each validated account/workspace registration and returning login. Validate ID-token signature/issuer/audience/expiry/nonce and returned plan-use scopes before activating credentials. Reject mismatched returning accounts/client IDs.
  • Keep credential ownership in Electron main and protected OS-backed storage, with atomic updates and no plaintext fallback. No tokens in renderer IPC, localStorage, state.json, logs, support exports, command arguments, or unrelated child environments.
  • Use the documented app-server Responses-provider configuration and app attribution. Pass only the selected grant to the intended child. Verify supported Codex versions and current preview limitations.
  • Implement account/session lifecycle: serialize rotating-token refreshes across consumers, isolate registrations, and distinguish local sign-out from confirmed remote revocation. Failed/cancelled login must retain the previous valid account.
  • Coordinate token renewal and account switching with all active and initializing turns. The current backend shares one child; define an account-bound process/drain strategy before coding. Never kill unrelated turns, switch a running turn's identity, mix account histories, or replay completed tool actions. Resume saved threads only under their matching account context.
  • Test denied consent, invalid/replayed callback, missing scope, storage failure, refresh races, revoked sessions, concurrent turns, account switch, and offline sign-out with fixtures. Add UI e2e and a separately authorized real sign-in -> completed turn -> token renewal -> resumed turn verification on the supported release platform. Catalog visibility alone is not proof of entitlement.
  • Update README and docs/status.md; complete normal build/unit/UI gates and record remaining account/platform limitations.

Dependencies

Depends on #75 for trustworthy status. Coordinate with PR #68, which already owns stale CLI-auth recovery and retry cards. Reconcile that work rather than adding a second retry controller. The authentication-network exception and version/eligibility checks are implementation gates, not reasons to block design.

Suggested labels: enhancement. Priority and dependency triage are recorded above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions