Skip to content

Conversation

@rtfeldman
Copy link
Contributor

Summary

This PR adds the UI for displaying subagent tool calls:

Thread view changes

  • Add expanded_subagents state HashMap for tracking expanded cards
  • Implement render_subagent_tool_call() for collapsed card with label and chevron
  • Add subagent detection via is_subagent() and tool_name field
  • Handle SubagentThread content type in tool call rendering
  • Add expand/collapse toggle button for subagent cards
  • Style collapsed cards similar to terminal tool calls
  • Support inline image rendering in content blocks

Agent panel changes

  • Add open_external_thread_with_server() for testing with stubbed servers

Test support

  • Add acp_thread/test-support feature to agent_ui
  • Add base64 dev dependency for image tests

Part of stacked PRs

This is PR 3 of 4 for the subagents feature:

  • PR 1: Feature flag + tool skeleton
  • PR 2: Thread spawning + execution
  • PR 3: UI card rendering (this PR)
  • PR 4: Visual testing infrastructure

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 6, 2026
@rtfeldman rtfeldman force-pushed the subagents-pr3 branch 2 times, most recently from 58f6a6f to 0771296 Compare January 8, 2026 05:46
@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Jan 8, 2026
- Add SubagentDiffStats struct to compute lines added/removed from action_log
- Implement render_subagent_collapsed() showing status icon, label, and diff stats
- Implement render_subagent_portal() showing bounded scrollable subagent thread view
- Add compute_subagent_diff_stats() to extract diff information from subagent's action_log
- Add expanded_tool_calls_mut() method for testing
- Add visual tests for subagent UI states (collapsed running, portal, collapsed completed)
- Restore AgentSharingFeatureFlag that was accidentally removed in PR2
- Add subagent rendering at the entry level for proper tool call interception

The collapsed state displays:
- Spinning arrow icon for in-progress, checkmark for completed, X for failed
- Label from the subagent tool call
- File change stats with git-style coloring (+green, -red) when files are changed

The portal view displays:
- Header with ZedAgent icon, label, Expand Subagent button, and collapse chevron
- Bounded scrollable area (max 400px) with full thread content
- User messages, assistant messages, and nested tool calls
@rtfeldman rtfeldman force-pushed the subagents-pr3 branch 3 times, most recently from 308e093 to c539250 Compare January 8, 2026 14:26
…ations

This guide explains:
- How the visual test infrastructure works
- How to run visual tests and generate screenshots
- How to write tests that modify files to show diff stats
- How the diff stats computation works
- Debugging tips and common issues
- Key types and project structure

Also reorganizes subagent-related plans into plans/subagents/
zed-zippy bot and others added 3 commits January 8, 2026 14:37
This implements the visual tests described in plans/subagents/visual-tests.md:

## Visual Test Changes
- Add multiple stacked subagent cards (2 subagents with different tasks)
- Show diff stats on subagent cards (files changed, lines added/removed)
- Add mixed status display (one completed, one in-progress in running test)
- Add follow-up agent response text after subagents complete
- Reduce window height from 900px to 700px for more compact screenshots
- Add assistant message content before tool calls so subagents appear inline

## ActionLog Changes (for test support)
- Add test-support feature to action_log crate
- Add TrackedBuffer::diff() getter for test access
- Add TrackedBuffer::diff_base_len() for debugging
- Add ActionLog::tracked_buffers_for_debug() for iterating tracked buffers
- Add log dependency for debugging

## Technical Approach
The test bypasses ActionLog's async diff computation (which has race conditions
between User and Agent change authors) by:
1. Editing buffers first
2. Registering with buffer_created()
3. Directly setting BufferDiff base_text via set_base_text()

## Documentation
- Add plans/subagent-visual-test-improvements.md documenting remaining work:
  - Status icon not reflecting actual status (shows blue dot for all states)
  - Card width needs margins like other tool calls
- Completed: green checkmark (TodoComplete)
- In Progress: blue spinning icon (TodoProgress with animation)
- Failed/Canceled/Rejected: red X (XCircle)
- Pending/WaitingForConfirmation: gray circle (TodoPending)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants