fix(sync): don't require a base URL when an explicit client is supplied

pull_org_skills/propose_skill resolved and demanded HERMES_SYNC_BASE_URL
before using the caller-provided `client`, which already carries its own
base URL. Only resolve/require it on the path that actually constructs a
client.

Caught by scripts/run_tests.sh, which blanks env vars to match CI. Plain
`pytest` masked it: my shell had HERMES_SYNC_BASE_URL exported from live
testing, so the redundant check silently passed. Reproduced deliberately
with `env -u HERMES_SYNC_BASE_URL pytest` before fixing.

371 passed / 0 failed across the sync, skills, prompt, and skill-utils
suites via the canonical runner.
This commit is contained in:
Ben Barclay 2026-07-27 16:44:27 +10:00
parent 797c52b571
commit d60d981281

View file

@ -1694,10 +1694,11 @@ def pull_org_skills(
if "org_id" not in identity:
raise SyncInertError("no organisation context available")
org_id = identity["org_id"]
base_url = resolve_sync_base_url()
if not base_url:
raise SyncInertError("no sync base URL configured")
client = client or HSPClient(base_url, identity["api_key"])
if client is None:
base_url = resolve_sync_base_url()
if not base_url:
raise SyncInertError("no sync base URL configured")
client = HSPClient(base_url, identity["api_key"])
caps = client.capabilities()
_check_version(caps)
@ -1806,10 +1807,11 @@ def propose_skill(
"""
identity = identity or resolve_org_identity()
org_id = identity["org_id"]
base_url = resolve_sync_base_url()
if not base_url:
raise SyncInertError("no sync base URL configured")
client = client or HSPClient(base_url, identity["api_key"])
if client is None:
base_url = resolve_sync_base_url()
if not base_url:
raise SyncInertError("no sync base URL configured")
client = HSPClient(base_url, identity["api_key"])
caps = client.capabilities()
_check_version(caps)