fix: code review fixes + agent-friendly docs#11
Merged
Conversation
- agent.py: move register_at_fork inside try block so fork handler is only registered on successful init; fix _initialized guard so is_lambda isn't reset on every Agent() call - agent_init.py: remove register_at_fork from AgentInit.__init__ to eliminate duplicate fork hook registrations; expose _init_exporter as public init_exporter - plugins/builtin/pipeline.py: call init_exporter (no longer private); remove AgentInit instantiation that was registering a third fork hook - plugins/control.py: add double-checked locking to ControlRegistry.__new__ for thread-safe singleton construction - config/config.py: add double-checked locking to Config.__new__; use getattr for _instance to handle test teardown that deletes the attr; remove dead inner `if key in overriding_config` check in merge_config - sampling_span_processor.py: replace with backwards-compat shim; rename class to DbControlSpanProcessor in new db_control_span_processor.py - tests: update to use init_exporter and db_control_span_processor module - CLAUDE.md: add agent orientation doc covering env vars, plugin system, key files, pipeline diagram, and build/test instructions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> AI-Session-Id: b304dbed-aac0-46f5-821c-a12c4bb7e10d AI-Tool: claude-code AI-Model: unknown
Content lives in AGENTS.md (Codex/OpenAI agents convention); CLAUDE.md is a symlink so Claude Code picks it up too. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> AI-Session-Id: b304dbed-aac0-46f5-821c-a12c4bb7e10d AI-Tool: claude-code AI-Model: unknown
|
|
t-santoshsahu
approved these changes
Jul 5, 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.
Summary
register_at_forkmoved inside thetryblock inAgent.__init__so the hook only registers on successful init; removed duplicate registrations fromAgentInit.__init__andBuiltinPipelinePlugin.on_initis_lambdaandregister_at_forknow only execute after_initialized = True, preventing a broken post-fork state if init throwsControlRegistry.__new__andConfig.__new__SamplingSpanProcessor→DbControlSpanProcessor(file:db_control_span_processor.py); old module kept as a backwards-compat shimAgentInit._init_exporterpromoted to publicinit_exporter;BuiltinPipelinePluginno longer instantiates a privateAgentInitif key in overriding_configguard inmerge_configAGENTS.mdwith env vars, plugin system, key files, pipeline diagram, build/test instructions;CLAUDE.mdsymlinks to itTest plan
pytest test/db_control_span_processor_test.py test/sampling_span_processor_test.py test/config/ test/init/ test/filter/— all 38 passfrom harness_sdk.sampling_span_processor import SamplingSpanProcessorstill works via shimpost_forkcall per fork (no duplicate provider/propagation reinit)🤖 Generated with Claude Code