Skip to content

feat: add ChatGPT and Claude subscription LLM profiles with fallback - #622

Open
xMr110 wants to merge 16 commits into
BaaRai:mainfrom
xMr110:feature/subscription-login-upstream
Open

xMr110 wants to merge 16 commits into
BaaRai:mainfrom
xMr110:feature/subscription-login-upstream

Conversation

@xMr110

@xMr110 xMr110 commented Nov 27, 2026 •

Copy link
Copy Markdown

Summary

Subscription providers and UI

  • Add ChatGPT subscription sign-in through OpenAI's OAuth flow and the Responses API. Its LLM profile needs no API key; the sign-in opens in a new browser tab. The model picker reads the signed-in account's catalog, and the profile supports reasoning effort.
  • Add a Claude subscription provider through the unmodified Claude Code CLI. ARTEX retains its own conversation and tool loop. The UI offers CLI model suggestions, manual model entry, effort selection, status checks, and copyable full Docker Compose login commands.
  • Add recognized subscription usage-limit errors to the LLM pool's fallback path, including task profile chains. Provider policy refusals are terminal and are not retried or routed through another profile.

Security, reliability, and Docker

  • Encrypt ChatGPT credentials under ARTEX's key directory using AES-GCM with a key derived from the existing secret key; Windows keeps DPAPI wrapping. Existing plaintext credential files migrate on startup. ChatGPT tokens remain separate from Claude's login volume.
  • Run Claude's main request without user, project, or local settings and hooks (--setting-sources ""). Continue to disable native tools and MCP, strip API-key routing overrides, and accept only one validated ARTEX action per CLI call.
  • Make the Claude CLI an opt-in checkout Docker build argument, disabled in default and released images. Pin the CLI version and npm package/native binary SHA-512 integrity in a committed lockfile. Keep Claude's login in its dedicated persistent volume when opted in.
  • Classify Claude CLI failures into safe fixed categories without logging raw stdout/stderr, avoid repeating deterministic failures, and raise the internal structured-output turn cap from 2 to 8. A Kali Docker task resumed successfully after the turn-cap fix.
  • Retain the BBOT Docker build reliability fix alongside upstream's fully hashed requirements-bbot.lock: increase pip timeout/retries, retry optional module dependencies with --retry-deps, and smoke-check the selected modules. The ARM64 setup remains intact.

Database compatibility

  • Place the subscription-profile migration at version 20 after upstream's versions 16–19. Existing fork databases may have recorded the identical subscription SQL at version 16 or 18; verify its published checksum and complete prior history, move that record to 20, and apply the missing upstream migrations atomically. Fresh databases apply versions 16–20 in order.

Validation

  • After merging upstream becc47a, local go build ./..., go vet ./..., formatting, llmpool tests, and focused subscription, provider, server, and migration-manifest tests passed. The full Windows Go suite has unrelated platform-specific symlink, Python, and path failures; Linux CI is the cross-platform gate.
  • Frontend TypeScript, i18n parity including the new Vietnamese subscription strings, selected auth/navigation/SSE/LLM tests, static production build (33 pages), shell syntax, and git diff --check passed.
  • PostgreSQL-dependent legacy migration tests are included but skipped locally because no test database is configured; PR CI runs them with PostgreSQL.
  • The user tested Claude subscription inference in Kali Docker and reported that the task resumed after the 8-turn fix. ChatGPT requests reached OpenAI but received a content-specific cybersecurity policy refusal; this PR does not claim that workload succeeded via ChatGPT.

Deployment notes

  • To include Claude Code in a checkout-built Compose image, set ARTEX_WITH_CLAUDE_CODE=1 in .env before rebuilding. Without it, the CLI is absent by design.
  • ChatGPT's OAuth callback uses host loopback, and its encrypted credential store holds one ChatGPT account per ARTEX server. The Claude model picker uses a version-sensitive CLI handshake and retains alias/manual entry if discovery fails.
  • Claude paid extra usage can keep requests running after the included allowance; fallback starts only when the CLI returns a recognized usage-limit error.

@xMr110 xMr110 closed this Nov 27, 2026
@xMr110 xMr110 reopened this Nov 27, 2026
@xMr110
xMr110 force-pushed the feature/subscription-login-upstream branch from 6e34326 to 9876b12 Compare November 27, 2026 22:35

@BaaRai BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

#622 is older than #625, so it gets the first chance, but these points block it:

  1. chatgptplan writes credentials as plaintext JSON (store.go, protect_other.go). Use the encrypted key store under /app/keys and keep the token out of the named volume.
  2. The main Claude call is missing --setting-sources ""; user settings and hooks can load into the agent process.
  3. The Dockerfile bundles the Claude Code CLI in the base image. The npm license says SEE LICENSE IN README, and release.yml publishes the image, so this is redistribution. Make the CLI an opt-in build arg, disabled by default, and pin an integrity hash.
  4. Remove the vendor marketing copy from the README.
  5. The migration collides with #598's 0016; after the other migrations this must be 0018.

#625 remains a fallback if these cannot be fixed. Do not merge both.

@xMr110

xMr110 commented Nov 28, 2026

Copy link
Copy Markdown
Author

Thanks for the review. I’ve updated #622 to address all five points: encrypted ChatGPT credentials with migration of existing files; --setting-sources "" on Claude calls; an opt-in, integrity-pinned Claude CLI build; shorter README wording; and migration 0018 with an upgrade path for fork installs that used 0016. The PR summary also covers the BBOT Docker fix. Go, web, shell, and vulnerability checks pass. Could you re-review?

@xMr110
xMr110 requested a review from BaaRai November 29, 2026 12:36
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