Summary
The Braintrust trace-claude-code plugin's SessionStart hook has a race condition: set_cache_value() in common.sh performs a non-atomic read-modify-write on ~/.claude/state/braintrust_cache.json. Under concurrent eval runs, this corrupts the cache file and crashes claude -p after ~4 tests.
Current workaround
PR #840 sets TRACE_TO_BRAINTRUST=false in the spawned env to disable the plugin during eval runs. AgentV handles its own Braintrust tracing via braintrustSpanIds.
Proposed
Fork to plugins/agentv-claude-trace with:
Non-goals
- Changing the tracing protocol or span format
- Replacing AgentV's own
braintrustSpanIds mechanism
Related
Summary
The Braintrust
trace-claude-codeplugin'sSessionStarthook has a race condition:set_cache_value()incommon.shperforms a non-atomic read-modify-write on~/.claude/state/braintrust_cache.json. Under concurrent eval runs, this corrupts the cache file and crashesclaude -pafter ~4 tests.Current workaround
PR #840 sets
TRACE_TO_BRAINTRUST=falsein the spawned env to disable the plugin during eval runs. AgentV handles its own Braintrust tracing viabraintrustSpanIds.Proposed
Fork to
plugins/agentv-claude-tracewith:mv)set -efrom hooks (a cache miss shouldn't crash the session)TRACE_TO_BRAINTRUST=falseworkaround fromClaudeCliProvideronce the fork is stableNon-goals
braintrustSpanIdsmechanismRelated