fix(a2a): add cache-first check to enrich_peer_metadata_nonblocking #518

Merged
hongming-pc2 merged 1 commits from sre/fix-enrich-nonblocking-cache-check into main 2026-05-11 17:11:40 +00:00

1 Commits

Author SHA1 Message Date
1380bf0907 fix(a2a): add cache-first check to enrich_peer_metadata_nonblocking
All checks were successful
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 15s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 15s
CI / Detect changes (pull_request) Successful in 59s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m1s
CI / Platform (Go) (pull_request) Successful in 8s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 1m6s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 7s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m7s
CI / Canvas (Next.js) (pull_request) Successful in 9s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m11s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
sop-tier-check / tier-check (pull_request) Successful in 20s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 8s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 10s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2m16s
CI / Python Lint & Test (pull_request) Successful in 6m54s
audit-force-merge / audit (pull_request) Successful in 15s
enrich_peer_metadata_nonblocking (a2a_client.py) never checked the
_peer_metadata cache before scheduling a background fetch — it always
returned None and always fired the executor thread pool. The docstring
promised "cache hit: return the cached record" but the code did not
implement it.

Fix: add the same TTL-check that enrich_peer_metadata uses before
scheduling the worker. On a warm cache hit the function now returns
immediately without touching the in-flight set or the executor.

Closes the remaining 5 test failures in test_a2a_mcp_server.py on main
that were not covered by PR #508's test-assertions fix.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 16:59:54 +00:00