Sundeep/eng 2362 handle user messages emitted by sub agents #823
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 problem(s) was I solving?
Sub-agent messages were appearing as regular user messages in the UI because only
tool_useevents captured theparent_tool_use_idfield from Claude stream events. This made it impossible to distinguish between actual user input and activity from sub-agents (agents launched via the Task tool).Additionally, when multiple approvals were pending, the status bar only showed "Pending Approval" without indicating how many approvals were waiting.
What user-facing changes did I ship?
parent_tool_use_idfor all conversation event types, enabling future UI work to distinguish sub-agent messages from user messagesHow I implemented it
Backend changes (hld/session/manager.go:1028-1269):
parent_tool_use_idcapture to all conversation event types inprocessStreamEvent():tool_useevents, causing sub-agent messages to lose their parent contextConversationEvent) and event bus publicationsFrontend changes (humanlayer-wui/src/components/internal/SessionDetail/components/ActiveSession.tsx:309-925):
pendingApprovalsCountstate to track total pending approvalscheckPendingApprovalVisibility()to count all pending approvals, not just check for existenceHow to verify it
make check test- All tests passed (412 unit tests, 46 integration tests)Manual Testing
Sub-agent message tracking:
parent_tool_use_idpopulated:Multiple approval count:
Description for the changelog
Fixed sub-agent message tracking by capturing
parent_tool_use_idfor all conversation event types. Added count display to pending approval status bar when multiple approvals are waiting.