Skip to content

feat(events): parse GitHub status, check_suite and check_run events - #775

Merged
hieptl merged 1 commit into
mainfrom
hiep/ohe-4122-automations-support-github-ci-result-events
Nov 19, 2026
Merged

hieptl merged 1 commit into
mainfrom
hiep/ohe-4122-automations-support-github-ci-result-events

Conversation

@hieptl

@hieptl hieptl commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Native GitHub automations could not trigger on a CI result other than workflow_run. status and check_suite had neither a detection rule nor a payload class, and check_run had a detection rule and no parser. Everything downstream reads GITHUB_PAYLOAD_CLASSES: GET /v1/events/github/requested-types omitted the three types, so the OpenHands server dropped every delivery; capabilities did not offer them, so the event key picker never listed them; and preflight rejected on: status or on: check_suite.completed as a type the deployment cannot parse. A customer who gates a pipeline on whether CI went green or red on a commit had to register a custom webhook for it.

  • event_schemas/github.py: CheckSuitePayload (check_suite.completed), CheckRunPayload (check_run.created, check_run.completed) and StatusPayload (status, which has no action), registered under their event types, plus detection rules for check_suite and status. A status payload has no wrapper object, so its rule matches the payload's own sha, state and context keys. The models carry what a CI gate needs: the result (conclusion or state), head sha, branch, the associated pull requests and, for a check run, its name and html_url; a status keeps its context, description, target_url and branches. conclusion is null until a suite or run completes and head_branch is null for a commit on a fork. The suite nested in a check run is optional and keeps only its branch, so a run that carries a reduced suite still parses.
  • The verify-automation feature map's "unsupported GitHub event" example moves from check_run to workflow_job, and the requested-types recipe expects ten families and ten detection rules.

Once the OpenHands server refreshes requested types (five-minute cache) it forwards the three events, Agent Canvas lists check_run.*, check_suite.* and status in the event key picker, and preflight accepts them. A CI gate filters on the payload, for example state == 'failure' or check_suite.conclusion == 'failure' && check_suite.app.slug == 'github-actions'. GitHub reports each result separately: Actions creates a check suite per workflow run, and a status fires on every state change including pending, so one commit sends several of these events and nothing here aggregates them.

Tests: uv run pytest tests/test_event_schemas.py tests/test_event_router.py tests/test_capabilities_router.py tests/test_verify_automation_skill.py — 217 passed. New cases: test_detect_check_suite, test_detect_check_run and test_detect_status (detection and typed parse), test_receive_github_status_failure_creates_run (a signed forwarded delivery answers matched: 1 with one run), the type-without-an-action preflight case, and the requested-types and capabilities lists now include the types. On main the schema test module fails to import the new payload classes, and test_requested_github_event_types_returns_supported_event_families, test_receive_github_status_failure_creates_run, test_configured_deployment_advertises_event_support and test_event_types_are_checked_against_what_the_deployment_parses[type-without-an-action] fail. ruff check, ruff format --check, pycodestyle and pyright are clean. The check suite and check run field shapes were compared with the objects the GitHub REST API returns for this repository; the status shape follows GitHub's webhook documentation.

Not exercised against a live install.

GitHub sends these events only to an app that subscribes to them, and every delivery of a parsed type is forwarded and recorded, so check_run (sent for every CI job) is best left to installs that need the result of a single check.

Companion changes: the GitHub App setup helper subscribes new apps to Status and Check suite and requests the Checks permission read-only (OpenHands/OpenHands-Cloud#1644), the docs list the events with a CI gate example (OpenHands/docs#1163), and the openhands-automation skill table lists their keys (OpenHands/extensions#965). Apps created before the helper change need the events enabled under Permissions & events, plus the Checks permission for the check events.

Tracking: OHE-4122.

GitHub's CI result events other than workflow_run had no payload class,
so the requested-types endpoint never listed them, the OpenHands server
dropped every delivery, capabilities did not offer them and preflight
refused a trigger on them. check_run had a detection rule and no parser;
status and check_suite had neither.

Register CheckSuitePayload, CheckRunPayload and StatusPayload in
GITHUB_PAYLOAD_CLASSES and add detection rules for check_suite and
status. A status payload names no wrapper object, so its rule matches
the payload's own sha, state and context keys. The models keep what a
CI gate needs: the result (conclusion or state), the head sha, the
branch, the associated pull requests and, for a check run, its name and
URL. The suite nested in a check run is optional and keeps only its
branch, so a run that carries a reduced suite still parses.

Requested-types, capabilities and preflight read the registry, so a
CI-gate automation can now trigger on status, check_suite.completed or
check_run.completed with a filter such as state == 'failure' or
check_suite.conclusion == 'failure'.

Tests cover detection and parsing of the three events, a forwarded
failed status creating a run, and preflight accepting a type that has
no action. The verify-automation feature map uses workflow_job as its
unsupported GitHub example and expects ten parseable families and ten
detection rules.
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Warning

Your comment is too long (maximum is 65536 characters), so the coverage report was not added. See the job log for how to reduce it.

@tofarr tofarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍰

@hieptl
hieptl merged commit c0d3694 into main Nov 19, 2026
13 checks passed
@openhands-release-bot openhands-release-bot Bot added the released: 1.34.0 Shipped in 1.34.0 label Nov 19, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.34.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released: 1.34.0 Shipped in 1.34.0 type: feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants