Skip to content

Show history turns as recorded; leave history out of the system message - #288

Merged
deepfates merged 1 commit into
mainfrom
fix/history-truth
Oct 8, 2026
Merged

deepfates merged 1 commit into
mainfrom
fix/history-truth

Conversation

@deepfates

Copy link
Copy Markdown
Owner

Fixes #261. Fixes #258.

Problem

Change

  • A stored turn shows only the outputs it recorded. If it recorded none, it is the user message alone, which is how the loop's own call-less turns already render (ReActV2's last_request_note renders with an invented assistant reply #259). This applies to plain, written-tool and native-tool replay.
  • On native replay, a turn from a predictor that isn't a tool loop (no loop guidance and no next_thought) uses its recorded outputs as the assistant text. Loop steps don't change.
  • The system message leaves out a field typed history, and any input the call supplies as an Imp.History. A field that is only named history and is given a plain value is still listed, and still shows as a section (existing test). The change is in Chat.assemble, so Chat, JSON and XML all get it.

Both are deliberate differences from DSPy 3.2.1. They are recorded in decisions.md (a new row, plus an amendment to the #259 row that kept the filler) and in research/differentials/ADAPTER_FIDELITY.md. Demo rendering doesn't change.

Tests

The three new tests in test/history_test.exs fail on main and pass here:

  • the system message has no history field or section (Chat, JSON, XML)
  • missing outputs are left out, and an entry with no outputs is the user message alone
  • native replay keeps a predictor's recorded output beside its calls

Two existing expectations change on purpose: the plain-text ReActV2 system message, and the host input-only entry test, which asserted the filler.

mix check's test command: 3609 tests, 0 failures. mix dialyzer.check passes after moving the pinned chat.ex skip to its new line (894 to 898).

…essage

A stored turn's missing outputs read "Not supplied for this conversation
history message.", words the model never wrote. DSPy 3.2.1 writes None
there instead, which is no truer. A turn now shows the outputs it
recorded and nothing for the rest, and a turn with none is its user
message alone.

On native replay, a predictor that names a tool-calls output but is not a
tool loop showed only next_thought, which it does not record, so its
answer was lost. Its recorded outputs are now the assistant text. A loop
step still shows next_thought.

The system message of every format listed a history input and showed a
[[ ## history ## ]] section that no message contains, since history
arrives as turns. It now leaves out a field typed history, and any input
the call supplies as an Imp.History. #284 did this only for the template
of a plain-text ReActV2 step; that step's field list still named history.

Fixes #261. Fixes #258.
@deepfates
deepfates merged commit 8895e6e into main Oct 8, 2026
10 checks passed
@deepfates
deepfates deleted the fix/history-truth branch October 8, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant