v1.7.1 — fix #3: no silent empty optimized prompt
What's new in 1.7.1
Patch fixing #3: some models returned a silent empty optimizedPrompt. No MCP tool surface changes.
Fixed
optimize / critique / clarify could silently return empty text when the LLM produced no content. Two distinct causes, now handled uniformly in src/engine/llm/client.ts:
- Thinking-channel models (DeepSeek, qwen-thinking, some gateways) return the chain-of-thought under a field name
simpleGeneratewasn't reading. It read onlymessage.reasoning; it now readsreasoning/thinking/reasoning_contentvia a new pureextractAssistantContent(). - gpt-oss harmony format over Ollama's
/v1shim (the actual #3 case, confirmed from the raw response):completion_tokens > 0butcontent: ""with no thinking field — the harmonyfinalchannel is never mapped intocontent.
Recover-or-fail-loud: when content is empty (regardless of any thinking field), simpleGenerate retries once with a final-answer-only directive + larger budget. If still empty, it throws LLMError with a completion_tokens diagnostic. The engine catches it, degrades to the original prompt (non-empty), and surfaces a structured error. Callers never again get a silent empty optimized prompt.
Not fixed (tracked on #3)
Genuinely recovering gpt-oss harmony output needs Ollama's native /api/chat — fragile, provider-specific, wrong size for a patch. The silent-failure harm is fully resolved; affected users get the original prompt back + a diagnostic pointing at non-reasoning models or /api/chat.
Tests
- New
npm run test:thinking— a deterministic mock-based battery (no live cloud model) locking the regression: all three field names extract; thinking-only recovers via retry; the harmony shape (empty content + no thinking field +completion_tokens: 306) retries then throws; normal responses pass through untouched. Added totest:all. - The live reasoning battery's R3 now asserts the real invariant: real output OR loud degradation, never silent-empty.
Install
```bash
npm install -g clarifyprompt-mcp@1.7.1
```