Skip to content

Include conversation history in generation inputs - #29

Open
DavidTraina wants to merge 1 commit into
langfuse:mainfrom
DavidTraina:fix/generation-input-history
Open

Include conversation history in generation inputs#29
DavidTraina wants to merge 1 commit into
langfuse:mainfrom
DavidTraina:fix/generation-input-history

Conversation

@DavidTraina

@DavidTraina DavidTraina commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Each generation's input previously contained only the messages since the previous generation, so opening a generation in Langfuse never showed the conversation the model actually received.

This change keeps a running per-session message history and records it as every generation's input:

  • User messages (with their tool definitions), assistant messages, and tool results are appended to the history in order.
  • Each generation's input is a snapshot of the history at the point the generation starts.
  • The history survives the session.idle flush, so generations in later turns include earlier turns.

Scope notes:

  • The system prompt is still not included: no event the plugin consumes carries it, so recording it would mean fabricating data. This PR is limited to accumulating message history and tool definitions.
  • Compaction is not special-cased: after a compaction, the recorded history still contains the pre-compaction messages rather than the summary the model actually sees from then on.

Tested with pnpm run test:integration: added a test asserting that a later turn's generation input contains the prior turn's user and assistant messages across an idle flush, and updated the existing multi-generation expectations to include the accumulated history.

Addresses the conversation-history part of #24

Opening this as a draft since you mentioned wanting to compare behavior with the Claude and Codex plugins first — happy to adjust the approach to whatever direction you land on.

@CLAassistant

CLAassistant commented Aug 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@DavidTraina
DavidTraina force-pushed the fix/generation-input-history branch from 3bcaca6 to edb169b Compare August 18, 2026 19:19
@DavidTraina
DavidTraina marked this pull request as ready for review August 19, 2026 17:41
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.

2 participants