Skip to content

Hub poller: tolerate a bare-list /events response#166

Merged
AlvinShenSSW merged 1 commit into
mainfrom
fix/hub-poller-events-shape
Jul 2, 2026
Merged

Hub poller: tolerate a bare-list /events response#166
AlvinShenSSW merged 1 commit into
mainfrom
fix/hub-poller-events-shape

Conversation

@AlvinShenSSW

Copy link
Copy Markdown
Owner

Problem

An agent that returns a bare JSON list from /events (instead of the canonical {"events": [...]}) crashed fetch_events with 'list' object has no attribute 'get' — seen repeatedly in a hub log for SnowLeopard. Its events were never ingested and the log was noisy with the cryptic error.

Fix

_events_from_payload(): accept a dict ({"events": [...]}) or a bare list; return None for any other shape so the caller logs a clear "unexpected /events response shape" instead of the AttributeError. Callers filter to dict elements with an id, so a stray non-dict element can't crash the ack filter either.

Gates

  • pytest 518 pass (3 new: shapes unit, bare-list ingest, unexpected-shape skip); ruff/mypy clean.
  • Codex 外门 clean; Kimi 终审 APPROVE.

🤖 Generated with Claude Code

…attribute get)

An agent (e.g. an older/foreign one, or one behind a proxy) that returns a bare JSON
list from /events instead of the canonical {"events": [...]} crashed fetch_events with
"'list' object has no attribute 'get'", so its events were never ingested and the log
was noisy. Add _events_from_payload(): accept a dict or a bare list, filter to dict
elements with an id, and log a clear "unexpected /events response shape" for anything
else instead of the cryptic AttributeError.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AlvinShenSSW AlvinShenSSW merged commit a9e8d0c into main Jul 2, 2026
7 checks passed
@AlvinShenSSW AlvinShenSSW deleted the fix/hub-poller-events-shape branch July 2, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant