Repository navigation
Stop dropping long-session spans and typed workflow agents - #3
Merged
Merged
Conversation
Since v1.2 every generation's input carries the whole conversation so far. On a long session that is quadratic: each LLM call repeats every earlier message, and one span batch can exceed the OTLP exporter's 64 MiB request limit, which then drops the entire batch with only a stderr line. Measured re-sending one 165-turn session: 51 batches of 67-425 MB dropped. CC_LANGFUSE_CAPTURE_HISTORY (default true, upstream behaviour unchanged) set to false skips building the session history, so each generation carries its own new input only, as before v1.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
get_workflow_agents_in_run_dir kept only metas whose agentType was
"workflow-subagent", which is what an untyped spawn records. A workflow script
that names a type (agent(..., {agentType: 'round-writer'})) records that type
instead, so every such agent was dropped and the Workflow tool span came out
with no children. Measured on one session: 0 of ~1,000 round agents traced,
$990 of cost missing.
A workflow agent is now identified by living in the run directory without a
toolUseId (classic subagent) or taskKind (teammate), whatever its type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… limit The SDK default of 512 spans per OTLP request, with spans carrying up to MAX_CHARS of input and output each, reached the exporter's 64 MiB max_request_size; an over-limit batch is dropped whole (measured: five 67 MB batches dropped re-sending one session with history off). LANGFUSE_FLUSH_AT now defaults to 128 unless the user set it. 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.
Problem
Since upstream v1.2 (langfuse#80), every generation's input carries the conversation so far. On a long session this grows quadratically, because every LLM call repeats every earlier message.
What breaks:
max_request_size.Measured re-sending one 165-turn session with v1.2.1:
Change
CC_LANGFUSE_CAPTURE_HISTORY: an env var and a plugin userConfig option.true: upstream behaviour is unchanged.false: the hook skips building the session history, so each generation carries only its own new input, as before v1.2.Tests
test_history_opt_out_sends_only_each_turns_own_input.test_state_lock_contention, which also fails on a cleanupstream/main.Follow-up for TopCode
Set
CC_LANGFUSE_CAPTURE_HISTORY=falsein the repo's.claude/settings.jsonenv. Our sessions run to hundreds of turns, so history makes every LLM call repeat the whole session.🤖 Generated with Claude Code