From 1709f5c098cff4d012ae6c335aa6d22e6c77a5c9 Mon Sep 17 00:00:00 2001 From: Juan Camilo Date: Thu, 2 Apr 2026 16:18:10 +0200 Subject: [PATCH] fix: block update command for 3P providers, align thinking block handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. cli/update.ts: Block the update command for third-party providers. The update mechanism downloads from Anthropic's GCS bucket, which would silently replace the OpenClaude build (with the OpenAI shim) with the upstream Claude Code binary (without it). Now shows an actionable message directing users to rebuild from source. 2. codexShim.ts: Filter thinking blocks from assistant history, matching the openaiShim behavior. Without this, thinking blocks were included as plain text in assistant messages for the Codex transport but excluded for the OpenAI transport — causing inconsistent history when switching providers mid-session. --- src/cli/update.ts | 14 ++++++++++++++ src/services/api/codexShim.ts | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/cli/update.ts b/src/cli/update.ts index a0cd35f5..11ef117c 100644 --- a/src/cli/update.ts +++ b/src/cli/update.ts @@ -1,4 +1,5 @@ import chalk from 'chalk' +import { getAPIProvider } from 'src/utils/model/providers.js' import { logEvent } from 'src/services/analytics/index.js' import { getLatestVersion, @@ -28,6 +29,19 @@ import { gte } from 'src/utils/semver.js' import { getInitialSettings } from 'src/utils/settings/settings.js' export async function update() { + // Block updates for third-party providers. The update mechanism downloads + // from Anthropic's distribution bucket, which would silently replace the + // OpenClaude build (with the OpenAI shim) with the upstream Claude Code + // binary (without it). + if (getAPIProvider() !== 'firstParty') { + writeToStdout( + chalk.yellow('Auto-update is not available for third-party provider builds.\n') + + 'To update, pull the latest source from the repository and rebuild:\n' + + ' git pull && bun install && bun run build\n', + ) + return + } + logEvent('tengu_update_check', {}) writeToStdout(`Current version: ${MACRO.VERSION}\n`) diff --git a/src/services/api/codexShim.ts b/src/services/api/codexShim.ts index 26ae237e..e01facd5 100644 --- a/src/services/api/codexShim.ts +++ b/src/services/api/codexShim.ts @@ -264,7 +264,8 @@ export function convertAnthropicMessagesToResponsesInput( if (role === 'assistant') { const textBlocks = Array.isArray(content) - ? content.filter((block: { type?: string }) => block.type !== 'tool_use') + ? content.filter((block: { type?: string }) => + block.type !== 'tool_use' && block.type !== 'thinking') : content const parts = convertContentBlocksToResponsesParts(textBlocks, 'assistant') if (parts.length > 0) {