@@ -1608,6 +1608,14 @@ enum SandboxCommands {
16081608 #[ arg( long, value_hint = ValueHint :: FilePath ) ]
16091609 policy : Option < String > ,
16101610
1611+ /// Freeze the first accepted policy and provider authorization until the sandbox is deleted.
1612+ ///
1613+ /// Policy edits, proposal approvals, and provider attach or detach
1614+ /// then fail; recreate the sandbox to change them. Every gateway
1615+ /// replica must support frozen policies.
1616+ #[ arg( long) ]
1617+ frozen : bool ,
1618+
16111619 /// Forward a local port to the sandbox before the initial command or shell starts.
16121620 /// Accepts [`bind_address`:]port (e.g. 8080, 0.0.0.0:8080). Keeps the sandbox alive.
16131621 #[ arg( long, conflicts_with = "no_keep" ) ]
@@ -1767,6 +1775,11 @@ enum SandboxCommands {
17671775 #[ arg( long) ]
17681776 selector : Option < String > ,
17691777
1778+ /// Show only sandboxes created with `--frozen`, with their freeze state.
1779+ /// Pages without a frozen sandbox are skipped.
1780+ #[ arg( long) ]
1781+ frozen : bool ,
1782+
17701783 /// Output format.
17711784 #[ arg( short = 'o' , long = "output" , value_enum, default_value_t = OutputFormat :: Table , conflicts_with_all = [ "ids" , "names" ] ) ]
17721785 output : OutputFormat ,
@@ -3637,6 +3650,7 @@ async fn run_async() -> Result<()> {
36373650 driver_config_json,
36383651 providers,
36393652 policy,
3653+ frozen,
36403654 forward,
36413655 expose,
36423656 expose_authorization_mode,
@@ -3753,6 +3767,7 @@ async fn run_async() -> Result<()> {
37533767 restart_policy : & restart_policy,
37543768 provision_timeout_secs : timeout. map ( std:: num:: NonZeroU32 :: get) ,
37553769 create_retry_timeout_secs,
3770+ frozen,
37563771 } ,
37573772 & cli. workspace ,
37583773 & tls,
@@ -3837,6 +3852,7 @@ async fn run_async() -> Result<()> {
38373852 ids,
38383853 names,
38393854 selector,
3855+ frozen,
38403856 output,
38413857 all_workspaces,
38423858 } => {
@@ -3847,6 +3863,11 @@ async fn run_async() -> Result<()> {
38473863 ids,
38483864 names,
38493865 selector. as_deref ( ) ,
3866+ if frozen {
3867+ run:: SandboxListFilter :: Frozen
3868+ } else {
3869+ run:: SandboxListFilter :: All
3870+ } ,
38503871 output. as_str ( ) ,
38513872 & cli. workspace ,
38523873 all_workspaces,
@@ -6741,6 +6762,38 @@ mod tests {
67416762 }
67426763 }
67436764
6765+ #[ test]
6766+ fn sandbox_create_frozen_supports_inline_and_named_templates ( ) {
6767+ for args in [
6768+ vec ! [ "openshell" , "sandbox" , "create" , "--frozen" ] ,
6769+ vec ! [
6770+ "openshell" ,
6771+ "sandbox" ,
6772+ "create" ,
6773+ "--template" ,
6774+ "agent" ,
6775+ "--frozen" ,
6776+ ] ,
6777+ ] {
6778+ let cli = Cli :: try_parse_from ( args) . unwrap ( ) ;
6779+ assert ! ( matches!(
6780+ cli. command,
6781+ Some ( Commands :: Sandbox {
6782+ command: Some ( SandboxCommands :: Create { frozen: true , .. } ) ,
6783+ ..
6784+ } )
6785+ ) ) ;
6786+ }
6787+ let cli = Cli :: try_parse_from ( [ "openshell" , "sandbox" , "create" ] ) . unwrap ( ) ;
6788+ assert ! ( matches!(
6789+ cli. command,
6790+ Some ( Commands :: Sandbox {
6791+ command: Some ( SandboxCommands :: Create { frozen: false , .. } ) ,
6792+ ..
6793+ } )
6794+ ) ) ;
6795+ }
6796+
67446797 #[ test]
67456798 fn sandbox_create_restart_policy_defaults_to_never ( ) {
67466799 let cli = Cli :: try_parse_from ( [ "openshell" , "sandbox" , "create" ] ) . unwrap ( ) ;
0 commit comments