Skip to content

The agent that grows with you

fix(classifier): treat Azure Foundry's continuation-identity 400 as a rejected reasoning replay

Erosika5db0df28dec8
diff --git a/agent/error_classifier.py b/agent/error_classifier.py
index e4d1709498e..8c1d0030ea5 100644
--- a/agent/error_classifier.py
+++ b/agent/error_classifier.py
@@ -723,7 +723,10 @@ def _classify_400(c: _Ctx) -> Verdict:
# overflow because "encrypted content … could not be verified" trips it.
if code == "invalid_encrypted_content" or "invalid_encrypted_content" in msg or (
"encrypted content for item" in msg and "could not be verified" in msg
- ) or "could not decrypt the provided encrypted_content" in msg:
+ ) or "could not decrypt the provided encrypted_content" in msg or (
+ # Azure Foundry (gpt-6-astra) rejects replayed reasoning from several prior responses this way (#105369).
+ "conflicting authenticated continuation identities" in msg
+ ):
return _V_INVALID_ENCRYPTED
# Reasoning-mandatory route rejecting a disable (GLM-5.3 on Nous Portal / OpenRouter). Deterministic
# for the request shape, but the only bad field is ``reasoning: {enabled: false}`` — the loop drops
diff --git a/tests/agent/test_error_classifier.py b/tests/agent/test_error_classifier.py
index a4e38496a15..828e83e108a 100644
--- a/tests/agent/test_error_classifier.py
+++ b/tests/agent/test_error_classifier.py
@@ -792,6 +792,21 @@ class TestClassifyApiError:
e = MockAPIError("Error code: 400 - " + body["message"], status_code=400, body=body)
assert classify_api_error(e, provider=provider, model="gpt-5.5").reason == expected
+ def test_azure_conflicting_continuation_identities_is_invalid_encrypted_content(self):
+ """Azure Foundry's wording for a rejected encrypted-reasoning replay (#105369); ``code`` is the
+ generic ``invalid_value``, so the message decides."""
+ message = "Conflicting authenticated continuation identities."
+ e = MockAPIError(
+ f"Error code: 400 - {{'error': {{'message': '{message}', 'type': 'invalid_request_error', "
+ "'param': 'input', 'code': 'invalid_value'}}",
+ status_code=400,
+ body={"error": {"message": message, "type": "invalid_request_error", "param": "input", "code": "invalid_value"}},
+ )
+ result = classify_api_error(e, provider="azure-foundry", model="gpt-6-astra")
+ assert result.reason == FailoverReason.invalid_encrypted_content
+ assert result.retryable is True
+ assert result.should_fallback is False
+
# ── Reasoning-mandatory route rejecting a disable ──
def test_reasoning_mandatory_400_is_retryable_not_format_error(self):