Skip to content

fleet(github): WS-11 GitHub issues absorber for fleet intake#7

Merged
Esity merged 2 commits intomainfrom
fleet/ws-11-github-absorber
Apr 14, 2026
Merged

fleet(github): WS-11 GitHub issues absorber for fleet intake#7
Esity merged 2 commits intomainfrom
fleet/ws-11-github-absorber

Conversation

@Esity
Copy link
Copy Markdown
Contributor

@Esity Esity commented Apr 14, 2026

Summary

  • Implements Absorbers::Issues — normalizes GitHub issue webhook events to fleet work items with bot detection, fleet-label dedup, action filtering, and byte-safe description truncation
  • Implements Absorbers::IssuesActor — subscription actor with pattern 'github.issues.*' that delegates to the Issues absorber
  • Implements Absorbers::WebhookSetup mixin — idempotent webhook registration + fleet label creation (fleet:received, fleet:implementing, fleet:pr-open, fleet:escalated)
  • Implements Absorbers::Helpers — shared utilities (bot detection, label check, fingerprinting, transport_connected?)
  • Wires all absorber modules into the extension entry point

Design adherence (from 12-github-absorber.md)

  • No set_nx — assessor is the single dedup authority; absorber only does source-specific dedup (bot filter, label check, action filter)
  • Payload in Redis — raw GitHub payload stored at fleet:payload:{work_item_id} (24h TTL); AMQP message carries only the reference key
  • publish_to_assessor — extracts task_id from Runner::Status.generate_task_id Hash, sets master_id: task_id, function: 'assess' (String)
  • instructions: [] and context: [] populated on every work item
  • Description truncationbody.bytesize > max_bytes ? body.byteslice(0, max_bytes).scrub('') with runtime fallback to 32768
  • Publish failures propagated{ absorbed: false, reason: :publish_failed } returned, not swallowed

Test plan

  • 61 specs, 0 failures (bundle exec rspec spec/absorbers/)
  • 0 rubocop offenses (bundle exec rubocop lib/legion/extensions/github/absorbers/ spec/absorbers/)
  • Absorbers::Issues.absorb returns absorbed: false for bots, already-claimed, ignored actions
  • Description > 32KB is truncated to byte boundary
  • WebhookSetup#setup_fleet_webhook is idempotent (returns existing: true if webhook exists)
  • WebhookSetup#setup_fleet_webhook returns success: false when create_webhook returns no id

Depends on

  • WS-02 (runner prerequisites) — already merged
  • WS-06 (lex-assessor queue) — assessor must be running for publish_to_assessor to deliver; absorber skips silently in lite mode

Files changed

lib/legion/extensions/github.rb                         (wired)
lib/legion/extensions/github/absorbers/helpers.rb       (new)
lib/legion/extensions/github/absorbers/issues.rb        (new)
lib/legion/extensions/github/absorbers/actor.rb         (new)
lib/legion/extensions/github/absorbers/webhook_setup.rb (new)
spec/absorbers/helpers_spec.rb                          (new)
spec/absorbers/issues_spec.rb                           (new)
spec/absorbers/actor_spec.rb                            (new)
spec/absorbers/webhook_setup_spec.rb                    (new)

…intake

Implements the GitHub issues absorber (Absorbers::Issues) that normalizes
GitHub issue webhook events to the standard fleet work item format, with
bot detection, fleet-label dedup, action filtering, and byte-safe description
truncation. Includes IssuesActor subscription actor, WebhookSetup mixin for
auto-registering webhooks and fleet labels on target repos, and shared
Absorbers::Helpers utilities.

- Absorbers::Helpers: bot_generated?, has_fleet_label?, ignored?,
  work_item_fingerprint, generate_work_item_id, transport_connected?
- Absorbers::Issues: absorb (normalize → cache → publish), normalize
  populates instructions: [], context: [], pipeline, config defaults
- Absorbers::IssuesActor: subscription actor with pattern 'github.issues.*'
- Absorbers::WebhookSetup: setup_fleet_webhook mixin (idempotent, validates
  webhook_id, creates fleet:* labels)
- Wired into lib/legion/extensions/github.rb
- 61 specs, 0 failures; 0 rubocop offenses
@Esity Esity requested a review from a team as a code owner April 14, 2026 19:03
Fix spec contamination: webhook_setup_spec now uses anonymous module stubs
instead of reopening the real runner modules, preventing list_webhooks
override from breaking repository_webhooks_spec in full-suite runs.
@Esity Esity merged commit b0c1d6b into main Apr 14, 2026
11 checks passed
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