The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(stt): cover 401 retry and keep proof image out of the merge diff
Ben Sheridan-Edwardsbcbae3bf411b
diff --git a/tests/tools/test_transcription_tools.py b/tests/tools/test_transcription_tools.pyindex b7c9b920574..c21407e2730 100644--- a/tests/tools/test_transcription_tools.py+++ b/tests/tools/test_transcription_tools.py@@ -1570,8 +1570,9 @@ class TestTranscribeXAI:assert "HTTP 400" in result["error"]assert "Invalid audio format" in result["error"]- def test_retries_403_with_refreshed_oauth_credentials(- self, sample_ogg, mock_xai_http_module+ @pytest.mark.parametrize("rejected_status", [401, 403])+ def test_retries_auth_rejection_with_refreshed_oauth_credentials(+ self, sample_ogg, mock_xai_http_module, rejected_status):mock_xai_http_module.resolve_xai_http_credentials.side_effect = [{@@ -1587,7 +1588,7 @@ class TestTranscribeXAI:]rejected = MagicMock()- rejected.status_code = 403+ rejected.status_code = rejected_statusrejected.json.return_value = {"error": {"message": "OAuth2 access token could not be validated"}}diff --git a/tools/transcription_tools.py b/tools/transcription_tools.pyindex 7f83d35df1f..810796e960b 100644--- a/tools/transcription_tools.py+++ b/tools/transcription_tools.py@@ -1883,11 +1883,11 @@ def _transcribe_xai(file_path: str, model_name: str) -> Dict[str, Any]:refreshed_key,_resolve_base_url(refreshed_creds),)- except Exception as refresh_exc:+ except Exception as retry_exc:logger.warning(- "xAI STT OAuth refresh after HTTP %d failed: %s",+ "xAI STT OAuth refresh-and-retry after HTTP %d failed: %s",response.status_code,- refresh_exc,+ retry_exc,)if response.status_code != 200: