From 17386a36eb55fd5a80239357aa3b8219fc1297d3 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Fri, 16 Oct 2026 15:01:34 +0300 Subject: [PATCH 1/3] Fixed "OpenAI-compatible API" connection type being reset to "Claude-compatible API" on the Default profile (https://github.com/nbplugins/NetbeansPluginClaudeCodeGui/issues/191) Resolves: #191 The Default profile was rebuilt from stored settings by copying fields one by one, and the openaiProxy flag was not copied, so the connection type was re-derived as OTHER_API. The connection type is now stored explicitly as connectionType; the Default profile is deserialised as a whole like named profiles. Settings written by older versions (legacy openaiProxy / openaiSubscription flags, no connectionType) are still read and the type is derived from them; settings are always written in the new format. Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 1 + pom.xml | 2 +- .../claudecodegui/process/ClaudeProcess.java | 10 +- .../claudecodegui/settings/ClaudeProfile.java | 95 +++++++----- .../settings/ClaudeProfileStore.java | 40 +++-- .../settings/ClaudeProfilesPanel.java | 22 +-- .../chatgptauth/ChatGptTokenManagerTest.java | 4 +- .../ClaudeProfileStoreConnectionTypeTest.java | 140 ++++++++++++++++++ .../settings/ClaudeProfileStoreTest.java | 45 ++++++ .../settings/ClaudeProfileTest.java | 62 ++++---- .../ClaudeProfilesPanelFlushTest.java | 9 +- 11 files changed, 306 insertions(+), 124 deletions(-) create mode 100644 src/test/java/io/github/nbplugins/claudecodegui/settings/ClaudeProfileStoreConnectionTypeTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index f27d061..680879e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Fixed "OpenAI-compatible API" connection type being reset to "Claude-compatible API" on the Default profile (https://github.com/nbplugins/NetbeansPluginClaudeCodeGui/issues/191) - Improved the IDE log (messages.log): per-request and per-click diagnostics (tab label polling, PreToolUse hooks with file contents, diff tabs, choice menus, permission prompts) are now written only when debug logging is enabled, so the log is no longer flooded and no longer contains edited code # 1.3.28 (2026-10-07) diff --git a/pom.xml b/pom.xml index ca0c1a1..b949b10 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.nbplugins netbeans-plugin-claude-code-gui - 1.3.53-SNAPSHOT + 1.3.54-SNAPSHOT nbm Netbeans Plugin Claude Code GUI NetBeans plugin that provides a GUI for Claude Code CLI — run claude code sessions directly inside the IDE. diff --git a/src/main/java/io/github/nbplugins/claudecodegui/process/ClaudeProcess.java b/src/main/java/io/github/nbplugins/claudecodegui/process/ClaudeProcess.java index 137ef3c..d5f9d0a 100644 --- a/src/main/java/io/github/nbplugins/claudecodegui/process/ClaudeProcess.java +++ b/src/main/java/io/github/nbplugins/claudecodegui/process/ClaudeProcess.java @@ -161,7 +161,7 @@ public PtyProcess start(String workingDir, ClaudeProfile profile, String extraCl // OpenAI proxy: register session and inject ANTHROPIC_BASE_URL pointing to internal proxy if (profile != null - && profile.computeConnectionType() == ClaudeProfile.ConnectionType.OPENAI_PROXY) { + && profile.getConnectionType() == ClaudeProfile.ConnectionType.OPENAI_PROXY) { ClaudeCodeStatusService mcpSvc = Lookup.getDefault().lookup(ClaudeCodeStatusService.class); if (mcpSvc != null && mcpSvc.isServerRunning()) { String uuid = UUID.randomUUID().toString(); @@ -191,7 +191,7 @@ public PtyProcess start(String workingDir, ClaudeProfile profile, String extraCl // ChatGPT subscription: pre-emptively refresh the OAuth token, register the // session, and inject ANTHROPIC_BASE_URL pointing to the internal Codex proxy. if (profile != null - && profile.computeConnectionType() == ClaudeProfile.ConnectionType.OPENAI_SUBSCRIPTION) { + && profile.getConnectionType() == ClaudeProfile.ConnectionType.OPENAI_SUBSCRIPTION) { ClaudeCodeStatusService mcpSvc = Lookup.getDefault().lookup(ClaudeCodeStatusService.class); if (mcpSvc != null && mcpSvc.isServerRunning()) { try { @@ -219,9 +219,9 @@ public PtyProcess start(String workingDir, ClaudeProfile profile, String extraCl } boolean apiKeyHelper = profile != null && !profile.getApiKey().isBlank() && profile.getBaseUrl().isBlank() - && profile.computeConnectionType() != ClaudeProfile.ConnectionType.OPENAI_PROXY - && profile.computeConnectionType() != ClaudeProfile.ConnectionType.OPENAI_SUBSCRIPTION; - LOG.info("Starting Claude: profile=" + (profile != null ? profile.getName() + " (" + profile.computeConnectionType() + ")" : "Default") + && profile.getConnectionType() != ClaudeProfile.ConnectionType.OPENAI_PROXY + && profile.getConnectionType() != ClaudeProfile.ConnectionType.OPENAI_SUBSCRIPTION; + LOG.info("Starting Claude: profile=" + (profile != null ? profile.getName() + " (" + profile.getConnectionType() + ")" : "Default") + ", apiKeyHelper=" + (apiKeyHelper ? "SET" : "NOT SET") + ", ANTHROPIC_AUTH_TOKEN=" + (!env.getOrDefault("ANTHROPIC_AUTH_TOKEN", "").isBlank() ? "SET" : "NOT SET") + ", ANTHROPIC_BASE_URL=" + env.getOrDefault("ANTHROPIC_BASE_URL", "(not set)") diff --git a/src/main/java/io/github/nbplugins/claudecodegui/settings/ClaudeProfile.java b/src/main/java/io/github/nbplugins/claudecodegui/settings/ClaudeProfile.java index de70b45..446229c 100644 --- a/src/main/java/io/github/nbplugins/claudecodegui/settings/ClaudeProfile.java +++ b/src/main/java/io/github/nbplugins/claudecodegui/settings/ClaudeProfile.java @@ -1,6 +1,7 @@ package io.github.nbplugins.claudecodegui.settings; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSetter; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -17,9 +18,13 @@ * programmatically. * *

Connection type

- * {@link ConnectionType} is not stored — it is derived from the - * credential fields by {@link #computeConnectionType()}: + * The {@link ConnectionType} is stored explicitly (see {@link #getConnectionType()}). + * Settings written by older plugin versions have no stored type (only the legacy + * {@code openaiProxy} / {@code openaiSubscription} flags and the credential fields); + * for them the type is derived on read: *