Skip to content

fix(pr): handle JSON array timeline payload in _parse_timeline_copilot_state #245

Closed

Description

@dan-petty

Bug Description

When gh api --paginate repos/{owner}/{repo}/issues/{pr}/timeline --jq ... returns a JSON array (such as empty array [] when no copilot timeline events match), _parse_timeline_copilot_state attempts to call evt.get('event') on the parsed list object, raising:
AttributeError: 'list' object has no attribute 'get'

Stack Trace

  File "/workspaces/devops-cli/src/devops_cli/github/pr_monitor.py", line 258, in _parse_timeline_copilot_state
    evt_name = evt.get("event")
AttributeError: 'list' object has no attribute 'get'

Proposed Remediation

Support both list and dict structures in _parse_timeline_copilot_state, safely handling top-level arrays, NDJSON, and empty lists. Add unit tests covering list payloads.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugscope/github

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions