danielmiessler / danielmiessler/Fabric
[Bug]: Pattern system prompt merges user input into single system message, causing empty responses on OpenAI-compatible providers that require a user turn
- Dominant language
- Go
- Stars
- 43.9k
- Forks
- 4.3k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 8
Description
### 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
```shell
Debian 13
```
### How did you install Fabric?
Release Binary - Linux (amd64)
### Version
```text
Fabric version: v1.4.473
```
### Relevant log output
```shell
```
### Relevant screenshots (optional)
_No response_
Contributor guide
Research direction
Start in internal/core/chatter.go, where BuildSession decides whether to append the request message, and reproduce with an OpenAI-compatible provider such as Ollama Cloud using the documented fabric -p summarize command and debug output. Done means a pattern request sends separate system and user messages and no longer returns an empty response from providers that require a user turn.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- ai, backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100