Skip to content

fix(desktop): persist Codex provider during onboarding - #58589

Open
Nithish-Yenaganti wants to merge 3 commits into
NousResearch:mainfrom
Nithish-Yenaganti:codex/fix-desktop-codex-onboarding-default
Open

Nithish-Yenaganti wants to merge 3 commits into
NousResearch:mainfrom
Nithish-Yenaganti:codex/fix-desktop-codex-onboarding-default

Conversation

@Nithish-Yenaganti

@Nithish-Yenaganti Nithish-Yenaganti commented Jul 5, 2026

Copy link
Copy Markdown

Summary

Fixes fresh Desktop onboarding for OpenAI Codex / ChatGPT login.

The Desktop OAuth worker saved the Codex tokens but did not save the matching provider and default model. Onboarding could then fall back to the first entry returned by /api/model/options, which could make the first session start on an unrelated provider.

Changes

  • Save openai-codex and its current default model after Desktop OAuth completes.
  • Only select a provider when its slug matches the provider the user configured.
  • Map OPENAI_API_KEY to the canonical openai-api provider.
  • Add regression tests for Codex OAuth and API-key onboarding.
  • Preserve the current cancellation-safe, profile-scoped OAuth flow from main.

Testing

npm --workspace apps/desktop run test:ui -- src/store/onboarding.test.ts

Result: 16 tests passed.

Backend coverage is included in:

scripts/run_tests.sh tests/hermes_cli/test_web_oauth_dispatch.py -q

This will also run in CI after the workflow is approved.

Refs #58498
Related: #58527, #56966

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) comp/cli CLI entry point, hermes_cli/, setup wizard provider/openai OpenAI / Codex Responses API labels Jul 5, 2026
@teknium1

Copy link
Copy Markdown
Collaborator

Thanks for isolating the fresh-onboarding path. The premise is confirmed on current main: fetchProviderDefaultModel() falls back to providers[0] when the authenticated slug is absent at apps/desktop/src/store/onboarding.ts:258-260, and the Codex OAuth worker saves tokens but does not persist a model assignment at hermes_cli/web_server.py:9523-9531.

The proposed changes address those exact paths: requiring a slug match prevents unrelated model persistence, OPENAI_API_KEY receives the canonical openai-api candidate, and the worker uses the existing profile-scoped _update_config_for_provider() helper. The added frontend and backend regressions cover both persistence and the missing-provider fallback.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
@Nithish-Yenaganti

Copy link
Copy Markdown
Author

Thanks for the review! The tests pass locally, but CI is still waiting for approval. @teknium1 , could you or another maintainer approve the workflow when you get a chance? Happy to fix anything that comes up.

@Nithish-Yenaganti
Nithish-Yenaganti force-pushed the codex/fix-desktop-codex-onboarding-default branch from 4e28328 to ea94157 Compare August 5, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have provider/openai OpenAI / Codex Responses API sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants