mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 20:11:08 +00:00
Users who hand-configure ~/.codex/config.toml with a custom model_provider and matching [model_providers.<name>] entry are fully functional from the Codex CLI, but netcatty only looked at codex login status — which reports on ~/.codex/auth.json alone — and would therefore push them into the ChatGPT login flow even though the CLI works for them. Add a minimal TOML parser for the narrow subset we need (top-level keys plus [model_providers.<name>] string tables), and readCodexCustomProvider Config() to detect a usable custom-provider setup: an active model_provider that isn't the built-in openai preset, pointing at a provider entry whose env_key is set in the shell env (or api_key is hardcoded). Surface this as a new integration state "connected_custom_config", add a customConfig summary on the IPC response, and tweak the Codex settings card so it shows the custom-provider name, hides the Connect ChatGPT button, and drops the stale "OpenAI-compatible provider" hint when this path is active. At Codex-ACP spawn time, introduce getCodexAuthOverride() so we only pass authMethodId: "chatgpt" when we truly have no other option. When a netcatty-managed API key is present we still use "codex-api-key"; when the user has a custom config we omit authMethodId entirely so codex-acp resolves auth from the shell env / config.toml itself. Fold the detected custom config (provider name, base url, env key presence) into the provider reuse fingerprint so edits to config.toml invalidate cached ACP instances. Fixes the Codex half of #677 for users who skip Settings → AI providers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>