@@ -13,7 +13,7 @@ use crate::commands::common::{
1313 format_timestamp_ms, handle_platform_progress_event, is_provisioning_progress_event,
1414 non_empty_or, parse_cli_setting_value, parse_duration_to_ms, phase_name,
1515 print_policy_merge_warnings, print_sandbox_header, print_sandbox_policy,
16- provisioning_timeout_message , ready_false_condition_message , scrub_git_env, short_hash,
16+ provisioning_blocker_message , provisioning_timeout_message , scrub_git_env, short_hash,
1717 truncate_status_field,
1818} ;
1919pub use crate :: commands:: gateway:: {
@@ -839,7 +839,7 @@ pub async fn sandbox_create(
839839 let mut last_phase = sandbox. phase ( ) ;
840840 let mut last_sandbox = sandbox. clone ( ) ;
841841 let mut last_error_reason = String :: new ( ) ;
842- let mut last_condition_message = ready_false_condition_message ( sandbox. status . as_ref ( ) ) ;
842+ let mut last_condition_message = provisioning_blocker_message ( sandbox. status . as_ref ( ) ) ;
843843 let provision_timeout = Duration :: from_secs (
844844 std:: env:: var ( "OPENSHELL_PROVISION_TIMEOUT" )
845845 . ok ( )
@@ -913,7 +913,7 @@ pub async fn sandbox_create(
913913 let phase = SandboxPhase :: try_from ( s. phase ( ) ) . unwrap_or ( SandboxPhase :: Unknown ) ;
914914 last_phase = s. phase ( ) ;
915915 last_sandbox = s. clone ( ) ;
916- if let Some ( message) = ready_false_condition_message ( s. status . as_ref ( ) ) {
916+ if let Some ( message) = provisioning_blocker_message ( s. status . as_ref ( ) ) {
917917 last_condition_message = Some ( message) ;
918918 }
919919
@@ -4242,7 +4242,7 @@ fn lifecycle_phase_error(
42424242 phase : SandboxPhase ,
42434243) -> Option < miette:: Report > {
42444244 if phase == SandboxPhase :: Error {
4245- let detail = ready_false_condition_message ( sandbox. status . as_ref ( ) )
4245+ let detail = provisioning_blocker_message ( sandbox. status . as_ref ( ) )
42464246 . unwrap_or_else ( || "sandbox entered Error" . to_string ( ) ) ;
42474247 return Some ( miette ! (
42484248 "{detail} while waiting for {}" ,
@@ -7128,7 +7128,7 @@ mod tests {
71287128 has_main_process_result, parse_cli_setting_value, parse_credential_expiry_cli_value,
71297129 parse_driver_config_json, parse_env_from_pairs, parse_secret_material_env_pairs,
71307130 policy_revision_list_json, policy_revision_to_json, proto_execution_timeout,
7131- provisioning_timeout_message , ready_false_condition_message , relay_local_socket,
7131+ provisioning_blocker_message , provisioning_timeout_message , relay_local_socket,
71327132 resolve_from, rootfs_tar_sources_supported_for_gateway, sandbox_should_persist,
71337133 sandbox_upload_plan, service_endpoint_to_json, service_status_error,
71347134 service_url_for_gateway, workspace_member_to_json,
@@ -8222,7 +8222,7 @@ mod tests {
82228222 }
82238223
82248224 #[ test]
8225- fn ready_false_condition_message_prefers_reason_and_message ( ) {
8225+ fn provisioning_blocker_message_prefers_reason_and_message ( ) {
82268226 let status = SandboxStatus {
82278227 agent_pod : "gpu-pod" . to_string ( ) ,
82288228 conditions : vec ! [ SandboxCondition {
@@ -8236,13 +8236,13 @@ mod tests {
82368236 } ;
82378237
82388238 assert_eq ! (
8239- ready_false_condition_message ( Some ( & status) ) . as_deref( ) ,
8239+ provisioning_blocker_message ( Some ( & status) ) . as_deref( ) ,
82408240 Some ( "Unschedulable: Another GPU sandbox may already be using the available GPU." )
82418241 ) ;
82428242 }
82438243
82448244 #[ test]
8245- fn ready_false_condition_message_ignores_non_ready_conditions ( ) {
8245+ fn provisioning_blocker_message_ignores_non_ready_conditions ( ) {
82468246 let status = SandboxStatus {
82478247 agent_pod : "gpu-pod" . to_string ( ) ,
82488248 conditions : vec ! [ SandboxCondition {
@@ -8255,11 +8255,11 @@ mod tests {
82558255 ..Default :: default ( )
82568256 } ;
82578257
8258- assert ! ( ready_false_condition_message ( Some ( & status) ) . is_none( ) ) ;
8258+ assert ! ( provisioning_blocker_message ( Some ( & status) ) . is_none( ) ) ;
82598259 }
82608260
82618261 #[ test]
8262- fn ready_false_condition_message_prefers_unschedulable_pod_scheduled_condition ( ) {
8262+ fn provisioning_blocker_message_prefers_unschedulable_pod_scheduled_condition ( ) {
82638263 let status = SandboxStatus {
82648264 agent_pod : "pending-pod" . to_string ( ) ,
82658265 conditions : vec ! [
@@ -8282,13 +8282,13 @@ mod tests {
82828282 } ;
82838283
82848284 assert_eq ! (
8285- ready_false_condition_message ( Some ( & status) ) . as_deref( ) ,
8285+ provisioning_blocker_message ( Some ( & status) ) . as_deref( ) ,
82868286 Some ( "Unschedulable: 0/11 nodes are available: 11 Insufficient cpu." )
82878287 ) ;
82888288 }
82898289
82908290 #[ test]
8291- fn ready_false_condition_message_ignores_scheduled_pod_condition ( ) {
8291+ fn provisioning_blocker_message_ignores_scheduled_pod_condition ( ) {
82928292 let status = SandboxStatus {
82938293 agent_pod : "scheduled-pod" . to_string ( ) ,
82948294 conditions : vec ! [
@@ -8311,13 +8311,13 @@ mod tests {
83118311 } ;
83128312
83138313 assert_eq ! (
8314- ready_false_condition_message ( Some ( & status) ) . as_deref( ) ,
8314+ provisioning_blocker_message ( Some ( & status) ) . as_deref( ) ,
83158315 Some ( "ConfigurationPending: Waiting for effective configuration validation" )
83168316 ) ;
83178317 }
83188318
83198319 #[ test]
8320- fn ready_false_condition_message_falls_back_when_pod_scheduled_has_no_detail ( ) {
8320+ fn provisioning_blocker_message_falls_back_when_pod_scheduled_has_no_detail ( ) {
83218321 let status = SandboxStatus {
83228322 agent_pod : "pending-pod" . to_string ( ) ,
83238323 conditions : vec ! [
@@ -8340,11 +8340,38 @@ mod tests {
83408340 } ;
83418341
83428342 assert_eq ! (
8343- ready_false_condition_message ( Some ( & status) ) . as_deref( ) ,
8343+ provisioning_blocker_message ( Some ( & status) ) . as_deref( ) ,
83448344 Some ( "ConfigurationPending" )
83458345 ) ;
83468346 }
83478347
8348+ #[ test]
8349+ fn lifecycle_phase_error_reports_scheduling_failure ( ) {
8350+ use super :: lifecycle_phase_error;
8351+ use openshell_core:: proto:: SandboxPhase ;
8352+
8353+ let sandbox = Sandbox {
8354+ status : Some ( SandboxStatus {
8355+ phase : SandboxPhase :: Error as i32 ,
8356+ conditions : vec ! [ SandboxCondition {
8357+ r#type: "PodScheduled" . into( ) ,
8358+ status: "False" . into( ) ,
8359+ reason: "Unschedulable" . into( ) ,
8360+ message: "0/5 nodes are available: 1 Too many pods" . into( ) ,
8361+ transition_time: None ,
8362+ } ] ,
8363+ ..Default :: default ( )
8364+ } ) ,
8365+ ..Default :: default ( )
8366+ } ;
8367+ let err = lifecycle_phase_error ( & sandbox, SandboxPhase :: Ready , SandboxPhase :: Error )
8368+ . expect ( "Error phase should fail the wait" ) ;
8369+ assert_eq ! (
8370+ err. to_string( ) ,
8371+ "Unschedulable: 0/5 nodes are available: 1 Too many pods while waiting for Ready"
8372+ ) ;
8373+ }
8374+
83488375 #[ test]
83498376 fn provisioning_timeout_message_includes_condition_and_gpu_hint ( ) {
83508377 let resource_requirements = ResourceRequirements {
0 commit comments