Skip to content

fix(core): always append user message in BuildSession#2130

Open
xb17 wants to merge 1 commit into
danielmiessler:mainfrom
xb17:fix/buildsession-user-message
Open

fix(core): always append user message in BuildSession#2130
xb17 wants to merge 1 commit into
danielmiessler:mainfrom
xb17:fix/buildsession-user-message

Conversation

@xb17
Copy link
Copy Markdown

@xb17 xb17 commented May 28, 2026

What

Removes the inputUsed flag from BuildSession so that the user message is always appended to the session, even when a pattern is loaded.

Why it matters

Chat-completion APIs — including OpenAI, llama.cpp, and any other strict implementation — require at least one user-role message in every request. The spec does not allow a session consisting only of a system message.

Current behaviour: when a pattern is selected, BuildSession sets inputUsed = true and then skips appending the user message via !inputUsed. The result is a system-only session that causes silent hangs on llama.cpp and will fail on other strict servers.

Fixed behaviour: inputUsed is removed entirely. The user message is always appended. This matches what every compliant chat-completion server expects.

Change

internal/core/chatter.go — remove inputUsed variable and simplify the append condition.

Note: TestChatter_BuildSession_SeparatesSystemSections fails in this environment due to a missing test-strategy file — this failure is pre-existing on main and unrelated to this change.

Chat-completion APIs (OpenAI, llama.cpp, and others) require at least one
user-role message in every request. BuildSession was setting inputUsed=true
when a pattern was loaded, which suppressed the user turn when the pattern
embedded input into the system prompt. This produced a system-only session
that caused silent hangs on strict servers like llama.cpp.

Remove the inputUsed flag entirely and always append the user message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant