Skip to content

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

Closed

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]

Activity

  1. self-assigned this
    on Aug 18, 2026
  2. bezbac commented on Aug 18, 2026

    @bezbac
    Member

    Hi @DavidTraina, thanks also for this report. I'll compare the behavior with our other coding agent plugins, namely https://github.com/langfuse/claude-observability-plugin and https://github.com/langfuse/codex-observability-plugin, and see what the best path forward is here :)

  3. milanagm commented on Sep 8, 2026

    @milanagm
    Contributor

    Hello @DavidTraina, thank you for raising this! We have added a feature targeting your request last week. Feel free to let us now if you have follow up requests in the future.

  4. apkrymov commented on Sep 9, 2026

    @apkrymov

    @milanagm
    hello! What about the system-prompt part of that request? Are there any future plans to implement it? For now, only user and assistant roles are included in the trace.

  5. milanagm commented on Sep 9, 2026

    @milanagm
    Contributor

    Hello @apkrymov, valid question!

    The UserMessage type has a system field, which holds a system prompt that the caller sends with the request. Though, OpenCode does not put its own system prompt in this field, meaning that in normal use the field is empty.

    But there is a potential second way that I had investigated. The v2 agents endpoint GET /api/agent gives a system field for each agent, which is basically the system prompt of the agent. This endpoint usually gave me an empty value.

    TLRD - for now I couldn't detect a reliable way to include it, which is why, for now, the system prompt is not visible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions