mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-29 18:46:59 +00:00
fix(stt): cover 401 retry and keep proof image out of the merge diff
- parametrize the OAuth retry regression over HTTP 401 and 403 so both documented rejection statuses are exercised - reword the retry-failure warning: the except block also covers the retried request, not just the credential refresh - drop docs/proof/ from the PR diff; the live-proof screenshot now lives on the fork's proof-assets-xai-stt-oauth-retry branch and stays linked from the PR description
This commit is contained in:
parent
36de3c5c3e
commit
bcbae3bf41
2 changed files with 7 additions and 6 deletions
|
|
@ -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_status
|
||||
rejected.json.return_value = {
|
||||
"error": {"message": "OAuth2 access token could not be validated"}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue