diff --git a/proxy-patches/openai-to-cli.js b/proxy-patches/openai-to-cli.js index f9a2398..d4f0f94 100644 --- a/proxy-patches/openai-to-cli.js +++ b/proxy-patches/openai-to-cli.js @@ -216,9 +216,35 @@ export function openaiToCli(request) { // docker-compose.yml). Der Prompt enthaelt nur noch den Gespraechsverlauf. // systemPrompt ist immer ein String (nie undefined) — bei --system-prompt // darf er nicht leer sein, sonst laeuft das Modell ohne System-Prompt. + const systemPrompt = extractSystemPrompt(request.messages, request.tools); + + // TEMP-DEBUG (20.07.2026, Root-Cause-Suche "Claude kennt Hermes-Tools nicht"): + // Sichtbar per `docker logs hermes-proxy`. Zeigt schwarz auf weiss, ob + // Hermes ueberhaupt ein `tools`-Feld + system-Messages mitschickt, und wie + // lang der daraus gebaute systemPrompt ist. Wenn systemPromptLen sehr klein + // ist (z.B. 0) UND toolsCount 0 ist: Hermes schickt schlicht nichts mit, + // das ist dann kein Proxy-Bug sondern ein Hermes-Konfig-Thema (Toolset + // nicht aktiv / Persona-Prompt anders uebergeben). Wieder rausnehmen sobald + // geklaert. + try { + const roles = (request.messages || []).map((m) => m && m.role); + const toolNames = Array.isArray(request.tools) + ? request.tools.map((t) => t?.function?.name).filter(Boolean) + : []; + console.error( + "[openai-to-cli][DEBUG] messageRoles=" + JSON.stringify(roles) + + " toolsCount=" + (Array.isArray(request.tools) ? request.tools.length : 0) + + " toolNames=" + JSON.stringify(toolNames) + + " systemPromptLen=" + systemPrompt.length + + " systemPromptPreview=" + JSON.stringify(systemPrompt.slice(0, 200)) + ); + } catch (e) { + console.error("[openai-to-cli][DEBUG] logging failed: " + e.message); + } + return { prompt: conversationToPrompt(request.messages), - systemPrompt: extractSystemPrompt(request.messages, request.tools), + systemPrompt, model: extractModel(request.model), sessionId: request.user, };