feat: trace payloads without truncation - #32
Merged
Merged
Conversation
milanagm
added a commit
that referenced
this pull request
Sep 10, 2026
#31 landed the system prompt while this branch was open, and both changes rewrite the generation input. The resolution composes them: state.systemPrompt keeps its place at the front, the history takes the place of baseInput, and the spread now also accepts an array, since the history is one. Both new handlers are kept — pi.on("context") and pi.on("agent_start") are independent of each other. The history also stops borrowing MAX_CHARS. It marks data URIs but adds no length cap of its own, so this branch neither reads nor removes any part of the truncation machinery. #32 can therefore land before or after this PR. #31's generation-input test asserted the delta shape (exactly one message behind the system prompt). It now asserts the conversation, which is what this branch changes.
hassiebp
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes LFE-16188
Problem
Every captured payload was cut at
PI_LANGFUSE_MAX_CHARS(default 20000), so a long prompt, a long answer or a large tool result reached Langfuse shortened, and the trace no longer showed what actually happened.What this does
Removes
PI_LANGFUSE_MAX_CHARS,truncateText()andTruncationMeta, so these all go out at full length:event.promptinput.content, and the first generation's inputstate.lastAssistantTextoutput.contentmessage_endoutput.contentTool:spaninputTool:spanoutputCompactionoutput.contentBranch Summaryoutput.contentAlso gone:
user_text_meta,assistant_text_meta(root and generation),args_meta,output_meta,summary_meta(compaction and branch summary).outText.slice(0, 4000)onpendingToolResults, the tool results that appear as the next generation's input. They were cut twice — first to 20000, then to 4000.node:cryptoimport, which only served the truncation marker'ssha256.Tests
pnpm test: 60 passing (the twotruncateTextunit tests went with the function), andtsc --noEmitclean. Verified against all three CI matrix versions — pi 0.83.0, 0.84.3 and 0.85.0.