Skip to content

chore(signals): sync prod snapshots to run the inbox ranking training job locally - #91322

Merged
trunk-io[bot] merged 4 commits into
masterfrom
chore/inbox-ranking-local-training-loop
Aug 31, 2026
Merged

chore(signals): sync prod snapshots to run the inbox ranking training job locally#91322
trunk-io[bot] merged 4 commits into
masterfrom
chore/inbox-ranking-local-training-loop

Conversation

@andrewm4894

Copy link
Copy Markdown
Member

Problem

  • Anyone changing the inbox ranking training dag can verify it only through unit tests and then the next 06:00 UTC prod tick: one iteration per day.
  • The training job reads and writes S3 only, so it can run on a laptop against copies of the prod snapshots, but nothing documented how.

Changes

  • products/signals/dags/inbox_ranking/bin/sync_snapshots_local.sh copies the inbox_report_state and inbox_report_labels partitions from the prod bucket into local SeaweedFS, through a disk cache, and prints the days present in both tables.
    • It reads with the existing read-only reader credential and writes only to the local posthog bucket. Nothing touches the prod prefix.
  • The dag README gains a "Running the training job locally" section: sync, launch from the local Dagster UI or CLI, read metadata.json, and the stuck-queue gotcha (runs left STARTED by a killed dagster dev count against the local cap of 10).
  • No code path changes. The dataset job stays prod-only; it needs the dogfood ClickHouse and cross-region Postgres.

How did you test this code?

  • Ran the script, then inbox_ranking_training_job for dt=2026-08-25 from local Dagster: 20 snapshots present, the run completed in about 40 seconds and wrote a candidate with four readable heads.
  • No automated tests: a shell script and docs.

Automatic notifications

  • Publish to changelog?

Docs update

The README section is the doc.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Fable 5), session. Skills invoked: /writing-pr-descriptions and the inbox-ranking team skill from the skills store. The prod-side sync (SSO login, secret read, aws s3 sync) ran from the user's terminal; the agent ran the local half and the Dagster run.

@andrewm4894 andrewm4894 added the skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs label Aug 29, 2026
@andrewm4894 andrewm4894 self-assigned this Aug 29, 2026
@trunk-io

trunk-io Bot commented Aug 29, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

@andrewm4894
andrewm4894 marked this pull request as ready for review August 29, 2026 21:54
@andrewm4894 andrewm4894 added the stamphog Request AI approval (no full review) label Aug 29, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T11:43:09.800728Z ee66b05 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@andrewm4894

Copy link
Copy Markdown
Member Author

/trunk merge

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team August 29, 2026 21:54
@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
products/signals/dags/inbox_ranking/README.md:83
**Internal access details exposed**

The new public workflow names the internal secrets role, profile, access system, production bucket, and reader-secret identifier. Move these operational details to internal documentation so they are not exposed publicly or presented to external readers as usable setup instructions.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "chore(signals): sync prod snapshots to r..." | Re-trigger Greptile

Comment thread products/signals/dags/inbox_ranking/README.md Outdated
chatgpt-codex-connector[bot]

This comment was marked as outdated.

@stamphog

stamphog Bot commented Aug 29, 2026

Copy link
Copy Markdown

A Codex review is actively running on the latest commit (started 2026-08-29T22:11:43 per the discussion comment, no completed verdict yet) — the earlier Codex/Greptile feedback only covers an older commit, so the current head hasn't been cleared. Auto-approving over an in-flight review risks conflicting with findings that land moments later.

  • Author wrote 0% of the modified lines and has 8 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
  • Codex's review on commit 2d9d546 is still marked 'Running' with no completed result yet — wait for it before merging.
  • Greptile flagged that the README now documents the internal SSO role, profile, prod bucket name, and secrets-manager identifier used to run this locally; worth a quick look even though no actual credentials are included.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 79L, 1F substantive, 112L/2F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1c-medium (112L, 2F, single-area, chore)
stamphog 2.0.0b4 .stamphog/policy.yml @ 2d9d546 · reviewed head 2d9d546

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Aug 29, 2026
@andrewm4894 andrewm4894 added the stamphog Request AI approval (no full review) label Aug 29, 2026
@andrewm4894 andrewm4894 added stamphog Request AI approval (no full review) and removed stamphog Request AI approval (no full review) labels Aug 29, 2026
@andrewm4894

Copy link
Copy Markdown
Member Author

/trunk merge

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d9d5465f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread products/signals/dags/inbox_ranking/README.md Outdated
Comment thread products/signals/dags/inbox_ranking/bin/sync_snapshots_local.sh Outdated
Comment thread products/signals/dags/inbox_ranking/bin/sync_snapshots_local.sh Outdated
Comment thread products/signals/dags/inbox_ranking/README.md Outdated
Comment thread products/signals/dags/inbox_ranking/bin/sync_snapshots_local.sh
Comment thread products/signals/dags/inbox_ranking/bin/sync_snapshots_local.sh
@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Aug 29, 2026
@andrewm4894

Copy link
Copy Markdown
Member Author

/trunk merge

- prefer OBJECT_STORAGE_ENDPOINT over the localhost default for the local hop
- turn xtrace off before the reader credential enters the shell
- list partitions from parquet files, not directories a scrub leaves empty
- README: check .env.local for INBOX_RANKING_DATASET_S3_BUCKET, pick the
  newest common partition, note the dev bucket is unauthenticated

Claude-Session: https://claude.ai/code/session_01Y9VyXUkutac4vDhgEsDjDT
@andrewm4894

Copy link
Copy Markdown
Member Author

/trunk merge

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee66b05def

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


SECRETS_PROFILE="${SECRETS_PROFILE:-prod-us-secrets}"
PROD_BUCKET="${INBOX_RANKING_PROD_BUCKET:-posthog-inbox-ranking-dataset-prod-us}"
PREFIX="${INBOX_RANKING_DATASET_S3_PREFIX:-inbox_ranking}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Separate the production and local dataset prefixes

When local Dagster uses a supported custom INBOX_RANKING_DATASET_S3_PREFIX, passing that setting to this script also changes the production source path, so it looks for snapshots under the local-only prefix and a fresh sync finds nothing. If the value exists only in .env.local, the inverse mismatch occurs: the script uploads under inbox_ranking while Dagster reads the custom prefix. Use separate source and destination prefix settings so both configurations can stay aligned.

Useful? React with 👍 / 👎.

Comment on lines +108 to +109
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/dt=2026-08-25/metadata.json -

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use configured storage values to read results

When a developer uses supported custom object-storage credentials, endpoint, bucket, or dataset prefix, the sync and training run can succeed but this command still queries the default SeaweedFS instance with its default credentials and path. It then fails authentication or reports a missing result from the wrong store; construct this command from the same OBJECT_STORAGE_* and prefix values used by the workflow.

AGENTS.md reference: AGENTS.md:L199-L199

Useful? React with 👍 / 👎.

@trunk-io
trunk-io Bot merged commit 1ae98cb into master Aug 31, 2026
213 checks passed
@trunk-io
trunk-io Bot deleted the chore/inbox-ranking-local-training-loop branch August 31, 2026 11:58
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-31 12:24 UTC Run
prod-us ✅ Deployed 2026-08-31 12:54 UTC Run
prod-eu ✅ Deployed 2026-08-31 12:56 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-agent-review Save $$$, skip auto agent reviews (Greptile) — use for trivial or chore PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants