feat(hook): capture image blocks as markers and opt-in Langfuse media - #56
Open
milanagm wants to merge 4 commits into
Open
Conversation
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.
Problem
The hook silently dropped pasted images from trace and generation inputs while the
[Image #1]placeholder stayed in the text. The trace looked as if it contained an image, but it did not.At the same time Tool-result screenshots (browser, simulator) caused more damage. The hook serialized their base64 into the tool span output. Truncation at
CC_LANGFUSE_MAX_CHARScut it to ~20k characters of unusable base64. This destroyed all text blocks after the image. The damaged output also went into the next generation input.Change
[image image/png ~290KB]. This applies to message content and to tool_result content, in the main session and in subagents. The hook does not drop images. Base64 does not reach the payload. Text after an image stays complete.Verification
CC_LANGFUSE_CAPTURE_IMAGESorLANGFUSE_MEDIA_UPLOAD_ENABLEDpresent in the environment.Deliberate scope decisions
Follow-up ideas (separate issues)
tool_use.inputstill goes into tool span inputs as a raw, unbounded dict. The hardening stops the upload only. A marker pass for tool inputs changes the payload shape and needs its own issue.get_tool_result_textstill loads full base64 into memory for the legacy async-launch check. This costs performance only.Closes #52
Fixes LFE-14888