fix(workspace): restore a2a_client cache-first path (peer_name KeyError fix)
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 32s
Check migration collisions / Migration version collision check (pull_request) Successful in 54s
CI / Detect changes (pull_request) Successful in 50s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 54s
E2E API Smoke Test / detect-changes (pull_request) Successful in 56s
Harness Replays / detect-changes (pull_request) Successful in 21s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 15s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 34s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m8s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 44s
qa-review / approved (pull_request) Successful in 18s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, local-postgres-e2
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 1m0s
security-review / approved (pull_request) Failing after 19s
Runtime Pin Compatibility / PyPI-latest install + import smoke (pull_request) Successful in 2m27s
E2E Staging External Runtime / E2E Staging External Runtime (pull_request) Successful in 5m18s
E2E Staging SaaS (full lifecycle) / E2E Staging SaaS (pull_request) Successful in 6m5s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 14s
Harness Replays / Harness Replays (pull_request) Successful in 5s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Failing after 1m32s
sop-checklist-gate / gate (pull_request) Successful in 16s
sop-tier-check / tier-check (pull_request) Successful in 17s
gate-check-v3 / gate-check (pull_request) Successful in 21s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2m34s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 4m58s
CI / Python Lint & Test (pull_request) Successful in 7m20s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 8m7s
CI / Platform (Go) (pull_request) Failing after 10m22s
CI / Canvas (Next.js) (pull_request) Failing after 11m5s
CI / Canvas Deploy Reminder (pull_request) Has been skipped

Restored workspace/a2a_client.py from main to include the cache-first
hot-path in enrich_peer_metadata_nonblocking. Without this, all 5
test_a2a_mcp_server tests fail with KeyError: peer_name.
This commit is contained in:
Molecule AI · infra-sre 2026-05-13 12:41:12 +00:00
parent 74bab808b2
commit ea64b211a5

View File

@ -187,11 +187,27 @@ def enrich_peer_metadata_nonblocking(
canon = _validate_peer_id(peer_id)
if canon is None:
return None
# Schedule background fetch unless one is already in flight for this
# peer. The synchronous version atomically reads-then-writes; the
# async version splits that into "schedule fetch" + "fetch fills
# cache later." The in-flight set keeps a flurry of pushes from
# one peer (e.g., a chatty agent) from spawning N parallel GETs.
# Cache-first: return immediately on warm hit (same TTL logic as the
# sync path). This is the hot-path optimisation — every push from a
# warm peer must return the record without touching the in-flight set
# or the executor. A background fetch that races to fill the cache
# will find the entry already present when it calls
# enrich_peer_metadata (which does its own fresh-TTL check), so it
# exits as a no-op with no extra network traffic.
current = time.monotonic()
cached = _peer_metadata_get(canon)
if cached is not None:
fetched_at, record = cached
if current - fetched_at < _PEER_METADATA_TTL_SECONDS:
return record
# Cache miss or TTL expired: schedule background fetch unless one is
# already in flight for this peer. The synchronous version atomically
# reads-then-writes; the async version splits that into "schedule
# fetch" + "fetch fills cache later." The in-flight set keeps a
# flurry of pushes from one peer (e.g., a chatty agent) from
# spawning N parallel GETs.
with _enrich_in_flight_lock:
if canon in _enrich_in_flight:
return None