Skip to content

Stage 2 Client: OrchestrationConfig on Plan Card + Auto-Launch + Disabled Card#9927

Draft
cephalonaut wants to merge 10 commits intomatthew/orchestration-tool-2from
matthew/orchestration-tool-2-stage-2
Draft

Stage 2 Client: OrchestrationConfig on Plan Card + Auto-Launch + Disabled Card#9927
cephalonaut wants to merge 10 commits intomatthew/orchestration-tool-2from
matthew/orchestration-tool-2-stage-2

Conversation

@cephalonaut
Copy link
Copy Markdown
Contributor

Description

Stage 2 client implementation for the run_agents orchestration tool. Builds on top of Stage 1 (in review on matthew/orchestration-tool-2).

What: Adds plan-attached OrchestrationConfig with inline config block on plan cards, client-side auto-launch when a run_agents call matches the active approved config, server-immediate-deny rendering (disabled card) when the user has disapproved orchestration, and dirty-sync transport to piggyback user config edits on outbound requests.

Key changes:

  • Shared control extraction — Extracted ~720 lines of picker/render code from RunAgentsCardView into a reusable orchestration_controls.rs module with OrchestrationControlAction trait for action-type generics. Refactored the Stage 1 card to use it (1394→850 lines, all 19 tests pass).
  • Rust-native typesOrchestrationConfig, OrchestrationExecutionMode, OrchestrationConfigStatus in crates/ai with matches_active_config() pure function and proto round-trip conversions (15 unit tests).
  • AIDocumentModel state — Conversation-level orchestration config fields, OrchestrationConfigUpdated event, hydration from OrchestrationConfigSnapshot messages, dirty-event lifecycle.
  • Plan card config blockOrchestrationConfigBlockView with "Use orchestration" toggle, Cloud/Local mode selector, harness/host/environment/model dropdowns. Embedded in AIDocumentView above the editor.
  • Dirty-sync transportAIAgentInput::OrchestrationConfigUpdate variant piggybacked on outbound requests via BlocklistAIController.send_query().
  • Auto-launchRunAgentsCardView skips confirmation when active config is Approved and matches the call fields.
  • Disabled card — Static non-interactive card rendered when server returns RunAgentsResult::Denied.

Telemetry outcome differentiation (auto_launched, approved, approved_modified, disapproved) is deferred.

Plan · Conversation

Testing

  • 15 unit tests for matches_active_config() covering exact match, per-field mismatches, empty field inheritance, non-match-check field exclusion, and proto round-trips
  • All 19 existing RunAgentsCardView tests pass after refactor
  • cargo fmt and cargo check pass

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Co-Authored-By: Oz oz-agent@warp.dev

cephalonaut and others added 6 commits May 2, 2026 14:12
…ypes

- Add OrchestrationConfig, OrchestrationExecutionMode, OrchestrationConfigStatus
  types in crates/ai/src/agent/orchestration_config.rs with matches_active_config()
  pure function and proto round-trip conversions (15 unit tests).
- Extract shared orchestration controls into
  app/src/ai/blocklist/inline_action/orchestration_controls.rs:
  OrchestrationEditState, OrchestrationControlAction trait, generic picker
  creation/population/sync/render helpers (~720 lines).
- Refactor RunAgentsCardView to delegate to shared module (1394→850 lines).
  All 19 existing card view tests pass unchanged.

Co-Authored-By: Oz <oz-agent@warp.dev>
- Add conversation-level orchestration config fields: orchestration_config,
  orchestration_status, orchestration_plan_id, dirty_orchestration_event
- Add DirtyOrchestrationEvent struct for dirty-sync transport
- Add OrchestrationConfigUpdated event variant
- Add accessors: active_orchestration_config(), orchestration_status(),
  dirty_orchestration_event(), clear_dirty_orchestration_event()
- Add mutators: set_orchestration_config(), set_orchestration_status()
- Add hydrate_orchestration_config_from_snapshot() for server snapshot ingestion
- Handle new event variant in AIDocumentView and PlanAndTodoListView matches

Co-Authored-By: Oz <oz-agent@warp.dev>
- Create OrchestrationConfigBlockView in app/src/ai/document/orchestration_config_block.rs
  with 'Use orchestration' toggle, Cloud/Local mode selector, and all picker
  dropdowns (harness, host, environment, base model) using shared controls.
- Approved state shows full controls; disapproved state hides them.
- Embed config block in AIDocumentView render above the editor content,
  conditionally shown when AIDocumentModel has an active orchestration config.
- Subscribe to OrchestrationConfigUpdated events for re-rendering.
- Field edits and toggle changes route through AIDocumentModel.set_orchestration_config()
  which sets the dirty flag for the dirty-sync transport (Phase 4).

Co-Authored-By: Oz <oz-agent@warp.dev>
- Add AIAgentInput::OrchestrationConfigUpdate variant for piggybacking
  user config edits on outbound requests.
- Hook BlocklistAIController.send_query() to collect the dirty event from
  AIDocumentModel before send_request_input, and clear it after.
- Extend convert_input_to_user_input() to convert OrchestrationConfigUpdate
  to the proto OrchestrationConfigUpdate UserInput wire format.
- Handle new variant in all exhaustive match statements across the codebase
  (redaction, persistence, telemetry, SDK driver, view_impl, etc.).

Co-Authored-By: Oz <oz-agent@warp.dev>
Add auto-launch path: when the active orchestration config is approved
and matches the request, the card immediately dispatches
execute_run_agents() and renders in spawning state from the start
(no confirmation UI).

Add denied card: at construction, detect existing Denied results in
history and render a static disabled card with Cancelled styling.

Thread active orchestration config from AIDocumentModel through
AIBlock::ensure_run_agents_card_view() to RunAgentsCardView::new().

Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label May 2, 2026
cephalonaut and others added 4 commits May 2, 2026 14:46
The Flex::column() wrapping the editor gave unbounded height to its
children. The editor's Scrollable requires a finite height constraint.
Fix by making the editor an Expanded child so it fills remaining space
after the config block with a bounded constraint.

Co-Authored-By: Oz <oz-agent@warp.dev>
- Remove unused imports OrchestrationConfig and ModelHandle in orchestration_config_block.rs
- Fix unused closure parameter ctx -> _ in controller.rs
- Replace .clone() with copy dereference for UiComponentStyles in orchestration_controls.rs

Co-Authored-By: Oz <oz-agent@warp.dev>
AIDocumentModel was missing the subscription to BlocklistAIHistoryModel
that triggers scanning for OrchestrationConfigSnapshot messages in the
conversation task list. Without this, the server-set config never
populated the model and the plan card config block never appeared.

- Subscribe to AppendedExchange, UpdatedStreamingExchange, and
  RestoredConversations events
- Scan all tasks in the conversation for the OrchestrationConfigSnapshot
  message variant
- Clone the snapshot to release the history borrow before calling
  hydrate_orchestration_config_from_snapshot with &mut ctx

Co-Authored-By: Oz <oz-agent@warp.dev>
Auto-launch was triggering unintentionally because AIDocumentModel is a
singleton that carries orchestration config across conversations. A config
set in one conversation would cause run_agents calls in unrelated
conversations to auto-launch without showing the confirmation card.

Disable auto-launch entirely (hardcode false) until the active config is
properly scoped to the owning conversation. The confirmation card flow
continues to work normally.

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant