PostHog / PostHog/posthog

Automate the membership repair cadence with a scheduled Temporal workflow

Open
#91,078 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature/cohorts team/feature-flags tech-debt
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

#88013 blessed scheduled reconcile runs, plus person reseeds, as the repair contract for lost membership transitions. That cadence currently runs as an operator runbook. This issue tracks replacing the runbook with a scheduled Temporal workflow so the repair loop does not depend on a human remembering it.

The workflow is a thin dispatcher and watcher, nothing more:

  1. On schedule, create the backfill runs for each allowlisted team through the existing creator functions.
  2. Retry a refused creation with backoff (a run colliding with a save triggered run is the expected case).
  3. Escalate when a run misses its completion deadline.

It must not orchestrate anything. The run row in Postgres stays the source of truth; the seeder dispatches and the finalizer completes runs exactly as they do today. No Rust changes are needed: the seeder already auto dispatches both run kinds once the person path is enabled.

While here, fold in the deferred item from #80291: periodically retry backfill runs that were refused at save time, so the scheduling layer is built once.

Deliberately deferred until the rollout is complete and a few operator cycles have shown the refusal patterns and deadlines worth encoding. Tracking only for now.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading #88013 and #80291, then inspect the existing backfill creator functions and operator runbook referenced here. Confirm how the Postgres run row, seeder, and finalizer currently interact before defining the Temporal dispatcher and watcher. Done means scheduled allowlisted-team runs, refusal retries, and missed-deadline escalation work without changing the existing run orchestration.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres, python
Domain
backend, databases, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.