@@ -1832,4 +1832,99 @@ temperature: 0.3
18321832 "Azure OpenAI is a cloud provider, not a local endpoint"
18331833 ) ;
18341834 }
1835+
1836+ // --- agent_tools_enabled tests ---
1837+
1838+ #[ test]
1839+ fn test_agent_tools_enabled_default_is_none ( ) {
1840+ let config = Config :: default ( ) ;
1841+ assert ! (
1842+ config. agent_tools_enabled. is_none( ) ,
1843+ "Default should be None (all tools enabled)"
1844+ ) ;
1845+ }
1846+
1847+ #[ test]
1848+ fn test_agent_tools_enabled_serialize_none ( ) {
1849+ // When None, the field serializes as null (consistent with other Option fields)
1850+ let config = Config :: default ( ) ;
1851+ let yaml = serde_yaml:: to_string ( & config) . unwrap ( ) ;
1852+ assert ! (
1853+ yaml. contains( "agent_tools_enabled" ) ,
1854+ "Field should be present in serialized YAML even when None"
1855+ ) ;
1856+ }
1857+
1858+ #[ test]
1859+ fn test_agent_tools_enabled_serialize_some ( ) {
1860+ let config = Config {
1861+ agent_tools_enabled : Some ( vec ! [ "read_file" . to_string( ) , "search_code" . to_string( ) ] ) ,
1862+ ..Config :: default ( )
1863+ } ;
1864+ let yaml = serde_yaml:: to_string ( & config) . unwrap ( ) ;
1865+ assert ! ( yaml. contains( "agent_tools_enabled" ) ) ;
1866+ assert ! ( yaml. contains( "read_file" ) ) ;
1867+ assert ! ( yaml. contains( "search_code" ) ) ;
1868+ }
1869+
1870+ #[ test]
1871+ fn test_agent_tools_enabled_deserialize_missing_field ( ) {
1872+ // Existing configs without the field should deserialize with None
1873+ let yaml = r#"
1874+ model: claude-opus-4-6
1875+ temperature: 0.3
1876+ "# ;
1877+ let config: Config = serde_yaml:: from_str ( yaml) . unwrap ( ) ;
1878+ assert ! ( config. agent_tools_enabled. is_none( ) ) ;
1879+ }
1880+
1881+ #[ test]
1882+ fn test_agent_tools_enabled_deserialize_explicit_list ( ) {
1883+ let yaml = r#"
1884+ model: claude-opus-4-6
1885+ agent_tools_enabled:
1886+ - read_file
1887+ - search_code
1888+ - list_files
1889+ "# ;
1890+ let config: Config = serde_yaml:: from_str ( yaml) . unwrap ( ) ;
1891+ let tools = config. agent_tools_enabled . unwrap ( ) ;
1892+ assert_eq ! ( tools. len( ) , 3 ) ;
1893+ assert_eq ! ( tools[ 0 ] , "read_file" ) ;
1894+ assert_eq ! ( tools[ 1 ] , "search_code" ) ;
1895+ assert_eq ! ( tools[ 2 ] , "list_files" ) ;
1896+ }
1897+
1898+ #[ test]
1899+ fn test_agent_tools_enabled_deserialize_empty_list ( ) {
1900+ let yaml = r#"
1901+ model: claude-opus-4-6
1902+ agent_tools_enabled: []
1903+ "# ;
1904+ let config: Config = serde_yaml:: from_str ( yaml) . unwrap ( ) ;
1905+ let tools = config. agent_tools_enabled . unwrap ( ) ;
1906+ assert ! (
1907+ tools. is_empty( ) ,
1908+ "Empty list should deserialize as Some([])"
1909+ ) ;
1910+ }
1911+
1912+ #[ test]
1913+ fn test_agent_tools_enabled_round_trip ( ) {
1914+ let original = Config {
1915+ agent_tools_enabled : Some ( vec ! [ "read_file" . to_string( ) , "search_code" . to_string( ) ] ) ,
1916+ ..Config :: default ( )
1917+ } ;
1918+ let yaml = serde_yaml:: to_string ( & original) . unwrap ( ) ;
1919+ let restored: Config = serde_yaml:: from_str ( & yaml) . unwrap ( ) ;
1920+ assert_eq ! ( original. agent_tools_enabled, restored. agent_tools_enabled) ;
1921+ }
1922+
1923+ #[ test]
1924+ fn test_agent_tools_enabled_round_trip_none ( ) {
1925+ let original = Config :: default ( ) ;
1926+ let yaml = serde_yaml:: to_string ( & original) . unwrap ( ) ;
1927+ let restored: Config = serde_yaml:: from_str ( & yaml) . unwrap ( ) ;
1928+ assert_eq ! ( original. agent_tools_enabled, restored. agent_tools_enabled) ;
1929+ }
18351930}
0 commit comments