Files
magpie/docs
yetone 16dc154589 claude: a new Claude Code told a whole conversation is told which turns were answered already and which turn to answer, and the gateway logs that it happened (#1365)
What changed: renderClaudePrompt told a run started anew the conversation
as one stretch of Human:/Assistant: text, every image of every turn in it,
and the model in #1365 took the earlier images for new ones. When the
conversation has a reply that calls no tool, the turns up to it now go in
<conversation_history>, with a note that the images and files in them were
sent with those earlier messages and need no answer again, and the rest
(from the user message after that reply, as nextTurn splits it,
historyEnd) in <current_turn>. Images stay in place inside their section;
none is dropped. A first turn, a conversation with no reply in it (one-off
asks, the auto mode classifier's transcript), or messages ending in a
reply are told as before. start logs "a new Claude Code is told the whole
conversation" with the message and image counts, after the "tool results
<why>" line that says why no run took it.

Why: a rebuild can't always be avoided (a run past its idle time with no
saved session, a run started anew for the turn and given up on, a
conversation the client changed). Its replay should not read as the user
sending everything again. Only the text of the one message a new run is
told changes, no header or other request field.

What was run:
- New TestClaudePromptMarksEarlierTurns: the earlier turn and its image are
  inside <conversation_history>, the current turn's text, tool round and
  two images inside <current_turn>, and a first turn or reply-less
  conversation has no markers. With historyEnd's split turned off it fails.
- go test -tags nogui ./internal/gateway/ (full package) under a temp HOME,
  including the existing renderClaudePrompt tests (prompt cache, foreign
  calls, images); -race -count=20 on the new tests; gofmt -l; go vet for
  darwin, linux and windows (-tags nogui); GOOS=linux/windows go build.
Not tried against a real Claude model: whether it now leaves earlier
images alone is untested.
2026-10-09 11:05:33 +08:00
..