Skip to content

The agent that grows with you

test(mcp): pin the redacted token-error excerpt by contract, not by exact redaction span

teknium12d5d12c33f53
diff --git a/tests/tools/test_mcp_oauth.py b/tests/tools/test_mcp_oauth.py
index 9c0abbaddcb..38a321b32b1 100644
--- a/tests/tools/test_mcp_oauth.py
+++ b/tests/tools/test_mcp_oauth.py
@@ -331,7 +331,8 @@ class TestBuildOAuthAuth:
await provider._handle_token_response(httpx.Response(403, content=waf.encode()))
message = str(exc_info.value)
- assert message.startswith("Token exchange failed (403): ERROR 403 ERROR Request blocked. Bearer [REDACTED]")
+ assert message.startswith("Token exchange failed (403): ERROR 403 ERROR Request blocked.")
+ assert "[REDACTED]" in message
assert "<" not in message and "leaked-bearer-token" not in message
assert len(message) <= len("Token exchange failed (403): ") + 200
assert provider.context.current_tokens is None