From 42642c19d2ca2ffa42cb8c8e3b4213705fc915fe Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Fri, 25 Sep 2026 22:07:51 +0300 Subject: [PATCH] Stopped showing the auto mode classifier billing notice for OpenAI-proxy profiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This proxy fully translates every request into a non-Anthropic API (OpenAI Chat Completions or the Codex Responses API), so it can never forward Anthropic's server-side auto-mode classifier fields (safeguards / safeguard_results) — the backend has no concept of them. Without an override, Claude Code still probed for server-side checks, fell back, and showed a one-time "session isn't eligible" notice every session. Setting CLAUDE_CODE_AUTO_MODE_SERVER=0 (via putIfAbsent, so an explicit user override in a profile's extra env vars still wins) tells Claude Code not to probe at all. Classifier requests are billed identically either way — this only removes the interruption. Co-Authored-By: Claude Sonnet 5 --- CHANGELOG.md | 2 ++ pom.xml | 2 +- .../claudecodegui/process/ClaudeProcess.java | 27 +++++++++++++++++++ .../process/ClaudeProcessTest.java | 20 ++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f2da9ed..9e115dd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Stopped showing Claude Code's "auto mode classifier billing" session notice when using an OpenAI-compatible or ChatGPT Subscription connection type — classifier requests are billed the same as before, just without the interruption, since this connection type was never able to hand those checks off to the server in the first place + # 1.3.8 (2026-07-22) - Fixed the OpenAI-compatible and ChatGPT Subscription connection types silently ending a prompt with no visible response when the provider returned an empty completion (typically because the conversation grew too large for the model's context/output limit) — Claude Code now shows an explanatory message, including the size of the request that triggered it, instead of just returning to the idle prompt diff --git a/pom.xml b/pom.xml index 45cb35e3..1ac3cd4c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.nbplugins netbeans-plugin-claude-code-gui - 1.3.28-SNAPSHOT + 1.3.30-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 553786e0..8e2b249f 100644 --- a/src/main/java/io/github/nbplugins/claudecodegui/process/ClaudeProcess.java +++ b/src/main/java/io/github/nbplugins/claudecodegui/process/ClaudeProcess.java @@ -179,6 +179,7 @@ public PtyProcess start(String workingDir, ClaudeProfile profile, String extraCl env.put("ANTHROPIC_BASE_URL", "http://127.0.0.1:" + mcpSvc.getServerPort() + "/openai-proxy/" + uuid); env.put("ANTHROPIC_AUTH_TOKEN", "sk-proxy-internal"); + disableAutoModeServerCheck(env); LOG.info("OpenAI proxy registered: uuid=" + uuid + ", profile=" + profile.getName() + ", target=" + profile.getBaseUrl()); @@ -204,6 +205,7 @@ public PtyProcess start(String workingDir, ClaudeProfile profile, String extraCl env.put("ANTHROPIC_BASE_URL", "http://127.0.0.1:" + mcpSvc.getServerPort() + "/openai-proxy/" + uuid); env.put("ANTHROPIC_AUTH_TOKEN", "sk-proxy-internal"); + disableAutoModeServerCheck(env); LOG.info("ChatGPT subscription proxy registered: uuid=" + uuid + ", profile=" + profile.getName()); } catch (io.github.nbplugins.claudecodegui.chatgptauth.OAuthException e) { @@ -764,6 +766,31 @@ static String cleanedSettingsJson(String existingJson) { * @param profilesDir base directory for profile config dirs * @return mutable env map ready to pass to {@link PtyProcessBuilder} */ + /** + * Tells Claude Code not to ask the far end of {@code ANTHROPIC_BASE_URL} to + * perform auto mode's server-side classifier checks. + * + *

The OpenAI-proxy and ChatGPT-subscription connection types point + * {@code ANTHROPIC_BASE_URL} at this plugin's own local servlet, which + * fully translates every request into a non-Anthropic API (OpenAI Chat + * Completions or the Codex Responses API). That backend has no concept of + * Anthropic's {@code safeguards} request field / {@code safeguard_results} + * response field, so the server-side check can never succeed here. Without + * this override, Claude Code would still try it, fall back, and show a + * one-time "session isn't eligible" notice every session; classifier + * requests are billed identically either way, so this only removes the + * interruption. + * + *

Uses {@code putIfAbsent} so a value the user already set explicitly + * (e.g. via a profile's extra env vars, applied by {@link #buildEnv} + * before this runs) is left untouched. + * + * @param env mutable env map being built for the child process + */ + static void disableAutoModeServerCheck(Map env) { + env.putIfAbsent("CLAUDE_CODE_AUTO_MODE_SERVER", "0"); + } + static Map buildEnv(ClaudeProfile profile, java.nio.file.Path profilesDir) { Map env = new HashMap<>(System.getenv()); env.put("TERM", "xterm-256color"); diff --git a/src/test/java/io/github/nbplugins/claudecodegui/process/ClaudeProcessTest.java b/src/test/java/io/github/nbplugins/claudecodegui/process/ClaudeProcessTest.java index 78a95417..3cc61620 100644 --- a/src/test/java/io/github/nbplugins/claudecodegui/process/ClaudeProcessTest.java +++ b/src/test/java/io/github/nbplugins/claudecodegui/process/ClaudeProcessTest.java @@ -171,6 +171,26 @@ void testCleanupRemovesApiKeyHelperButKeepsUserContent() { assertTrue(cleaned.contains("myCustomKey"), "cleaned should preserve user content"); } + // ------------------------------------------------------------------------- + // disableAutoModeServerCheck + // ------------------------------------------------------------------------- + + @Test + void testDisableAutoModeServerCheckSetsWhenAbsent() { + java.util.Map env = new java.util.HashMap<>(); + ClaudeProcess.disableAutoModeServerCheck(env); + assertEquals("0", env.get("CLAUDE_CODE_AUTO_MODE_SERVER")); + } + + @Test + void testDisableAutoModeServerCheckKeepsUserOverride() { + java.util.Map env = new java.util.HashMap<>(); + env.put("CLAUDE_CODE_AUTO_MODE_SERVER", "1"); + ClaudeProcess.disableAutoModeServerCheck(env); + assertEquals("1", env.get("CLAUDE_CODE_AUTO_MODE_SERVER"), + "an explicit user-set value must not be overridden"); + } + // ------------------------------------------------------------------------- // toShellCommand // -------------------------------------------------------------------------