@@ -50,7 +50,15 @@ selected_provider: openai
5050current_model: gpt-5.4
5151workdir: .
5252shell: powershell
53+
5354provider_overrides:
55+ tools:
56+ webfetch:
57+ max_response_bytes: 4096
58+ supported_content_types:
59+ - text/html
60+ - text/plain
61+ providers:
5462 - name: openai
5563 base_url: https://example.com/v1
5664 model: gpt-5.4
@@ -68,6 +76,12 @@ provider_overrides:
6876 if provider .BaseURL != "https://example.com/v1" {
6977 t .Fatalf ("expected custom base url, got %q" , provider .BaseURL )
7078 }
79+ if cfg .Tools .WebFetch .MaxResponseBytes != 4096 {
80+ t .Fatalf ("expected custom max_response_bytes 4096, got %d" , cfg .Tools .WebFetch .MaxResponseBytes )
81+ }
82+ if len (cfg .Tools .WebFetch .SupportedContentTypes ) != 2 {
83+ t .Fatalf ("expected 2 supported content types, got %+v" , cfg .Tools .WebFetch .SupportedContentTypes )
84+ }
7185 },
7286 },
7387 {
@@ -126,6 +140,12 @@ providers:
126140 if provider .Model != "gpt-4o" {
127141 t .Fatalf ("expected provider model gpt-4o, got %q" , provider .Model )
128142 }
143+ if cfg .Tools .WebFetch .MaxResponseBytes != DefaultWebFetchMaxResponseBytes {
144+ t .Fatalf ("expected default max_response_bytes %d, got %d" , DefaultWebFetchMaxResponseBytes , cfg .Tools .WebFetch .MaxResponseBytes )
145+ }
146+ if len (cfg .Tools .WebFetch .SupportedContentTypes ) != len (DefaultWebFetchSupportedContentTypes ()) {
147+ t .Fatalf ("expected default supported content types, got %+v" , cfg .Tools .WebFetch .SupportedContentTypes )
148+ }
129149 },
130150 },
131151 }
@@ -388,6 +408,12 @@ func TestConfigApplyDefaultsFillsMissingFields(t *testing.T) {
388408 if ! filepath .IsAbs (cfg .Workdir ) {
389409 t .Fatalf ("expected absolute workdir, got %q" , cfg .Workdir )
390410 }
411+ if cfg .Tools .WebFetch .MaxResponseBytes != DefaultWebFetchMaxResponseBytes {
412+ t .Fatalf ("expected default webfetch max_response_bytes %d, got %d" , DefaultWebFetchMaxResponseBytes , cfg .Tools .WebFetch .MaxResponseBytes )
413+ }
414+ if len (cfg .Tools .WebFetch .SupportedContentTypes ) != len (DefaultWebFetchSupportedContentTypes ()) {
415+ t .Fatalf ("expected default supported content types, got %+v" , cfg .Tools .WebFetch .SupportedContentTypes )
416+ }
391417}
392418
393419func TestConfigValidateFailures (t * testing.T ) {
@@ -449,6 +475,24 @@ func TestConfigValidateFailures(t *testing.T) {
449475 }(),
450476 expectErr : "model is empty" ,
451477 },
478+ {
479+ name : "invalid webfetch max response bytes" ,
480+ config : func () * Config {
481+ cfg := validConfig .Clone ()
482+ cfg .Tools .WebFetch .MaxResponseBytes = 0
483+ return & cfg
484+ }(),
485+ expectErr : "max_response_bytes must be greater than 0" ,
486+ },
487+ {
488+ name : "invalid webfetch supported content types" ,
489+ config : func () * Config {
490+ cfg := validConfig .Clone ()
491+ cfg .Tools .WebFetch .SupportedContentTypes = []string {"" }
492+ return & cfg
493+ }(),
494+ expectErr : "supported_content_types[0] is empty" ,
495+ },
452496 }
453497
454498 for _ , tt := range tests {
@@ -568,6 +612,8 @@ func TestLoaderLoadAndSaveRoundTrip(t *testing.T) {
568612 cfg .Providers [i ].Model = "gpt-5.4"
569613 }
570614 }
615+ cfg .Tools .WebFetch .MaxResponseBytes = 1024
616+ cfg .Tools .WebFetch .SupportedContentTypes = []string {"text/html" , "application/json" }
571617 if err := loader .Save (context .Background (), cfg ); err != nil {
572618 t .Fatalf ("Save() error = %v" , err )
573619 }
@@ -591,6 +637,12 @@ func TestLoaderLoadAndSaveRoundTrip(t *testing.T) {
591637 if reloaded .CurrentModel != "gpt-5.4" {
592638 t .Fatalf ("expected current model %q, got %q" , "gpt-5.4" , reloaded .CurrentModel )
593639 }
640+ if reloaded .Tools .WebFetch .MaxResponseBytes != 1024 {
641+ t .Fatalf ("expected max_response_bytes %d, got %d" , 1024 , reloaded .Tools .WebFetch .MaxResponseBytes )
642+ }
643+ if len (reloaded .Tools .WebFetch .SupportedContentTypes ) != 2 {
644+ t .Fatalf ("expected persisted supported content types, got %+v" , reloaded .Tools .WebFetch .SupportedContentTypes )
645+ }
594646}
595647
596648func TestLoaderUsesUpdatedBuiltinProviderWhenUserHasNoOverride (t * testing.T ) {
@@ -732,9 +784,13 @@ func TestNormalizeWorkdirAndClone(t *testing.T) {
732784 cfg := testDefaultConfig ()
733785 cloned := cfg .Clone ()
734786 cloned .CurrentModel = "modified"
787+ cloned .Tools .WebFetch .SupportedContentTypes [0 ] = "application/json"
735788 if cfg .CurrentModel == cloned .CurrentModel {
736789 t .Fatalf ("expected clone to be independent from source" )
737790 }
791+ if cfg .Tools .WebFetch .SupportedContentTypes [0 ] == cloned .Tools .WebFetch .SupportedContentTypes [0 ] {
792+ t .Fatalf ("expected webfetch supported content types to be cloned" )
793+ }
738794}
739795
740796func TestManagerHelperMethodsAndReloads (t * testing.T ) {
0 commit comments