这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@balanceiskey
Copy link
Contributor

@balanceiskey balanceiskey commented Oct 28, 2025

What problem(s) was I solving?

Sub-agent messages were appearing as regular user messages in the UI because only tool_use events captured the parent_tool_use_id field 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?

  1. Sub-agent message tracking (backend): The system now properly captures parent_tool_use_id for all conversation event types, enabling future UI work to distinguish sub-agent messages from user messages
  2. Multiple approval count: The pending approval status bar now shows the count when there are multiple pending approvals (e.g., "3 Pending Approvals" instead of just "Pending Approval")

How I implemented it

Backend changes (hld/session/manager.go:1028-1269):

  • Extended parent_tool_use_id capture to all conversation event types in processStreamEvent():
    • System events (session creation notifications)
    • Text message content blocks
    • Tool result blocks
    • Thinking blocks
  • Previously this field was only captured for tool_use events, causing sub-agent messages to lose their parent context
  • The field is now included in both database storage (ConversationEvent) and event bus publications

Frontend changes (humanlayer-wui/src/components/internal/SessionDetail/components/ActiveSession.tsx:309-925):

  • Added pendingApprovalsCount state to track total pending approvals
  • Modified checkPendingApprovalVisibility() to count all pending approvals, not just check for existence
  • Updated the pending approval status bar to conditionally show count: "Pending Approval" (singular) vs "N Pending Approvals" (plural)
  • Improved visibility checking to use the first pending approval for scroll position calculation

How to verify it

  • make check test - All tests passed (412 unit tests, 46 integration tests)
  • All linting and type checking passed
  • Manual testing required (see below)

Manual Testing

Sub-agent message tracking:

  1. Launch a Claude Code session through the WUI
  2. Use the Task tool to launch a sub-agent
  3. Verify in the database that conversation events from the sub-agent have parent_tool_use_id populated:
    sqlite3 ~/.humanlayer/daemon-dev.db "SELECT id, event_type, role, content, parent_tool_use_id FROM conversation_events WHERE parent_tool_use_id IS NOT NULL LIMIT 5;"
  4. Note: UI rendering of sub-agent messages differently is NOT implemented yet - this PR just ensures the data is captured

Multiple approval count:

  1. Create a session that generates multiple pending approvals
  2. Observe the pending approval status bar shows count (e.g., "2 Pending Approvals")
  3. When scrolled away from pending approvals, click the status bar to scroll to the first pending approval

Description for the changelog

Fixed sub-agent message tracking by capturing parent_tool_use_id for all conversation event types. Added count display to pending approval status bar when multiple approvals are waiting.

balanceiskey and others added 2 commits October 28, 2025 09:36
Updates the pending approval status bar to display the count of pending
approvals when there are multiple (e.g. "3 Pending Approvals" vs "Pending
Approval"). This helps users understand how many approvals are waiting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Previously only tool_use events captured parent_tool_use_id from the stream event,
causing sub-agent messages to appear as regular user messages in the UI. Now all
event types (text, tool_result, thinking, system) properly capture this field to
enable distinguishing sub-agent activity from actual user input.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to d6ba1eb in 1 minute and 1 seconds. Click for details.
  • Reviewed 152 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. hld/session/manager.go:1030
  • Draft comment:
    Added propagation of ParentToolUseID to the conversation event (and bus event) for system, message, tool_call, tool_result, and thinking events. Ensure that this field is consistently set and handled across the event processing pipelines.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to ensure that a field is consistently set and handled across the event processing pipelines. This falls under the category of asking the author to ensure something is done, which is against the rules.
2. humanlayer-wui/src/components/internal/SessionDetail/components/ActiveSession.tsx:308
  • Draft comment:
    Introduced pendingApprovalsCount state and updated the pending approvals visibility check. Verify that filtering by ApprovalStatus.Pending and subsequent UI message (singular/plural) works as expected.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify that the filtering and UI message work as expected. This falls under the category of asking the author to ensure the behavior is intended or tested, which is against the rules.

Workflow ID: wflow_TXzSba3vbzurYeDp

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@K-Mistele
Copy link
Contributor

nice LGTM

@K-Mistele K-Mistele merged commit 2eb4c96 into humanlayer:main Oct 28, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants