Skip to content

[ENHANCEMENT] Add opt-in WebSocket mode for ChatGPT subscription Codex #1963

Description

@WebMad

Problem (one or two sentences)

Zoo Code's OpenAI Codex provider uses HTTP streaming for ChatGPT subscriptions. Multi-step tasks can repeatedly send large conversation histories instead of reusing an established connection and continuing from the previous response.

Context (who is affected and when)

Users authenticated through a ChatGPT subscription, especially during long tasks with repeated tool calls. The API-key OpenAI providers are outside this request's scope.

Desired behavior (conceptual, not technical)

Offer a saved “Use WebSocket” checkbox for OpenAI Codex. When enabled, reuse the connection and send only new conversation items when continuation is valid, while preserving text, reasoning, tool calls, usage reporting, and cancellation.

Constraints / preferences (optional)

  • Disabled by default and saved per provider profile only after clicking Save.
  • Keep the transport isolated from existing provider event handling.
  • Fall back to HTTP when the WebSocket upgrade fails; never automatically replay an ambiguously accepted request.
  • Full context remains necessary after reconnects, compaction, changed settings, or actual history edits.
  • Preserve encrypted reasoning alongside visible summaries, including for HTTP providers.

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Acceptance criteria (optional)

  • The checkbox survives Save, reload, profile switching, and configuration import/export.
  • Compatible follow-up requests reuse the socket and previous response, sending only new input.
  • A server cache miss permits one full-context resend before any response event arrives.
  • Stop, timeouts, failed/incomplete responses, and disconnects terminate the stream safely.
  • Authentication changes and connection expiry reconnect with full context.
  • Existing HTTP behavior remains available when the preference is disabled or the upgrade cannot be established.
  • Automated tests cover protocol behavior, provider integration, settings persistence, and light/dark UI states.

Proposed approach (optional)

Use a dedicated class-based transport with separate connection, continuation, history snapshot, request scope, and response responsibilities. Reuse the provider's existing Responses event processor and OAuth credentials.

Trade-offs / risks (optional)

The ChatGPT subscription endpoint uses a Codex-specific WebSocket beta protocol and may evolve independently of the public API-key endpoint. This is an opt-in setting; cancellation or disconnect after sending a request must not silently replay it over HTTP.

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