@@ -235,6 +235,35 @@ tools on the user's machine, so tool use is suppressed for the request."
235235 " Truncated"
236236 (ai-code-test--gptel-sync-error-message " Truncate this prompt" )))))
237237
238+ (ert-deftest ai-code-test-call-gptel-sync-shows-waiting-message ()
239+ " The blocking wait should show progress and clear it afterwards.
240+ The progress message must stay out of the *Messages* log."
241+ (let ((callback nil )
242+ (messages nil )
243+ (logged-waiting nil ))
244+ (ai-code-test-with-stub-gptel
245+ (lambda (_question &rest args )
246+ (setq callback (plist-get args :callback )))
247+ (cl-letf (((symbol-function 'sit-for )
248+ (lambda (&rest _args )
249+ (funcall callback " ANSWER"
250+ '(:status " HTTP/2 200" :error nil ))))
251+ ((symbol-function 'message )
252+ (lambda (format-string &rest args )
253+ (let ((text (and format-string
254+ (apply #'format format-string args))))
255+ (when (and text message-log-max
256+ (string-match-p " GPTel" text))
257+ (setq logged-waiting t ))
258+ (push text messages)))))
259+ (should (equal " ANSWER" (ai-code-call-gptel-sync " Question" )))))
260+ (should (cl-some (lambda (text )
261+ (and text (string-match-p " Waiting for GPTel" text)))
262+ messages))
263+ (should-not logged-waiting)
264+ ; ; The most recent message call clears the echo area.
265+ (should (null (car messages)))))
266+
238267(ert-deftest ai-code-test-custom-prompt-suffix-provider-respects-switch ()
239268 " The custom suffix provider should honor the legacy suffix switch."
240269 (let ((ai-code-prompt-suffix-functions
0 commit comments