Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(workflows): add cancel_requested_at column to cyclotron jobs (#83100)

Harley Alexander1ff8849cb327
diff --git a/rust/cyclotron-node-migrations/20260813000001_add_cancel_requested_at_column.sql b/rust/cyclotron-node-migrations/20260813000001_add_cancel_requested_at_column.sql
new file mode 100644
index 000000000000..a3275d98558b
--- /dev/null
+++ b/rust/cyclotron-node-migrations/20260813000001_add_cancel_requested_at_column.sql
@@ -0,0 +1,13 @@
+-- Cancellation request marker, distinct from status='canceled': producers set it on
+-- in-flight jobs, and the owning worker performs the actual cancellation (terminal
+-- status flip plus lifecycle/metric writes) when it next observes the job.
+--
+-- ADD COLUMN with no default is metadata-only, but it still takes a brief
+-- ACCESS EXCLUSIVE lock on a hot table: queueing for it behind a long-running
+-- query parks everything else behind us. lock_timeout bounds that wait; on
+-- timeout the per-file transaction aborts, nothing is recorded, and the next
+-- migration run retries this idempotent file.
+
+SET LOCAL lock_timeout = '5s';
+
+ALTER TABLE cyclotron_jobs ADD COLUMN IF NOT EXISTS cancel_requested_at TIMESTAMPTZ;