Skip to content

feat: add official Codex ChatGPT support#79

Open
Pelican0126 wants to merge 1 commit into
OpenCoworkAI:mainfrom
Pelican0126:feat/codex-chatgpt-official
Open

feat: add official Codex ChatGPT support#79
Pelican0126 wants to merge 1 commit into
OpenCoworkAI:mainfrom
Pelican0126:feat/codex-chatgpt-official

Conversation

@Pelican0126
Copy link
Copy Markdown

Summary

  • add an official codex_chatgpt provider flow that uses the Codex CLI login status and shared ChatGPT auth instead of API keys or unofficial session scraping
  • fix Windows Codex login UX and execution by resolving global CLI installs, handling .cmd launch correctly, and surfacing browser, device-auth, and logout guidance in the settings UI
  • refresh Codex model handling to use current official models with a docs-backed refresh fallback, and fix packaged renderer asset paths so logos load correctly in desktop builds

Testing

  • npm run typecheck
  • npm run lint
  • npx vitest run

Use the official Codex CLI auth flow with Windows login fixes.

Refresh Codex models and fix packaged asset paths for desktop builds.
@hqhq1025 hqhq1025 closed this Apr 13, 2026
@hqhq1025 hqhq1025 reopened this Apr 13, 2026
@hqhq1025 hqhq1025 closed this Apr 14, 2026
@hqhq1025 hqhq1025 reopened this Apr 14, 2026
@hqhq1025 hqhq1025 added bot-rerun Temporary label for rerunning bot automation and removed bot-rerun Temporary label for rerunning bot automation labels Apr 27, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Major] Codex mode bypasses Open Cowork's WSL/Lima isolation. processPrompt() now skips ensureSandboxInitialized() for codex_chatgpt, while the new runner only launches Codex with its host-side workspace-write sandbox. Evidence: src/main/session/session-manager.ts:632, src/main/codex/codex-cli.ts:150.
    Suggested fix:

    // Codex still needs the app-level WSL/Lima bootstrap.
    await this.ensureSandboxInitialized(session);
  • [Major] Existing sessions can switch backends after a provider change. getActiveRunner() is resolved from the current global config, so continuing a session after saving a different provider can route the next turn through the wrong backend and break claudeSessionId / openaiThreadId continuity. Evidence: src/main/session/session-manager.ts:156, src/main/session/session-manager.ts:697.
    Suggested fix:

    private getRunnerForSession(session: Session): AgentRunner {
      if (session.openaiThreadId && !session.claudeSessionId) return this.codexRunner;
      if (session.claudeSessionId && !session.openaiThreadId) return this.agentRunner;
      return configStore.get('provider') === 'codex_chatgpt' ? this.codexRunner : this.agentRunner;
    }
    
    await this.getRunnerForSession(session).run(session, enhancedPrompt, messagesForContext);

Summary

Review mode: initial. Found 2 issues in the Codex integration: one security regression around sandbox isolation and one session-continuity regression when the active provider changes.

Testing

Not run (automation)

Open Cowork Bot

logCtx('[SessionManager] Enhanced prompt with file info:', enhancedPrompt);
// Ensure sandbox is initialized for this workspace unless the active
// provider manages its own execution sandboxing.
if (configStore.get('provider') !== 'codex_chatgpt') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MAJOR] Skipping ensureSandboxInitialized() here drops Codex requests out of the existing WSL/Lima flow entirely. The new runner only launches Codex with its own host-side workspace-write sandbox (src/main/codex/codex-cli.ts:150), so switching to Codex weakens the app's documented VM-level isolation.

Suggested fix:

// Codex still needs the app-level WSL/Lima bootstrap.
await this.ensureSandboxInitialized(session);

}

// Run the agent
await this.getActiveRunner().run(session, enhancedPrompt, messagesForContext);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MAJOR] This backend choice is global, not session-bound. If a user starts a Claude session, saves settings to Codex (or the reverse), and then continues the old conversation, the next turn will run through the wrong runner and lose the existing claudeSessionId / openaiThreadId continuity.

Suggested fix:

private getRunnerForSession(session: Session): AgentRunner {
  if (session.openaiThreadId && !session.claudeSessionId) return this.codexRunner;
  if (session.claudeSessionId && !session.openaiThreadId) return this.agentRunner;
  return configStore.get('provider') === 'codex_chatgpt' ? this.codexRunner : this.agentRunner;
}

await this.getRunnerForSession(session).run(session, enhancedPrompt, messagesForContext);

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