[Bug]: Pattern system prompt merges user input into single system message, causing empty responses on OpenAI-compatible providers that require a user turn
What happened?
When using a pattern with an OpenAI-compatible provider (e.g. Ollama Cloud via OPENAI_API_BASE_URL), Fabric sends only a single message with role=system containing both the pattern content and the user input appended at the # INPUT: section. No role=user message is sent. Several OpenAI-compatible providers require at least one user turn to generate a response and return an empty response when only a system message is present.
To reproduce
Configure Fabric with an OpenAI-compatible provider via OPENAI_API_BASE_URL (e.g. Ollama Cloud at https://ollama.com/v1) Run any pattern: echo "test input" | fabric -p summarize Observe empty response
Enabling --debug=4 confirms only one message is sent:
DEBUG: FABRIC->LLM request messages (1) DEBUG: FABRIC->LLM [0] role=system content="# IDENTITY and PURPOSE\n...\n# INPUT:\n\nINPUT:\ntest input" DEBUG: LLM->FABRIC response content=""
The same provider works correctly when called directly with separate system and user messages.
Root cause
In internal/core/chatter.go, BuildSession sets inputUsed = true whenever a pattern is loaded, then uses this flag to suppress appending the user message:
if len(request.Message.MultiContent) > 0 || (request.Message != nil && !inputUsed) { session.Append(request.Message) }
When inputUsed is true the user message is never appended, resulting in a single system message.
What I did to fix it for me but that might not be done because other providers
Remove the !inputUsed guard so the user message is always appended as a separate turn:
go if len(request.Message.MultiContent) > 0 || request.Message != nil { session.Append(request.Message) }
And remove the now-unused inputUsed variable and assignment.
Operating System
Linux - amd64
OS Version
Debian 13How did you install Fabric?
Release Binary - Linux (amd64)
Version
Fabric version: v1.4.473Relevant log output
Relevant screenshots (optional)
No response
Source: danielmiessler/Fabric