Skip to content

feat(subscription-ai): Community ChatGPT subscription-backed AI (gated) - #2371

Open
HaijieChen wants to merge 5 commits into
OtterMind:mainfrom
HaijieChen:feature/subscription-backed-ai
Open

feat(subscription-ai): Community ChatGPT subscription-backed AI (gated)#2371
HaijieChen wants to merge 5 commits into
OtterMind:mainfrom
HaijieChen:feature/subscription-backed-ai

Conversation

@HaijieChen

Copy link
Copy Markdown

Summary

  • Add Community subscription-backed ChatGPT AI behind packaging/runtime gates (CHAT2DB_PACKAGE_SUBSCRIPTION_AI / CHAT2DB_ENABLE_SUBSCRIPTION_AI), using a pinned Codex app-server path so Chat2DB never stores OAuth tokens.
  • Ship MCP tools/call end-to-end for DB tools, H2 subscription ledger, encrypted legacy API-key secret import (separately gated), and desktop packaging/staging scripts.
  • Frontend: subscription account + dual-zone model config (multi-vendor cards + full API-key CRUD), ready-to-use reasoning effort without opening the model dropdown, and live javaQuery desktop probe.

Commits (on top of main)

  • 00dd7cc fix(subscription-ai): make MCP tools/call work end-to-end on ChatGPT
  • e3e7e3c feat(subscription-ai): add Community subscription frontend UI
  • e6b4da5 feat(subscription-ai): add encrypted legacy API-key secret import
  • 0e10a4d feat(subscription-ai): ready-to-use effort control and dual-zone model config

Product / safety notes

  • Default-off until release gates and platform live-provider evidence pass.
  • SuperGrok subscription login is intentionally out of scope; xAI API-key configs remain available.
  • Do not reintroduce CodeMode/sol models for the first reliable DB-tools track; prefer function-capable models (e.g. gpt-5.5).

Test plan

  • Focused backend tests for MCP bridge, tool executor, subscription runtime, secret-import (tests explicitly enabled; nonzero Surefire counts)
  • Frontend lint / i18n / build:web:community
  • Package staging: bash -n script/package/stage-codex-app-server.sh + test-codex-app-server-staging.sh
  • Local Preview (gated ON): connect ChatGPT subscription → model list → ready-to-use effort control → chat send
  • Live DB tools path: list schema / execute_sql via MCP tools/call (no token leakage in logs)
  • Confirm secret-import remains separately gated and does not run by default
  • Confirm web/headless paths stay Community-safe and subscription surface stays desktop-gated

Source

Wire the subscription Codex app-server path so allowlisted DB tools reach
the loopback MCP bridge: answer serverRequests with correct shapes
(requestUserInput answers, permissions decision), allow MCP functionCall
namespace, keep CodeMode off, sandbox network for tools/call, and stop
text2sql from nested API-key chatSync fencing the attempt. Live gpt-5.5
verified list/schema/execute_sql tool_ok; text2sql delegated under tests.
Add subscription account panel, model selection groups, migration wizard,
attempt banners, and Zustand store with i18n for the ChatGPT-backed path.
Wire AI chat input/select and settings so Community can pick subscription
models without changing the existing API-key flow.
Introduce a gated, user-confirmed import path for encrypted API-key
configs: tools boundary + H2 ledger ports, JCEF query interceptor that
keeps secrets out of generic console logging, and importLegacy config
APIs that never silently overwrite an existing backend default.
…l config

Make subscription chat chrome usable without opening the model dropdown by
resolving reasoning efforts from option map, snapshots, and ChatGPT defaults,
and by rebuilding send-time model options when local map state lags. Redesign
the model config modal as a dual-zone page with multi-vendor cards (~2–3 per
row) plus full API-key CRUD, switch request routing to a live javaQuery probe,
and document packaging gates plus remaining CHG plans.
…UM findings

Harden MCP permission auto-approval to chat2db_subscription + allowlisted
tools, disable parallel tool advertising, drop CodeMode host from packaging
and CI staging, surface reauth/rate-limit turn failures, and bind secret-
import item ids to secret revisions. Preserve explicit API-key selection on
ready-to-use bootstrap, wire conversation-scoped model preferences, isolate
secret-import ledger startup failures, and close renderer gates for
default-off modal, migration entry, disabled options, late javaQuery, and
CONNECTING expiry cleanup.
@HaijieChen
HaijieChen marked this pull request as ready for review August 3, 2026 05:25
@HaijieChen
HaijieChen requested a review from openai0229 as a code owner August 3, 2026 05:25
@openai0229 openai0229 moved this from In Progress to In Review in Chat2DB Community Aug 3, 2026
@openai0229

Copy link
Copy Markdown
Contributor

Thank you @HaijieChen for the substantial work behind this pull request.

This PR provides valuable evidence that the product direction is technically achievable: Chat2DB Community can supervise a Codex app-server, use supported ChatGPT/Codex subscription access, discover models, stream turns, and connect Codex with Chat2DB database capabilities. The authentication, packaging, tool-safety, and recovery exploration is especially useful.

We agree that this is a worthwhile feature. After reviewing the full change, however, we believe the technical solution needs an end-to-end redesign before merge rather than another round of incremental fixes inside the current structure. The open questions include the product/provider model, Agent Runtime ownership, chat routing, model-configuration source of truth, app-server lifecycle, durable state and H2 scope, database-tool permissions, and whether legacy API-key migration belongs in this feature.

To separate the confirmed product goal from the unresolved architecture, we created:

Please use #2412 for design alternatives, diagrams, state machines, evidence from this implementation, and tradeoff discussion. We will also provide our own design proposal there after the problem and decision points are fully framed.

For now, we will treat #2371 as an important feasibility implementation and source of test evidence, not as the final architecture. This design reset is not a dismissal of the work already done; it is intended to preserve the useful findings while giving the feature a smaller, clearer, and maintainable production boundary.

Thank you again for taking this direction far enough that the project can now discuss it with concrete evidence.

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

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

2 participants