Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Feature ID: FW-49 Status: ✅ Implemented (2026-03-19) Spec Reference: FW-49-execution-timeout-watchdog.md Last Updated: 2026-03-16

Overview

FW-49 adds execution deadline enforcement for workflow runs using a pg_cron-triggered watchdog (workflow-timeout-watchdog) that invokes the workflow-timeout-checker Edge Function. It integrates with FW execution data, FW-47 dead letter handling, FW-25 compensation, and PF-10 notifications.

Integration Points (from Spec)

DependencyTypePurpose
PF-01 (Organizations & Sites)PlatformTenant scoping and organization-level timeout settings
PF-10 (Notifications)Platform Integration LayerSend timeout warnings, timeout notices, and escalation notices
FW-46 (Durable Execution Worker)FW internal dependencyProvides execution deadline fields and step-level timeout handling context
FW-47 (Dead Letter Queue)FW internal dependencyStore timed-out executions and timeout classification for post-mortem analysis
FW-25 (Error Recovery)FW internal dependencyTrigger compensation actions for fail/escalate timeout behaviors
FW-06 (Workflow Builder)FW internal dependencyConfigure timeout behavior per workflow definition
FW-22 (Execution Monitoring)FW internal dependencySurface at-risk and timed-out status/metrics in monitoring dashboards

API / Edge Function Contracts

  • Watchdog edge function: supabase/functions/workflow-timeout-checker/index.ts
    • Triggered by pg_cron every 5 minutes.
    • Reads timeout settings from fw_module_settings.
    • Finds overdue executions (deadline_at < now()) and applies configured on_timeout action (fail, cancel, escalate).
    • Finds at-risk executions by warning threshold and emits one-time warning notifications.
  • Deadline extension edge function: supabase/functions/extend-execution-deadline/index.ts
    • Requires authenticated user and admin authorization.
    • Extends deadline_at, resets warning sent flag, records audit event.

Platform Integration Layer Usage

Platform LayerLocationUsage
PF-10 Notifications@/platform/notificationsSends timeout warning, timeout terminal-state, and escalation notifications
PF-01 Org contextPlatform foundation data modelEnsures all timeout processing and emitted records carry organization_id

Security and Tenant Isolation

  • Timeout checks operate with service role context for scheduled cross-tenant scanning; tenant identity is preserved in all writes/events.
  • User-initiated deadline extensions require role and organization access checks before mutation.
  • Notifications and DLQ entries include organization_id for downstream tenant-safe handling.
  • Timeout error messages and extension reasons are sanitized and must not include PHI/PII.

Event Contracts

FW-49 publishes planned workflow timeout events:
  • workflow.execution.timed_out
    • Consumers: FW-47 (DLQ), FW-25 (compensation), monitoring/analytics listeners.
  • workflow.execution.deadline_extended
    • Consumers: audit trail and monitoring listeners.
Event schemas are defined in the FW-49 spec and should be mirrored in the shared event contract documentation when implemented.