Schedule icon
Download icon
Script icon
JsonToIon icon
Loop icon
If icon
Request icon
Set icon
Fail icon
Log icon

Stack Overflow Unanswered Question SLA Sentinel

Monitor unanswered Stack Overflow questions, create assigned SLA tickets, and deduplicate them with the KV Store.

Categories
Business

Monitor a Stack Overflow tag and turn unanswered questions older than the answer SLA into assigned GitHub issues.

How it works

  1. Download the newest questions and score unanswered ones against sla_hours.
  2. Convert breach records to ION and iterate over them sequentially.
  3. Look up each question ID and destination repository in Kestra's namespace KV Store. Already ticketed questions are skipped.
  4. With create_tickets: true, create a GitHub issue assigned to ticket_owner, verify the returned assignee, then save the successful response in KV. With false (the default), log a preview only, without changing KV.
  5. Log a preview digest in preview mode, or a count summary in ticketing mode. Repeat runs do not re-emit individual alerts for ticketed questions.

Setup

  • Python script and serdes plugins; Docker-compatible runner for python:3.11-slim.
  • Set ticket_repository to your own support repository and ticket_owner to a GitHub login with access. Do not leave the placeholders when enabling creation.
  • Set the GITHUB_TOKEN secret with permission to create and assign issues in that repository. No token is read in preview mode.
  • Run once with create_tickets: false, inspect the digest, then explicitly enable ticket creation. The hourly trigger is disabled and has its own inputs; configure them before enabling it.

State and failure handling

Flow concurrency is one (QUEUE) to serialize this flow's read/create/write sequence. KV keys use so_sla_<owner>_<repo>_<question_id> in the flow namespace. Do not run another flow concurrently against the same keys. Keys have no TTL: remove a key deliberately to allow a fresh ticket for that question.

The KV write follows the successful HTTP request. A rejected API call fails the run without marking the question alerted. GitHub issue creation and the KV write are not transactional: if GitHub accepts the issue but its response is lost, assignment is rejected, or the KV write fails, inspect the repository and reconcile the key before retrying to avoid a duplicate. No automatic HTTP retry is configured.

Inputs and outputs

so_tag defaults to kestra, sla_hours to 24, and max_questions to 50. ticket_repository and ticket_owner are placeholders. create_tickets defaults to false. The scorer emits breach records, counts and a markdown digest; normalize_breach_records.uri contains ION records. Each successful GitHub response is stored in KV for follow-up.

Limits

Only the newest page is checked (API maximum 100). Busy tags may require pagination. A question with any answer is not a breach, even without an accepted answer. Anonymous Stack Exchange quota is shared by egress IP; this flow makes one request per run. Titles and links are handled as data, not executable templates.

Testing

Validated and executed on local Kestra 2.0.6 with Python script 1.18.3 and serdes 2.3.2. HTTP fixtures verified first-run ticket creation plus requested assignee, repeat-run deduplication, preview (no POST or KV write), empty input, HTTP failure without KV write, recovery and deduplication after recovery, and a missing assignee failing without a KV write. A title containing quotes and template-like braces was preserved as data. A live Stack Exchange preview completed successfully. Local runs used the Process runner in place of Docker; GitHub writes used a localhost fixture only, never a real repository. The published Docker runner and real GitHub token permissions were not exercised.

See How

New to Kestra?

Use blueprints to kickstart your first workflows.