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(signals): count a thumbs up as an inbox ranking action (#119455)

posthog[bot]997e13fb0b3a
diff --git a/products/signals/dags/inbox_ranking/README.md b/products/signals/dags/inbox_ranking/README.md
index 0fb3795477e4..c4745d9287e2 100644
--- a/products/signals/dags/inbox_ranking/README.md
+++ b/products/signals/dags/inbox_ranking/README.md
@@ -149,8 +149,8 @@ s3://<bucket>/<prefix>/
└── inbox_ranking_served_scores/v1/dt=YYYY-MM-DD/ # the scoring sweep's scores of the reports born that day, per model key
```
-- **A model is a `(model_name, model_version, model_role)`.** `model_name` is the recipe: which features, which learner and which training settings: `report_embeddings`, per-head XGBoost, is the one trained here. `nn`, one ONNX network, is trained by the `signals_ml` location, and each `MODEL_FAMILIES` entry names its `learner` and the `location` that trains it. `model_version` is the partition day it was fit on, and `model_role` is the role it was scored or trained under (`candidate` on the training events; `served`, `recent`, `pinned` or `cross_family` on the online grade, and `daily_candidate` on grades written before the `recent` role). Each family owns a prefix under the models path, so two families trained on the same day cannot collide. A candidate is graded only against the served model of its own name. The served pointer can name any family, so a rollback can cross families.
-- **A recipe change gets a new `model_name`.** A candidate's `metadata.json` carries `recipe` and `recipe_hash`, a stable hash of the recipe (`training/recipe.py`): the learner, the feature set and its schema version, the project-vector kinds and their history settings, the booster params or network config, each head's cohort, label, horizon, label columns and status-label flag, `lookback_days`, `holdout_days`, the example grain and row budget, and `dataset_version`. Dates, `run_id`, row counts and metrics stay out, so a daily retrain keeps the hash. The candidate asset compares its hash with the newest version of the same name, at or before its partition, that has one, and on a mismatch it fails before it writes the partition and names the changed inputs. A re-run of a partition therefore compares with that partition's own saved recipe. The search covers every dataset version, so a `DATASET_VERSION` bump also needs a new name. A version without a hash is not compared. This includes an env change such as `INBOX_RANKING_TRAINING_LOOKBACK_DAYS`. To start a new recipe, add a `MODEL_FAMILIES` entry with a new name (`nn_v2` after `nn`) and remove the old entry: the old versions stay servable by key, and the promotion gate never compares two recipes. Two recipes can train side by side for a comparison, but each costs a manifest slot, so do not do it by default. `recipe_hash` is on `inbox_ranking_candidate_trained` and `inbox_ranking_promotion_decided` (with `incumbent_recipe_hash`), and `inbox_ranking_serving_manifest_published` carries `model_recipe_hashes` per model key.
+- **A model is a `(model_name, model_version, model_role)`.** `model_name` is the recipe: which features, which learner and which training settings: `report_embeddings_v2`, per-head XGBoost, is the one trained here. `nn_v2`, one ONNX network, is trained by the `signals_ml` location, and each `MODEL_FAMILIES` entry names its `learner` and the `location` that trains it. `model_version` is the partition day it was fit on, and `model_role` is the role it was scored or trained under (`candidate` on the training events; `served`, `recent`, `pinned` or `cross_family` on the online grade, and `daily_candidate` on grades written before the `recent` role). Each family owns a prefix under the models path, so two families trained on the same day cannot collide. A candidate is graded only against the served model of its own name. The served pointer can name any family, so a rollback can cross families.
+- **A recipe change gets a new `model_name`.** `report_embeddings` and `nn` became `report_embeddings_v2` and `nn_v2` when `action` started to count a thumbs up. A candidate's `metadata.json` carries `recipe` and `recipe_hash`, a stable hash of the recipe (`training/recipe.py`): the learner, the feature set and its schema version, the project-vector kinds and their history settings, the booster params or network config, each head's cohort, label, horizon, label columns and status-label flag, `lookback_days`, `holdout_days`, the example grain and row budget, and `dataset_version`. Dates, `run_id`, row counts and metrics stay out, so a daily retrain keeps the hash. The candidate asset compares its hash with the newest version of the same name, at or before its partition, that has one, and on a mismatch it fails before it writes the partition and names the changed inputs. A re-run of a partition therefore compares with that partition's own saved recipe. The search covers every dataset version, so a `DATASET_VERSION` bump also needs a new name. A version without a hash is not compared. This includes an env change such as `INBOX_RANKING_TRAINING_LOOKBACK_DAYS`. To start a new recipe, add a `MODEL_FAMILIES` entry with a new name (`nn_v2` after `nn`) and remove the old entry: the old versions stay servable by key, and the promotion gate never compares two recipes. Two recipes can train side by side for a comparison, but each costs a manifest slot, so do not do it by default. `recipe_hash` is on `inbox_ranking_candidate_trained` and `inbox_ranking_promotion_decided` (with `incumbent_recipe_hash`), and `inbox_ranking_serving_manifest_published` carries `model_recipe_hashes` per model key.
- **A feature set is one feature universe.** `products/signals/backend/ranking/features.py` holds a `FeatureSet` per universe: its name, its schema version, its ordered feature names, the report-state columns it reads, `build_matrix`, and how many rows it wants per report and per head. `report_embeddings` is the one today. A candidate records the set it was fit on in its `metadata.json`, so the grader checks a model against its own set rather than one global contract, the examples asset writes one Parquet per set, and the unseen scorer builds one matrix per set and shares it across the families that read it. Adding a set means an entry in `FEATURE_SETS`; a model naming a set this build cannot produce is logged and left unscored.
- **Examples are one row per report at its birth, by default.** For partition `dt=D` the examples asset reads the report-state and labels snapshots `dt=D-lookback..D` and emits one row per report, on the snapshot of the day it was created, labeled from the snapshot `horizon_days` later (7 for open, 14 for action, 30 for fixed). Features are built by the feature set from that snapshot's state columns plus `age_hours`, the report's age at the snapshot. Labels are aligned to the state spine, so a report with no label event is a negative (all-zero labels), not absent. Label-only rows (no Postgres state) are skipped, as are state rows read long after their snapshot day (backfills carry current Postgres state; see `features_observed_at`) and, for the heads that read the status stream (`action` and `fixed`), rows whose status telemetry fails the dataset's `label_provenance_ok` check. Birth is the moment serving scores a report, and the label that comes out is a per-report probability, which is what the inbox ordering needs. A report born before the window, or one whose birth-day snapshot is missing from it, is no example; `reports_missing_birth_snapshot` on the asset counts the second case, which is a gap in the partitions.
- **An outcome already visible on the birth day is a future positive.** A report born on day D has no scoring moment before D, so an outcome visible at D belongs to the moment being built rather than to an earlier one; the labels of D therefore read as their defaults for a report born on D. Most outcomes land on the birth day, so this is where the positives are: censoring on them costs the `pr_created` head most of its training signal. `<set>_<head>_birth_day_positives` on the examples asset, and `birth_day_positives` on the `inbox_ranking_examples_built` event, say how many positives the rule keeps. These rows carry a hindsight the other rows do not: the state snapshot reads `signal_count`, `total_weight`, `run_count` and the text sizes live from Postgres a few hours after day D ends, so a birth-day outcome happened before its own feature read. Both the holdout AUC and the newborn unseen grade therefore read optimistically on these rows, until the scoring sweep's timestamped score log replaces the daily snapshot as this table's source.
@@ -169,7 +169,7 @@ s3://<bucket>/<prefix>/
```bash
dagster job launch -w .dagster_home/workspace.yaml --location posthog.dags.locations.signals -j inbox_ranking_promote_job \
- --config-json '{"ops": {"inbox_ranking_promote": {"config": {"model_key": "nn@2026-10-16", "reason": "seed the pointer"}}}}'
+ --config-json '{"ops": {"inbox_ranking_promote": {"config": {"model_key": "nn_v2@2026-10-20", "reason": "seed the pointer"}}}}'
```
- **Serving manifest**: the dag's decision about what the scoring sweep runs, published where the sweep can read it. The Temporal workers have no credential for the dataset bucket, so `inbox_ranking_serving_manifest` copies the models the sweep needs into the deployment's own object store and writes a manifest naming them:
@@ -242,6 +242,7 @@ The promotion rule compares only the heads in `HEADS`, so an incumbent that carr
`action` counts intent from every surface, not only the cloud inbox list.
A report is a positive when someone clicked an intent action in the inbox UI (create PR, implement, copy the prompt, discuss, open or view a PR, edit the reviewers, restore), or when a person or an external agent claimed it, linked a PR, left a note, discussed it in Slack, or resolved it.
+A thumbs up on the report counts too (`feedback_positive_count`). A thumbs down does not, because it is a negative judgment and not intent.
A resolve counts when it carries a reason or when its `actor_kind` is `user` or `agent`, so the one-click Today resolve counts.
Self-driving's own `task` and `system` writes do not count: they are internal operational work.
A resolve with no reason and no human actor is the automatic resolve after a tracked PR merges, so it does not count either.
@@ -310,11 +311,11 @@ The training job is S3-only, so it can run on a laptop against copies of the pro
The schedule is stopped outside prod US, so nothing runs unasked. If the run sits in `QUEUED`, check the daemon log for `Maximum is 10, won't launch more`: runs from a killed `dagster dev` stay `STARTED` forever and count against the local queue. Terminate them from the Runs page (force termination).
-4. Read the result from `s3://posthog/inbox_ranking/inbox_ranking_models/v1/report_embeddings/dt=<day>/metadata.json` (per-head AUCs, readability); the examples are at `s3://posthog/inbox_ranking/inbox_ranking_training_examples/v1/report_embeddings/dt=<day>/part-00000.parquet`:
+4. Read the result from `s3://posthog/inbox_ranking/inbox_ranking_models/v1/report_embeddings_v2/dt=<day>/metadata.json` (per-head AUCs, readability); the examples are at `s3://posthog/inbox_ranking/inbox_ranking_training_examples/v1/report_embeddings/dt=<day>/part-00000.parquet`:
```bash
AWS_ACCESS_KEY_ID=object_storage_root_user AWS_SECRET_ACCESS_KEY=object_storage_root_password \
- aws --endpoint-url http://localhost:19000 s3 cp s3://posthog/inbox_ranking/inbox_ranking_models/v1/report_embeddings/dt=2026-08-25/metadata.json -
+ aws --endpoint-url http://localhost:19000 s3 cp s3://posthog/inbox_ranking/inbox_ranking_models/v1/report_embeddings_v2/dt=2026-08-25/metadata.json -
```
Nothing here touches the prod bucket: the reader credential is read-only and the dag writes only to the local bucket.
@@ -351,7 +352,7 @@ The network leaves out every report that is in any head's holdout, so the compar
```text
s3://<bucket>/<prefix>/
├── inbox_ranking_nn_examples/v1/dt=YYYY-MM-DD/ # rows, a label and a holdout flag per head; no vectors
-└── inbox_ranking_models/v1/nn/
+└── inbox_ranking_models/v1/nn_v2/
├── dt=YYYY-MM-DD/model.onnx + model.holdout.onnx + metadata.json
└── champion.json # retired; nothing writes it
```
diff --git a/products/signals/dags/inbox_ranking/tests/test_training.py b/products/signals/dags/inbox_ranking/tests/test_training.py
index 8f1c9c89641a..dffb4602cbc9 100644
--- a/products/signals/dags/inbox_ranking/tests/test_training.py
+++ b/products/signals/dags/inbox_ranking/tests/test_training.py
@@ -340,19 +340,21 @@ def test_build_examples_drops_state_rows_read_long_after_their_snapshot():
"head_name,frame,expected_cohort,expected_label",
[
# action: cohort is everyone, so a never-impressed report an agent claimed is a positive.
- # A server-side action and a UI action are the same label.
+ # A server-side action, a UI action and a thumbs up are the same label. A thumbs down is not.
(
"action",
pd.DataFrame(
{
- "impression_unit_count": [0, 1, 1, 1],
- "claim_count": [1, 0, 0, 0],
- "reasoned_resolution_count": [0, 1, 0, 0],
- "view_diff_count": [0, 0, 2, 0],
+ "impression_unit_count": [0, 1, 1, 1, 1, 1],
+ "claim_count": [1, 0, 0, 0, 0, 0],
+ "reasoned_resolution_count": [0, 1, 0, 0, 0, 0],
+ "view_diff_count": [0, 0, 2, 0, 0, 0],
+ "feedback_positive_count": [0, 0, 0, 1, 0, 0],
+ "feedback_negative_count": [0, 0, 0, 0, 1, 0],
}
),
- [True, True, True, True],
- [True, True, True, False],
+ [True] * 6,
+ [True, True, True, True, False, False],
),
# fixed: cohort is everyone, label is a fix read from the status stream.
(
@@ -1791,7 +1793,7 @@ def test_model_key_layout_is_stable():
)
assert (
model_object_key("inbox_ranking", EMBEDDINGS_MODEL_NAME, "2026-08-19", "open.ubj")
- == "inbox_ranking/inbox_ranking_models/v1/report_embeddings/dt=2026-08-19/open.ubj"
+ == "inbox_ranking/inbox_ranking_models/v1/report_embeddings_v2/dt=2026-08-19/open.ubj"
)
assert snapshot_dates("2026-08-19", 2) == [
datetime.date(2026, 8, 17),
@@ -1959,7 +1961,7 @@ def test_examples_key_layout_is_per_feature_set():
# And one models prefix per family, so one family's booster never lands on another's.
assert (
model_object_key("inbox_ranking", EMBEDDINGS_MODEL_NAME, "2026-08-19", "open.ubj")
- == "inbox_ranking/inbox_ranking_models/v1/report_embeddings/dt=2026-08-19/open.ubj"
+ == "inbox_ranking/inbox_ranking_models/v1/report_embeddings_v2/dt=2026-08-19/open.ubj"
)
@@ -2829,7 +2831,7 @@ def test_the_serving_prefix_layout_is_stable():
assert serving_manifest_key("inbox_ranking") == "inbox_ranking/serving/manifest.json"
assert (
serving_model_prefix("inbox_ranking", model_key(EMBEDDINGS_MODEL_NAME, "2026-08-19"))
- == "inbox_ranking/serving/models/report_embeddings@2026-08-19"
+ == "inbox_ranking/serving/models/report_embeddings_v2@2026-08-19"
)
diff --git a/products/signals/dags/inbox_ranking/training/dag.py b/products/signals/dags/inbox_ranking/training/dag.py
index fe73a86f06ec..5935e290fdbe 100644
--- a/products/signals/dags/inbox_ranking/training/dag.py
+++ b/products/signals/dags/inbox_ranking/training/dag.py
@@ -182,7 +182,6 @@ _LABEL_COLUMNS = (
"pr_created_count",
"pr_merged_count",
"refund_count",
- "feedback_positive_count",
*ACTION_LABEL_COLUMNS,
*PROVENANCE_LABEL_COLUMNS,
)
diff --git a/products/signals/dags/inbox_ranking/training/heads.py b/products/signals/dags/inbox_ranking/training/heads.py
index 0d1df719f217..9418453c17ad 100644
--- a/products/signals/dags/inbox_ranking/training/heads.py
+++ b/products/signals/dags/inbox_ranking/training/heads.py
@@ -14,8 +14,9 @@ cloud inbox list emits them, and a report reached from Slack, the desktop app or
The dataset keeps them for position bias.
`action` counts intent from any surface: the inbox UI, external coding agents over MCP, the CLI,
-Slack and the desktop app. Self-driving's own `task` and `system` writes are excluded, because
-they are internal operational work and not a person acting on the report.
+Slack and the desktop app. A thumbs up on the report counts too, and a thumbs down does not.
+Self-driving's own `task` and `system` writes are excluded, because they are internal operational
+work and not a person acting on the report.
Only the heads the inbox reads are trained: `open`, `action` and `fixed` (`HeadRanker` in
`products/signals/backend/ranking/inbox_sort.py`). The dataset dag still snapshots the label columns
@@ -62,7 +63,11 @@ SERVER_ACTION_COLUMNS = (
"slack_discussion_count",
"reasoned_resolution_count",
)
-ACTION_LABEL_COLUMNS = UI_ACTION_COLUMNS + SERVER_ACTION_COLUMNS
+# A thumbs up says a person found the report useful, often without any other action on it. It stays
+# out of `UI_ACTION_COLUMNS`, because the `action` project vector reads only the `Inbox report
+# action` stream. A thumbs down is a negative judgment, not intent, so it is not a label column.
+FEEDBACK_ACTION_COLUMNS = ("feedback_positive_count",)
+ACTION_LABEL_COLUMNS = UI_ACTION_COLUMNS + SERVER_ACTION_COLUMNS + FEEDBACK_ACTION_COLUMNS
def acted(frame: pd.DataFrame) -> pd.Series:
diff --git a/products/signals/dags/inbox_ranking/training/unseen.py b/products/signals/dags/inbox_ranking/training/unseen.py
index ef098cd41137..67b1228b4df3 100644
--- a/products/signals/dags/inbox_ranking/training/unseen.py
+++ b/products/signals/dags/inbox_ranking/training/unseen.py
@@ -55,8 +55,10 @@ CANDIDATE_ROLE = "candidate"
# The model family: which features and which learner, as against `model_version`, the partition day
# it was fit on. Both are in the identity, so two families trained on one day stay apart.
-REPORT_EMBEDDINGS_MODEL_NAME = "report_embeddings"
-NN_MODEL_NAME = "nn"
+# A recipe change takes a new name (`training/recipe.py`). The versions of an earlier name stay
+# servable by key, and their online grades keep their own series.
+REPORT_EMBEDDINGS_MODEL_NAME = "report_embeddings_v2"
+NN_MODEL_NAME = "nn_v2"
# The Dagster code locations that train a family: `signals` on the main image, and `signals_ml` on
# the image that carries torch.
MAIN_LOCATION = "signals"