Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ version-compare = "0.1"
vte = { git = "https://github.com/warpdotdev/vte.git", rev = "4b399c87b63ba88f45709edaa6383fc519f6c900", default-features = false }
walkdir = "2"
warp-workflows = { git = "https://github.com/warpdotdev/workflows", rev = "793a98ddda6ef19682aed66364faebd2829f0e01" }
warp_multi_agent_api = { git = "https://github.com/warpdotdev/warp-proto-apis.git", rev = "60d3132feffaca7e3abfe465e38ba0b72d32dee0" }
warp_multi_agent_api = { git = "https://github.com/warpdotdev/warp-proto-apis.git", rev = "3d26f166b74469d5c12080ef6a3423fadee4d0e3" }
wasm-bindgen = "0.2.89"
wasm-bindgen-futures = "0.4.42"
web-sys = { version = "0.3.69", features = [
Expand Down
4 changes: 4 additions & 0 deletions app/src/ai/agent/api/convert_from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ fn convert_run_agents(
name: config.name,
prompt: config.prompt,
title: config.title,
agent_identity_uid: config.agent_identity_uid,
})
.collect(),
plan_id,
Expand Down Expand Up @@ -198,6 +199,9 @@ fn convert_start_agent_v2_execution_mode(
// Auth secret is plumbed client-side via `RunAgentsRequest`;
// StartAgentV2 from the server never carries it.
auth_secret_name: None,
// Agent identity is plumbed client-side via `RunAgentsRequest`;
// StartAgentV2 from the server never carries it.
agent_identity_uid: None,
}
}
Some(api::start_agent_v2::execution_mode::Mode::Local(local)) => {
Expand Down
2 changes: 2 additions & 0 deletions app/src/ai/agent/api/convert_from_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ fn converts_remote_start_agent_with_environment_id() {
harness_type: String::new(),
title: String::new(),
auth_secret_name: None,
agent_identity_uid: None,
}
);
assert_eq!(lifecycle_subscription, None);
Expand Down Expand Up @@ -580,6 +581,7 @@ fn converts_remote_start_agent_v2_with_skill_references() {
harness_type: "claude-code".to_string(),
title: "Remote child".to_string(),
auth_secret_name: None,
agent_identity_uid: None,
}
);
assert_eq!(lifecycle_subscription, None);
Expand Down
11 changes: 11 additions & 0 deletions app/src/ai/blocklist/action_model/execute/run_agents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,15 @@ pub fn run_agents_to_start_agent_mode(
) -> Result<StartAgentExecutionMode, String> {
match run_execution_mode {
RunAgentsExecutionMode::Local => {
// Named-agent identity requires the public-API dispatch path, which
// only remote children use. Mirrors server-side validation.
if !cfg.agent_identity_uid.trim().is_empty() {
return Err(
"agent_identity_uid requires remote execution; local child agents cannot \
run as a different named agent."
.to_string(),
);
}
let trimmed = run_harness_type.trim();
// Propagate run-wide model selection for local launches.
let trimmed_model_id = run_model_id.trim();
Expand Down Expand Up @@ -723,6 +732,8 @@ pub fn run_agents_to_start_agent_mode(
auth_secret_name: run_auth_secret_name
.map(str::to_string)
.filter(|s| !s.trim().is_empty()),
agent_identity_uid: Some(cfg.agent_identity_uid.clone())
.filter(|s| !s.trim().is_empty()),
})
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/ai/blocklist/action_model/execute/run_agents_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ fn remote_run_agents_action(harness_type: &str) -> AIAgentAction {
name: "child".to_string(),
prompt: "Help".to_string(),
title: String::new(),
agent_identity_uid: String::new(),
}],
plan_id: String::new(),
harness_auth_secret_name: None,
Expand All @@ -258,6 +259,7 @@ fn local_codex_run_agents_maps_to_local_harness_mode_when_flag_enabled() {
name: "child".to_string(),
prompt: "Investigate the failure".to_string(),
title: String::new(),
agent_identity_uid: String::new(),
};

let mode = run_agents_to_start_agent_mode(
Expand Down
2 changes: 2 additions & 0 deletions app/src/ai/blocklist/action_model/execute/start_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ impl StartAgentExecutor {
harness_type,
title,
auth_secret_name,
agent_identity_uid,
} => {
let harness_type = Harness::parse_orchestration_harness(&harness_type)
.map(|harness| harness.to_string())
Expand Down Expand Up @@ -479,6 +480,7 @@ impl StartAgentExecutor {
harness_type,
title,
auth_secret_name,
agent_identity_uid,
},
Some(parent_run_id),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ fn execute_returns_error_when_remote_opencode_harness_is_requested() {
harness_type: "opencode".to_string(),
title: String::new(),
auth_secret_name: None,
agent_identity_uid: None,
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fn start_agent_copy_uses_remote_labels_for_remote_children() {
harness_type: String::new(),
title: String::new(),
auth_secret_name: None,
agent_identity_uid: None,
};

assert_eq!(start_agent_success_suffix(&execution_mode), " remotely.");
Expand Down
39 changes: 39 additions & 0 deletions app/src/ai/blocklist/block_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ fn agent_cfg() -> RunAgentsAgentRunConfig {
name: "child".to_string(),
prompt: "do X".to_string(),
title: "Child".to_string(),
agent_identity_uid: String::new(),
}
}

Expand Down Expand Up @@ -413,6 +414,7 @@ fn remote_arm_propagates_skills_into_skill_references() {
computer_use_enabled,
title,
auth_secret_name,
agent_identity_uid,
} = mode
else {
panic!("expected Remote start-agent mode");
Expand All @@ -425,6 +427,43 @@ fn remote_arm_propagates_skills_into_skill_references() {
assert!(computer_use_enabled);
assert_eq!(title, "Child");
assert_eq!(auth_secret_name, None);
assert_eq!(agent_identity_uid, None);
}

#[test]
fn remote_arm_propagates_agent_identity_uid() {
let mut cfg = agent_cfg();
cfg.agent_identity_uid = "sa-uid-1".to_string();
let mode = run_agents_to_start_agent_mode(
&RunAgentsExecutionMode::Remote {
environment_id: "env-1".to_string(),
worker_host: "warp".to_string(),
computer_use_enabled: false,
},
"oz",
"auto",
&[],
None,
&cfg,
)
.expect("Remote+oz must convert");
let StartAgentExecutionMode::Remote {
agent_identity_uid, ..
} = mode
else {
panic!("expected Remote start-agent mode");
};
assert_eq!(agent_identity_uid.as_deref(), Some("sa-uid-1"));
}

#[test]
fn local_arm_rejects_agent_identity_uid() {
let mut cfg = agent_cfg();
cfg.agent_identity_uid = "sa-uid-1".to_string();
let err =
run_agents_to_start_agent_mode(&RunAgentsExecutionMode::Local, "", "", &[], None, &cfg)
.expect_err("Local + agent_identity_uid must be rejected");
assert!(err.contains("agent_identity_uid requires remote execution"));
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fn make_request_with_skills(
name: "child".to_string(),
prompt: "do work".to_string(),
title: "Child agent".to_string(),
agent_identity_uid: String::new(),
}],
plan_id: String::new(),
harness_auth_secret_name: None,
Expand Down
8 changes: 7 additions & 1 deletion app/src/pane_group/pane/terminal_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@ fn dispatch_start_agent_conversation(
harness_type,
title,
auth_secret_name,
agent_identity_uid,
} => {
launch_remote_child(
group,
Expand All @@ -1609,6 +1610,7 @@ fn dispatch_start_agent_conversation(
harness_type,
title,
auth_secret_name,
agent_identity_uid,
},
ctx,
);
Expand Down Expand Up @@ -1922,6 +1924,9 @@ struct RemoteLaunchFields {
/// harness credentials. Resolved to `AgentConfigSnapshot.harness_auth_secrets`
/// when applicable.
auth_secret_name: Option<String>,
/// UID of the named agent (service account) the remote child should
/// execute as; forwarded to `SpawnAgentRequest.agent_identity_uid`.
agent_identity_uid: Option<String>,
}

/// Sets up a hidden ambient-agent pane for a Remote child agent: creates the
Expand Down Expand Up @@ -1953,6 +1958,7 @@ fn launch_remote_child(
harness_type,
title,
auth_secret_name,
agent_identity_uid,
} = fields;

let request_id = request.id;
Expand Down Expand Up @@ -2094,7 +2100,7 @@ fn launch_remote_child(
referenced_attachments: vec![],
conversation_id: None,
initial_snapshot_token: None,
agent_identity_uid: None,
agent_identity_uid: agent_identity_uid.filter(|uid| !uid.trim().is_empty()),
snapshot_disabled: should_disable_snapshot(ctx).then_some(true),
orchestration_handoff: None,
};
Expand Down
9 changes: 9 additions & 0 deletions crates/ai/src/agent/action/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ pub struct RunAgentsAgentRunConfig {
pub name: String,
pub prompt: String,
pub title: String,
/// Optional UID of the named agent (service account) this child run
/// should execute as. Empty means the child runs as the caller. Only
/// meaningful for factory agents dispatching sibling factory agents;
/// requires remote execution and is enforced server-side at dispatch.
pub agent_identity_uid: String,
}

#[derive(Debug, Clone, Eq, PartialEq)]
Expand Down Expand Up @@ -281,6 +286,9 @@ pub enum StartAgentExecutionMode {
/// `None` means no client-side secret was selected — the remote
/// environment falls back to its own ambient credentials.
auth_secret_name: Option<String>,
/// UID of the named agent (service account) the remote child run
/// should execute as. `None` means the child runs as the caller.
agent_identity_uid: Option<String>,
},
}

Expand Down Expand Up @@ -311,6 +319,7 @@ impl StartAgentExecutionMode {
harness_type: String::new(),
title: String::new(),
auth_secret_name: None,
agent_identity_uid: None,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/ai/src/agent/orchestration_config_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ fn make_request(model: &str, harness: &str, remote: bool) -> RunAgentsRequest {
name: "a".to_string(),
prompt: String::new(),
title: String::new(),
agent_identity_uid: String::new(),
}],
plan_id: String::new(),
harness_auth_secret_name: None,
Expand Down
Empty file removed review.json
Empty file.
Loading