Repository navigation
fix(langfuse): fall back on an invalid HERMES_LANGFUSE_MAX_CHARS instead of raising - #450
Open
fredheathcote007 wants to merge 1 commit into
Open
fredheathcote007 wants to merge 1 commit into
fredheathcote007 wants to merge 1 commit into
Conversation
…ead of raising A non-integer value (e.g. "12k") raised ValueError from every _safe_value call, so every captured payload failed; a negative value was accepted and truncated nonsensically. Parse it like HERMES_LANGFUSE_MAX_DEPTH: warn once per distinct value and fall back to the 12000 default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
_safe_valueparsesHERMES_LANGFUSE_MAX_CHARSwith a bareint()on every call:12k,abcValueErrorfrom every capture call-5HERMES_LANGFUSE_MAX_DEPTHalready handles this case in_resolve_max_depth.Fix
Added
_resolve_max_chars, which mirrors_resolve_max_depth. It is anlru_cachekeyed on the raw string, so a changed env var is still picked up. An invalid or negative value warns once per distinct value and falls back to the default of 12000.Tests
test_invalid_max_chars_warns_once_and_falls_back_instead_of_raising[abc|-5|12k]checks that the payload is truncated at 12000 and that exactly one warning is logged. The existing cache-clearing fixture now clears both resolvers.The full langfuse suite passes (181 tests) and
hermes plugins validatepasses. Both were run on Linux with Python 3.14 against current hermes-agent main. I haven't run them on macOS or Windows locally; CI covers those.🤖 Generated with Claude Code