Skip to content
Draft
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
5 changes: 5 additions & 0 deletions app/src/ai/agent_sdk/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ struct RunnerInfo {
docker_image: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
macos_version: Option<String>,
factory_uid: Option<String>,
scope: String,
setup_commands: Vec<String>,
#[serde(skip_serializing)]
Expand Down Expand Up @@ -515,6 +516,10 @@ impl RunnerInfo {
.as_ref()
.and_then(|m| m.version)
.map(|v| macos_version_display(v).to_string()),
factory_uid: config
.factory_uid
.as_ref()
.map(|uid| uid.inner().to_string()),
scope: space_display(runner.scope.type_).to_string(),
setup_commands: config.setup_commands.clone().unwrap_or_default(),
last_updated_display: format_approx_duration_from_now_utc(last_updated_utc),
Expand Down
34 changes: 32 additions & 2 deletions app/src/ai/agent_sdk/runner_tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::{
RunnerArch, RunnerArchArg, RunnerOsArg, confirm_delete, merge_instance_shape, resolve_arch,
resolve_updated_name,
RunnerArch, RunnerArchArg, RunnerInfo, RunnerOsArg, confirm_delete, merge_instance_shape,
resolve_arch, resolve_updated_name,
};
use chrono::Utc;

#[test]
fn confirm_delete_refuses_non_interactive_without_force() {
Expand Down Expand Up @@ -78,3 +79,32 @@ fn resolve_updated_name_renames_only_with_uid() {
// No UID: --name is the selector, so the name is unchanged.
assert_eq!(resolve_updated_name(false, Some("old"), "old"), "old");
}

#[test]
fn runner_info_serializes_nullable_factory_uid() {
let mut info = RunnerInfo {
uid: "runner-123".to_string(),
name: "Factory runner".to_string(),
description: None,
os: "Linux".to_string(),
arch: "x86-64".to_string(),
vcpus: None,
memory_gb: None,
docker_image: None,
macos_version: None,
factory_uid: Some("factory-123".to_string()),
scope: "Team".to_string(),
setup_commands: Vec::new(),
last_updated_display: "now".to_string(),
last_updated_utc: Utc::now(),
};

let json = serde_json::to_value(&info).expect("RunnerInfo should serialize");

assert_eq!(json["factory_uid"], "factory-123");

info.factory_uid = None;
let json = serde_json::to_value(&info).expect("RunnerInfo should serialize");

assert!(json["factory_uid"].is_null());
}
1 change: 1 addition & 0 deletions crates/graphql/src/api/queries/get_runners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ pub struct RunnerConfig {
pub arch: RunnerArch,
pub mac: Option<MacOsConfig>,
pub linux: Option<LinuxConfig>,
pub factory_uid: Option<cynic::Id>,
}

#[derive(cynic::QueryFragment, Debug)]
Expand Down
1 change: 1 addition & 0 deletions crates/warp_graphql_schema/api/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3032,6 +3032,7 @@ type RunnerConfig {
arch: RunnerArch!
mac: MacOSConfig
linux: LinuxConfig
factoryUid: ID
}

type Runner {
Expand Down