Blog: Never Let a Pipeline Hang Forever — Introducing Approval Gate Expiry
Never Let a Pipeline Hang Forever — Introducing Approval Gate Expiry
v1.0.34 · Workflow Automation
One of the subtle failure modes in any CI/CD or agentic pipeline is the indefinitely stalled run — a pipeline that paused waiting for human input, was forgotten, and now sits permanently in a pending state consuming resources and silently blocking downstream work.
With v1.0.34, SaaS Factory eliminates this failure mode entirely.
The Problem: Approval Gates That Never Close
Approval gates are a deliberate pause point in the pipeline. They exist to give a human — or an authorised agent — the opportunity to review and approve work before it continues. That's intentional and useful.
But what happens when nobody acts? Until now, the gate would remain open and the pipeline run would sit in pending indefinitely. There was no automatic cleanup, no notification escalation, and no clear signal that the pipeline had been abandoned.
The Solution: Hourly Expiry Sweep
The new Approval Gate Expiry Sweep runs every hour and does exactly what a diligent operator would do manually:
- Find every
pendingapproval gate whoseexpiresAttimestamp has passed. - Expire each gate by calling
expireApprovalGate(gateId), transitioning its status toexpired. - Fail the associated pipeline run with a clear, human-readable error:
Approval gate expired after 24h — pipeline abandoned - Notify the project owner so they know a pipeline needs attention.
The expiry window is 24 hours. Plenty of time to act — but not forever.
Why This Matters
Clean state. Pipelines are either running, succeeded, or failed. There is no fourth state of silent limbo.
Operator awareness. The project owner receives a notification the moment a gate is swept. They know immediately, rather than discovering a stalled pipeline days later.
Restartable. An expired pipeline run can be re-triggered from the dashboard. Expiry is not permanent failure — it's a clean signal to try again with more urgency.
Under the Hood
The sweep is a nightly_batch job (despite the name, it runs hourly) scheduled at 0 * * * *. It operates across three entities:
approval_gates— source of truth for pending gates and their expiry timestampspipeline_runs— updated to reflect the failure statenotification_settings— consulted to route the owner alert correctly
No manual intervention is required. The sweep is fully autonomous.
Approval Gate Expiry Sweep is live in v1.0.34 and active for all projects.