Repository navigation
fix(hook): trace subagents launched by subagents - #102
Merged
Merged
Conversation
emit_subagent_observations walked an agent's turns with no subagent transcript map, so an Agent call inside a subagent produced a Tool span but never the inner agent's own span, generations or tools. Pass the map through so nested agents nest under their launching agent.
|
|
hassiebp
approved these changes
Oct 6, 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.
Subagents launched by another subagent were never traced. This passes the subagent transcript map down so they nest under the agent that launched them.
Problem
emit_subagent_observationswalked an agent's turns withsubagent_transcripts_by_tool_use_id=None. AnAgentcall inside a subagent therefore got aTool: Agentspan but no span of its own: none of its generations or tool calls were emitted, even though its transcript (spawnDepth: 2) is on disk and already in the map.Fix
emit_subagent_observationstakes the map and hands it toemit_turn_observationsfor the agent's turns.Testing
test_nested_subagents_document_current_non_recursive_emission_behaviorasserted the gap. It's nowtest_nested_subagents_emit_inner_agent_under_outer_agentand requires the inner agent's span under the outer agent, with a generation under it. It fails before the fix and passes after.uv run --group dev pytest: 279 passed, also on Python 3.10.ruff check --select F,E9is clean.Subagent: <inner> ← Subagent: <outer> ← Conversational Turn, including the inner agent's Bash call.