Skip to content

hive/openai-server: only system words that lead a request are the system prompt - #106

Merged
adiled merged 3 commits into
mainfrom
openai-server-tail-system
Nov 7, 2026
Merged

adiled merged 3 commits into
mainfrom
openai-server-tail-system

Conversation

@adiled

@adiled adiled commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Every system or developer message anywhere in a conversation was folded into one system prompt. A client that appends a system item mid-conversation (wryme's bookkeeping prod, since wryme#78) changed the system prompt on every prod, and claude-cli re-sends the whole <system> block whenever it changes: the model got every prod so far stacked into one turn, growing each time, and the prompt cache missed.

Now system words go both ways intact:

  • Server side (conversation.ts): Reader.told keeps only the system words that lead a request as the system prompt. Later ones are a text petal in the turn they came in, <system>\n…\n</system> (noted), said once where they were said. Leading means before any other item of this request, so a previous_response_id continuation that opens with a developer message still sets the system prompt.
  • Nurse side (nurse.ts): said splits such a note (noteOf) back out as a {role: "system"} message in place, both for the asked turn and for the graft (messagesOf). An OpenAI-compatible model sees the system message where the client put it, not as user text.

Tests:

  • conversation.test.ts: a late system item is a note in its turn; several land once each in their own turns
  • nurse.test.ts: a chat with a late system message reads in and says back out to the model unchanged

Full suite: 83 pass, 0 fail (22 live skipped).

@adiled
adiled merged commit 2bc468d into main Nov 7, 2026
7 checks passed
@adiled
adiled deleted the openai-server-tail-system branch November 7, 2026 20:51
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