Skip to content

[Feature Request / RFC] Research MCP-based Model Gateway to resolve conversation context loss when switching between multiple ChatGPT accounts #784

Open

Description

@Draculabo

Background

WebCodex can currently connect ChatGPT with the local WebCodex Server / Runner / Project via the OpenAI Secure MCP Tunnel.

For a single ChatGPT account, this setup maintains good continuity of the local development environment, including:

  • Project
  • Runner
  • Git working tree
  • Workflow / Job state
  • Local code and test environment

However, users with multiple ChatGPT accounts face a notable pain point when switching accounts:

  • ChatGPT Account A has its own Tunnel and ChatGPT conversation session
  • ChatGPT Account B has its own Tunnel and ChatGPT conversation session
  • When Account A’s quota is temporarily exhausted, the user needs to switch to Account B
  • Account B can still connect to the same WebCodex project and local development environment
  • But switching accounts creates a brand-new ChatGPT conversation session. All accumulated conversation context, working memory, decisions, and project discussion from Account A are lost and cannot be carried over to the new session under Account B.

WebCodex can already preserve:

Code workspace continuity

But it cannot preserve:

AI conversation / reasoning context continuity

This limitation becomes prominent for multi-hour or multi-day coding workflows.


Direction for Investigation

I would like maintainers to evaluate an architecture alternative to "multiple accounts connecting to separate WebCodex Tunnels":

Can WebCodex expose an MCP Model Gateway / Model Delegation capability, so that when a user switches login from Account A to Account B, there is no need to rebuild the project session. WebCodex persists and serves the full project context. The new ChatGPT session under Account B can load the complete historical project information to resume the conversation seamlessly.

High-level architecture sketch:

                   ChatGPT (Account A → Account B)
                        │
                        │ MCP
                        ▼
               ┌─────────────────┐
               │    WebCodex     │
               │   Model Gateway │
               └────────┬────────┘
                        │
             ┌──────────┼──────────┐
             ▼          ▼          ▼
          Model A    Model B    Model C

Concept:

  • WebCodex persists the project session context
  • Users may switch login between different ChatGPT accounts
  • After switching to a new account, the newly created ChatGPT session loads full project history from WebCodex via MCP
  • The user only needs to type "continue" to resume prior work from Account A without re-stating all background details
  • WebCodex also provides model delegation to invoke different backend models on demand for tasks

Related reference project:
https://github.com/miuuyy/codex-chatgpt-web

This project bridges ChatGPT Web models for use by Codex. It is not a requirement for WebCodex to adopt its implementation; it validates a promising direction: wrapping ChatGPT Web / other model sources as independent model backends that can be invoked by the upper-layer coding agent.

With this capability, WebCodex could evolve from this simple topology:

ChatGPT
    │
    │ MCP
    ▼
WebCodex
    │
    ▼
Runner / Project

Into this extended topology:

                    ChatGPT (Account A / Account B)
                        │
                        │ MCP
                        ▼
                  ┌───────────┐
                  │ WebCodex  │
                  └─────┬─────┘
                        │
           ┌────────────┴────────────┐
           │                         │
           ▼                         ▼
    Coding / Project Tools       Model Gateway
           │                         │
           ▼                  ┌──────┼──────┐
    Runner / Git / Shell       ▼      ▼      ▼
                            Model A Model B Model C

Expected User Experience

The user works extensively in ChatGPT Account A: debugging, discussing implementation, writing code. All project-related context is persisted inside WebCodex’s project session.

When Account A hits quota limits, the user switches browsers to log into ChatGPT Account B and opens a fresh ChatGPT conversation:

User: continue

ChatGPT on Account B loads the full persisted project session context from WebCodex via MCP — pulling objectives, task history, prior decisions, implementation state, git state, test results, etc. The workflow resumes seamlessly from the work done on Account A.

Later the user may request to use an alternative backend model:

User: Based on the current project state, run an independent review using the external Pro model.

ChatGPT may invoke a tool call similar to:

delegate_model(
    model = "pro",
    task = "...",
    context = "...",
    session = "current-project"
)

WebCodex responsibilities:

  • Select the appropriate model backend
  • Inject the persisted WebCodex project context
  • Submit the task
  • Retrieve results
  • Return results back to the active ChatGPT session

The active ChatGPT session continues reasoning using the loaded project context.

Key outcome: switching ChatGPT accounts does not lose project history. The user only needs to enter "continue" to resume work.

Proposed MCP API Sketch

These are illustrative examples only, not a requirement for implementation.

list_models

{
  "models": [
    {
      "id": "model-a-pro",
      "provider": "account-a",
      "status": "available"
    },
    {
      "id": "model-b-high",
      "provider": "account-b",
      "status": "available"
    }
  ]
}

delegate_model

{
  "model": "model-a-pro",
  "task": "Review the current implementation",
  "context": "...",
  "session_id": "project-123"
}

Response:

{
  "result": "...",
  "model": "model-a-pro"
}

Potential additional methods:
list_models delegate_model get_model_status create_model_session continue_model_session close_model_session

Context / Memory

A critical design consideration: Neither the delegated model’s own conversation history nor ChatGPT account-side native project sessions should be trusted as WebCodex’s long-term project memory.

While ChatGPT-native project and conversation context can serve as a temporary carrier, there is a significant risk: if that ChatGPT account expires, gets restricted, hits quota limits or is terminated, all project and conversation data stored on the ChatGPT account side will be lost together.

Therefore WebCodex should maintain its own independent project/session context, containing items such as:
Project Session

  • objective
  • current task
  • important decisions
  • implementation state
  • git state
  • relevant files
  • test results
  • previous delegated model summaries

The complete continuous development context is formed by three components:

Active ChatGPT conversation

  • WebCodex project/session context
  • local repository state

Delegated models only process the supplied task payload and do not persist project memory.
Even as backend models are switched sequentially: Model A ↓ Model B ↓ Model C, or a ChatGPT account becomes unavailable, the project context persisted locally in WebCodex remains stable and decoupled from account lifecycle.

Why not simply implement Multi-Tunnel Profiles

An obvious alternative approach:

  • Account A -> tunnel_A
  • Account B -> tunnel_B
  • Account C -> tunnel_C

With support for quick tunnel switching inside WebCodex.
This solves connection management, but it does not solve the core problem:

ChatGPT conversations are bound to their owning account. After switching accounts, the full conversation context from the prior account cannot automatically transfer into the new account.

Multi-Tunnel Profiles addresses:

connection continuity

The Model Gateway / Delegation approach, backed by WebCodex’s persisted project context, addresses:

cross-account conversation continuity + model switching

I would like maintainers to evaluate the tradeoffs and implementation costs of both approaches.

Future Extensible Capabilities

If this direction is viable, a model routing layer could be added:

delegate_model(
    capability = "pro"
)

Instead of requiring users to specify a concrete backend.

Example routing logic:

  • Pro Backend A ↓ unavailable / quota exhausted
  • Pro Backend B ↓ available → use Backend B

The active ChatGPT conversation only needs to express intent:

"Use an available Pro model to complete this task"

No need to track which concrete backend is used.
This abstraction can future-proof integration with:

  • OpenAI API
  • ChatGPT-backed models
  • Anthropic
  • Gemini
  • Local models
  • Other model gateways

Summary of Core Requirements

The core requirement is not merely multi-account tunnel switching:

During long-running coding workflows, users can switch between ChatGPT accounts. After switching accounts, the newly created ChatGPT session loads WebCodex’s persisted project context. The user can type "continue" to resume work seamlessly. The system also supports delegating reasoning tasks to different models while preserving project state and development context.

Ideal topology:

                     ChatGPT (Account A → Account B)
                   new chat session on B
                          │
                          ▼
                       WebCodex
                   /              \
                  /                \
         Project / Runner        Models
              │              /      |      \
              ▼             A       B       C
         Git / Shell         Files / Tests

After switching to Account B and opening a new ChatGPT conversation, the user loads WebCodex’s saved project session via MCP and continues development work originally started under Account A. WebCodex provides both project execution tools and external model delegation.

I am unsure whether this direction aligns with WebCodex’s current design goals and would appreciate maintainer assessment of the requirements and possible implementation paths.

Thanks.

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