@@ -144,4 +144,59 @@ describe("runLinkUnderstanding", () => {
144144 expect ( result . outputs ) . toEqual ( [ ] ) ;
145145 expect ( runCommandWithTimeout ) . not . toHaveBeenCalled ( ) ;
146146 } ) ;
147+
148+ it ( "uses the global link-tools timeout for fetches when configured" , async ( ) => {
149+ mockGuardedFetch ( "page body" , "https://example.com/final" ) ;
150+ mockCommand ( "summarized page" ) ;
151+
152+ await runLinkUnderstanding ( {
153+ cfg : {
154+ tools : {
155+ links : {
156+ enabled : true ,
157+ timeoutSeconds : 15 ,
158+ models : [
159+ { type : "cli" , command : "summarize-fast" , timeoutSeconds : 1 } ,
160+ { type : "cli" , command : "summarize-slow" , timeoutSeconds : 9 } ,
161+ ] ,
162+ } ,
163+ } ,
164+ } as OpenClawConfig ,
165+ ctx : ctx ( "see https://example.com/page" ) ,
166+ } ) ;
167+
168+ expect ( fetchWithSsrFGuard ) . toHaveBeenCalledWith (
169+ expect . objectContaining ( {
170+ timeoutMs : 15000 ,
171+ url : "https://example.com/page" ,
172+ } ) ,
173+ ) ;
174+ } ) ;
175+
176+ it ( "falls back to the largest model timeout for fetches when no global timeout is set" , async ( ) => {
177+ mockGuardedFetch ( "page body" , "https://example.com/final" ) ;
178+ mockCommand ( "summarized page" ) ;
179+
180+ await runLinkUnderstanding ( {
181+ cfg : {
182+ tools : {
183+ links : {
184+ enabled : true ,
185+ models : [
186+ { type : "cli" , command : "summarize-fast" , timeoutSeconds : 1 } ,
187+ { type : "cli" , command : "summarize-slow" , timeoutSeconds : 9 } ,
188+ ] ,
189+ } ,
190+ } ,
191+ } as OpenClawConfig ,
192+ ctx : ctx ( "see https://example.com/page" ) ,
193+ } ) ;
194+
195+ expect ( fetchWithSsrFGuard ) . toHaveBeenCalledWith (
196+ expect . objectContaining ( {
197+ timeoutMs : 9000 ,
198+ url : "https://example.com/page" ,
199+ } ) ,
200+ ) ;
201+ } ) ;
147202} ) ;
0 commit comments