Skip to content

Conversation

@rtfeldman
Copy link
Contributor

Summary

This PR adds visual testing infrastructure for the subagents feature:

Visual test runner enhancements

  • Add agent panel visual test for thread with image
  • Support acp_thread, agent, agent_servers dependencies for visual tests
  • Add embedded test image constant
  • Initialize prompt_store and language_model subsystems
  • Add app assets to Application builder

Test support helpers in connection.rs

  • Add create_test_png_base64() for generating test PNG images
  • Add StubModelSelector for mocking model selection in tests
  • Add model_selector() to StubAgentConnection

Build configuration

  • Add acp_thread, agent, agent_servers, agent-client-protocol to visual-tests feature
  • Add base64 dependency for image encoding in tests
  • Add db/test-support for database testing

Part of stacked PRs

This is PR 4 of 4 for the subagents feature:

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

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 6, 2026
rtfeldman and others added 4 commits January 7, 2026 13:26
- Add SubagentsFeatureFlag with staff-disabled default
- Create SubagentTool with input schema for task/summary/context-low prompts
- Register SubagentTool conditionally when feature flag is enabled
- Tool returns stub message 'not yet implemented' for now

Amp-Thread-ID: https://ampcode.com/threads/T-019b94c4-0a15-7799-aba2-83a644590a2e
Co-authored-by: Amp <[email protected]>
- Add SubagentsFeatureFlag with staff-disabled default
- Create SubagentTool with input schema for task/summary/context-low prompts
- Register SubagentTool conditionally when feature flag is enabled
- Tool returns stub message 'not yet implemented' for now

Amp-Thread-ID: https://ampcode.com/threads/T-019b94c4-0a15-7799-aba2-83a644590a2e
Co-authored-by: Amp <[email protected]>
Core subagent execution:
- Add Thread::new_subagent() constructor for creating subagent threads
- Implement SubagentTool::run() to spawn and manage subagent lifecycle
- Add SubagentContext for parent-child thread relationship
- Implement submit_user_message(), interrupt_for_summary(), request_final_summary()
- Add timeout support and context-low detection
- Propagate cancellation from parent to child threads

Thread management:
- Add MAX_SUBAGENT_DEPTH (4) and MAX_PARALLEL_SUBAGENTS (8) limits
- Add register/unregister_running_subagent() for tracking
- Add restrict_tools() for allowed_tools filtering
- Add is_subagent(), depth(), is_turn_complete() accessors

ACP thread changes:
- Add ToolCallContent::SubagentThread variant
- Add ToolCallUpdateSubagentThread for UI updates
- Add tool_name field for subagent detection
- Add is_subagent() method on ToolCall
- Add image support in ContentBlock

Comprehensive test coverage for all subagent scenarios
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
rtfeldman and others added 3 commits January 7, 2026 13:27
- Add SubagentsFeatureFlag with staff-disabled default
- Create SubagentTool with input schema for task/summary/context-low prompts
- Register SubagentTool conditionally when feature flag is enabled
- Tool returns stub message 'not yet implemented' for now

Amp-Thread-ID: https://ampcode.com/threads/T-019b94c4-0a15-7799-aba2-83a644590a2e
Co-authored-by: Amp <[email protected]>
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
Visual test runner enhancements:
- Add agent panel visual test for thread with image
- Support acp_thread, agent, agent_servers dependencies for visual tests
- Add embedded test image constant
- Initialize prompt_store and language_model subsystems
- Add app assets to Application builder

Test support helpers in connection.rs:
- Add create_test_png_base64() for generating test PNG images
- Add StubModelSelector for mocking model selection in tests
- Add model_selector() to StubAgentConnection

Build configuration:
- Add acp_thread, agent, agent_servers, agent-client-protocol to visual-tests feature
- Add base64 dependency for image encoding in tests
- Add db/test-support for database testing
@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Jan 8, 2026
@rtfeldman rtfeldman force-pushed the subagents-pr3 branch 3 times, most recently from c539250 to 3c32d6f Compare January 8, 2026 14:27
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