@@ -1484,6 +1484,66 @@ mod committed_harvest_tests {
14841484 } ) ) ;
14851485 }
14861486
1487+ #[ test]
1488+ fn committed_harvest_preflight_uses_runner_workspace_not_controller_provenance ( ) {
1489+ let _guard = LAB_ENV_LOCK
1490+ . get_or_init ( || Mutex :: new ( ( ) ) )
1491+ . lock ( )
1492+ . expect ( "Lab environment lock" ) ;
1493+ std:: env:: remove_var ( crate :: core:: observation:: SOURCE_SNAPSHOT_METADATA_ENV ) ;
1494+ std:: env:: remove_var ( crate :: core:: observation:: LAB_OFFLOAD_METADATA_ENV ) ;
1495+ let temp = tempfile:: tempdir ( ) . expect ( "tempdir" ) ;
1496+ let runner_workspace = temp. path ( ) . join ( "runner-workspace" ) ;
1497+ std:: fs:: create_dir ( & runner_workspace) . expect ( "runner workspace" ) ;
1498+ git ( & runner_workspace, & [ "init" , "-b" , "main" ] ) ;
1499+ git (
1500+ & runner_workspace,
1501+ & [ "config" , "user.email" , "test@example.com" ] ,
1502+ ) ;
1503+ git ( & runner_workspace, & [ "config" , "user.name" , "Homeboy Test" ] ) ;
1504+ std:: fs:: write ( runner_workspace. join ( "file.txt" ) , "baseline\n " ) . expect ( "baseline file" ) ;
1505+ git ( & runner_workspace, & [ "add" , "file.txt" ] ) ;
1506+ git ( & runner_workspace, & [ "commit" , "-m" , "baseline" ] ) ;
1507+ let controller_workspace = temp. path ( ) . join ( "missing-controller-workspace" ) ;
1508+ let request = AgentTaskRequest {
1509+ schema : AGENT_TASK_REQUEST_SCHEMA . to_string ( ) ,
1510+ task_id : "runner-task" . to_string ( ) ,
1511+ group_key : None ,
1512+ parent_plan_id : None ,
1513+ executor : AgentTaskExecutor {
1514+ backend : "test" . to_string ( ) ,
1515+ selector : None ,
1516+ runtime_selection : None ,
1517+ required_capabilities : Vec :: new ( ) ,
1518+ secret_env : Vec :: new ( ) ,
1519+ model : None ,
1520+ config : serde_json:: Value :: Null ,
1521+ } ,
1522+ instructions : String :: new ( ) ,
1523+ inputs : serde_json:: Value :: Null ,
1524+ source_refs : Vec :: new ( ) ,
1525+ workspace : AgentTaskWorkspace {
1526+ root : Some ( runner_workspace. display ( ) . to_string ( ) ) ,
1527+ ..Default :: default ( )
1528+ } ,
1529+ component_contracts : Vec :: new ( ) ,
1530+ policy : AgentTaskPolicy :: default ( ) ,
1531+ limits : AgentTaskLimits :: default ( ) ,
1532+ expected_artifacts : Vec :: new ( ) ,
1533+ artifact_declarations : Vec :: new ( ) ,
1534+ metadata : serde_json:: json!( {
1535+ "workspace_source_provenance" : {
1536+ "controller_root" : controller_workspace. display( ) . to_string( )
1537+ }
1538+ } ) ,
1539+ } ;
1540+
1541+ let preflight = prepare_committed_harvest ( & request) . expect ( "runner workspace preflight" ) ;
1542+
1543+ assert ! ( preflight. base_sha. is_some( ) ) ;
1544+ assert ! ( !controller_workspace. exists( ) ) ;
1545+ }
1546+
14871547 #[ test]
14881548 fn lab_snapshot_preflight_materializes_a_provider_ready_attempt_workspace ( ) {
14891549 let _guard = LAB_ENV_LOCK
0 commit comments