Skip to content

Generation input is missing the system prompt and conversation history #24

Description

@DavidTraina

Since #17 (which fixed #1), generations have a non-null input — but it isn't what the model actually saw. Each generation's input only contains the messages since the previous generation:

  • first generation: the new user message plus tool definitions
  • every later generation: just the previous assistant message and the tool results after it

The system prompt never appears anywhere in the trace, earlier turns are never repeated, and tool definitions only show on the first generation. So when you open a generation in Langfuse, the input shown is not the prompt that was sent to the model, which makes prompt-level debugging impossible from the trace alone.

Why (on main, == v0.2.0): the plugin keeps a small per-session buffer — a new user message resets it (src/langfuse.ts:437-447), tool results are appended (:1136-1155), and when the next generation starts, the last assistant message plus that buffer becomes the generation's input and the buffer is cleared (:1119-1133, :340-350). Nothing accumulates the full history, and no event the plugin listens to carries the system prompt.

Repro:

opencode run "read package.json then summarize it"
# open the second opencode.generation: input is just [assistant message, tool result]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions