Sentinel blocks rerun

From CarlosCaPe/octorato · View interactive version

Sentinel blocks rerun is an AI agent skill from the GitHub repository CarlosCaPe/octorato. Diagnose daily-idempotent endpoints that silently no-op because an earlier same-day run set a 'already-done' sentinel

How to use this skill

Skill file

Sentinel Blocks Re-Run

What

Many daily ingest / publish / fan-out endpoints use a sentinel record (KV key,

DB row, file marker) to make themselves idempotent — "did I already run for

YYYY-MM-DD?" If yes, return early with status: "already-done".

This is correct behavior, but it has a sharp failure mode: if any caller

fires the endpoint for date T (a manual test from yesterday's late evening, a

restart-induced retry, a one-off curl), the sentinel for T lands. Then the

actual scheduled cron for date T shows up at its normal time, sees the

sentinel, and skips — producing zero work output for that day, silently.

When to suspect this

downstream artifacts appeared** (no new posts, no new rows, no new files).

"no-candidates" / "already-processed" instead of the expected

"scheduled" / "created N items".

day's records exist normally.

Diagnosis (5-minute playbook)

  1. Read the response body, not just the HTTP code. A 200 + "already-done"

is a no-op disguised as success.

  1. Find the sentinel key/row. Search the endpoint code for the

idempotency check (if (await get(sentinelKey)), `SELECT 1 FROM runs WHERE

day = ?`, file-exists guard, etc.).

  1. Inspect the sentinel timestamp. If it was created at an unexpected hour

(e.g., 01:30 instead of the scheduled 14:00), an out-of-band caller wrote it.

  1. Delete the sentinel for the affected date.
  2. Re-trigger the workflow / endpoint. It should now respond

"scheduled" / "created" and emit the expected artifacts.

  1. Verify new artifacts land.

Fix patterns

Operational (right now)

# Delete the offending sentinel
kv delete "<sentinel-key-for-today>"
# Re-fire the scheduled workflow
trigger-workflow daily-job.yml
# Confirm response carries created-count, not already-done

Code-level (prevent recurrence)

Defense in depth — pick the one that fits the system:

| Strategy | Tradeoff |

|---|---|

| Sentinel key includes the triggering source (cron-id / manual-id) | Manual triggers no longer block cron, but two crons same day still no-op (usually fine) |

| Sentinel records what was produced (count, sample IDs); endpoint returns those on already-done | Operator sees that previous run delivered N items; can decide to delete + re-fire |

| Sentinel has a TTL shorter than the cron interval (e.g., 6h for a daily cron) | Re-runs within 6h still no-op (correct), runs after 6h treat the day as fresh |

| Endpoint accepts ?force=true query param that bypasses the sentinel guard | Explicit operator escape hatch with audit |

Anti-patterns

endpoints use 200 + status enum, not 200/201 split.

run actually did succeed and emit downstream artifacts, deleting + re-running

produces duplicates.

an audit trail or it becomes the new normal.

Lessons Learned

<!-- Append new cases as encountered. Include: date, what the sentinel was

keyed on, what triggered the off-hour run, how the duplicate-detection played

out after the fix. -->

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.