From 5f68fd936d42b8db3caf92508d1a5a8e51edcb8b Mon Sep 17 00:00:00 2001 From: jrhughes003 Date: Tue, 26 May 2026 12:06:00 -0400 Subject: [PATCH] fix(agent): set explicit User-Agent on register POST Python's `urllib.request.Request` defaults to `Python-urllib/`, which Cloudflare's Browser Integrity Check on `riahub.ai` blacklists (HTTP 403 with edge error code 1010). The register POST never reached the hub. Any non-default UA passes the check. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/ria_toolkit_oss/agent/cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ria_toolkit_oss/agent/cli.py b/src/ria_toolkit_oss/agent/cli.py index 0b06e72..41be210 100644 --- a/src/ria_toolkit_oss/agent/cli.py +++ b/src/ria_toolkit_oss/agent/cli.py @@ -43,12 +43,16 @@ def _cmd_register(args: argparse.Namespace) -> int: hub_url = args.hub.rstrip("/") url = f"{hub_url}/screens/agents/register" body = json.dumps({"name": args.name or ""}).encode() + # Explicit User-Agent: Python's default `Python-urllib/` is blocked + # by Cloudflare's Browser Integrity Check on `riahub.ai` (HTTP 403 code + # 1010), so register() never reached the hub. Any non-default UA passes. req = urllib.request.Request( url, data=body, headers={ "Content-Type": "application/json", "X-API-Key": args.api_key, + "User-Agent": "ria-agent/0.1 (+https://github.com/RIA-Toolkit/ria-toolkit-oss)", }, ) try: