Skip to content

bench: replay PostHog#139159 (trunk-merge 35e7c8e) on Ravion posthog-bench - #18

Draft
tembo[bot] wants to merge 55 commits into
bench/base-594616efrom
trunk-merge/bench-139159
Draft

tembo[bot] wants to merge 55 commits into
bench/base-594616efrom
trunk-merge/bench-139159

Conversation

@tembo

@tembo tembo Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
  • In merge queue
  • Prioritize

Benchmark replay of upstream PostHog merge-queue PR PostHog#139159 (head 35e7c8e, base 594616e) with depot-ubuntu-* runners rewritten to Ravion posthog-bench. Do not merge.

dmarticus and others added 30 commits November 16, 2026 08:30
…ising

Generation settlement runs after the model call, so raising on a finalized
spend row threw away a paid response and failed every activity retry.
Non-strict settlement now logs and leaves the finalized totals unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 37cc720f-f056-4ec3-9990-c26c425576cd
A claim held by a person, by hand or through one of their agents, now covers all of their actors. Their other agents and the tasks they started resume it without takeover and can release it. A task counts as its creator only on requests the creator authenticates, because the task id header is caller-supplied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: ec7b2f8a-5d1e-436c-85e7-6cd7baec4202
…backs

On an authenticated request the task id header is caller-supplied, so a teammate could name the creator's task and resume a hand claim, or an agent claim the task was already associated with. Those fallbacks now apply only to server-side callers; a request counts a task only through the authenticated person check.

Generated-By: PostHog Desktop
Task-Id: 3751830c-75a4-47af-bdfd-2130901b9501
…im checks

Artefact writes bind a task's work to the active claim, and suggested-reviewer writes check a supplied claim, without the request's authenticated user. A teammate who named the creator's task could still attach notes or reviewer edits to the creator's claim. The task attribution from a request now keeps the authenticated user (not stored, not compared), so every claim check applies the creator rule.

Generated-By: PostHog Desktop
Task-Id: 3751830c-75a4-47af-bdfd-2130901b9501
Generated-By: PostHog Desktop
Task-Id: 6afd34cd-a992-4e47-b29e-519f237dd9fc
27 updated
Run: 86933f4b-5d10-40c1-8d1b-832684e9bc1c
Move the desktop workspace to posthog-node 6, which sends only to
capture v1, and drop the SDK major guard's hold on it.

Person processing for app events moves from the legacy
$process_person_profile property to the per-event option.

Co-authored-by: Anna Garcia <anna.g@posthog.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…compact-email-fields

# Conflicts:
#	products/workflows/frontend/Broadcasts/BroadcastWizard.tsx
@tembo tembo Bot closed this Nov 19, 2026
@tembo tembo Bot reopened this Nov 19, 2026
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in Greptile

[High impact] The PR adds a path for email-provider contacts to write people and cohort data.

The PR should not merge while contact delivery, cohort completion, opt-out copying, and the two frontend requirements remain unresolved.

Reviews (4) · Last reviewed commit: "Merge branch 'bench/base-594616e' into t..." · Reviewed by Greptile

raise

# A caller's transaction can still roll back the cohort, and events sent before that can't be taken back.
transaction.on_commit(dispatch)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Queued contacts are lost. For provider imports, _save_page commits the page as completed before these callbacks run. If capture_people_import.delay fails, dispatch deletes that chunk's stored rows and raises. Django also skips the remaining callbacks. The retry then exits because _claim_step sees a completed step. A temporary queue outage can therefore lose contacts while the run reports success. Save the dispatch work durably so it can be retried after the page commits.

Prompt To Fix With AI
This is a comment left during a code review.
Path: products/workflows/backend/services/people_import.py
Line: 209

Comment:
**Queued contacts are lost.** For provider imports, `_save_page` commits the page as completed before these callbacks run. If `capture_people_import.delay` fails, `dispatch` deletes that chunk's stored rows and raises. Django also skips the remaining callbacks. The retry then exits because `_claim_step` sees a completed step. A temporary queue outage can therefore lose contacts while the run reports success. Save the dispatch work durably so it can be retried after the page commits.

---

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

Comment on lines +55 to +66
# One import holds a bounded number of rows, so a long list fills the cohort in several imports.
for start in range(0, len(rows), MAX_PEOPLE_IMPORT_ROWS):
summary = start_people_import(
team=team,
user=user,
name=cohort.name,
rows=list(rows[start : start + MAX_PEOPLE_IMPORT_ROWS]),
cohort_id=cohort.cohort_id,
create_missing=create_people,
send_events=send_events,
fill_only=True,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Cohorts finish before every chunk. Lists over 50,000 contacts start several independent imports into the same cohort. Each eventually calls calculate_cohort_from_list, which clears is_calculating and replaces the import totals for just its own chunk. The first finished chunk makes the cohort page stop polling while other contacts are still missing. The final import totals also describe only one chunk. Track completion and totals across the whole list before marking the cohort ready.

Prompt To Fix With AI
This is a comment left during a code review.
Path: products/workflows/backend/services/provider_contacts.py
Line: 55-66

Comment:
**Cohorts finish before every chunk.** Lists over 50,000 contacts start several independent imports into the same cohort. Each eventually calls `calculate_cohort_from_list`, which clears `is_calculating` and replaces the import totals for just its own chunk. The first finished chunk makes the cohort page stop polling while other contacts are still missing. The final import totals also describe only one chunk. Track completion and totals across the whole list before marking the cohort ready.

---

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

Comment on lines +252 to +255
result = _import(context, everyone, create_people=NEW_PEOPLE_STEP in context.steps, send_events=True)
if result.status == "failed":
raise ImportStepError(" ".join(result.notes))
return SavedPage(imported=result.people, counts={"people": result.people, "contacts": contacts_checked})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Later matches lose opt-outs. contact_properties matches people again and adds them to the cohort, but never calls carry_opt_outs. During this multi-day import, someone skipped by contacts can register with the same email in different letter casing before the properties step reaches them. That step then adds the person without copying their stored opt-out to the spelling PostHog sends to. Email checks use the exact spelling and allow a missing preference. Carry opt-outs for this step's matched addresses before its events are queued, as save_contact_lists does.

Prompt To Fix With AI
This is a comment left during a code review.
Path: products/messaging/backend/provider_imports/contacts.py
Line: 252-255

Comment:
**Later matches lose opt-outs.** `contact_properties` matches people again and adds them to the cohort, but never calls `carry_opt_outs`. During this multi-day import, someone skipped by `contacts` can register with the same email in different letter casing before the properties step reaches them. That step then adds the person without copying their stored opt-out to the spelling PostHog sends to. Email checks use the exact spelling and allow a missing preference. Carry opt-outs for this step's matched addresses before its events are queued, as `save_contact_lists` does.

---

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

const { setEmailTemplateValue } = useActions(emailTemplaterLogic)
const { integrations, integrationsLoading } = useValues(integrationsLogic)
const rotationEnabled = useFeatureFlag('WORKFLOWS_EMAIL_SENDER_ROTATION')
const [customOpen, setCustomOpen] = useState(false)

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 Sender state bypasses Kea. The new customOpen value uses useState in a scene component. The frontend guide forbids useState and useEffect for local state outside library components under lib/. Move this value and its actions into emailTemplaterLogic or a dedicated Kea logic.

Context Used: Rules for writing frontend code at PostHog (mostly React + Typescript with Kea) (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/hog-functions/email-templater/QuillEmailHeaderFields.tsx
Line: 291

Comment:
**Sender state bypasses Kea.** The new `customOpen` value uses `useState` in a scene component. The frontend guide forbids `useState` and `useEffect` for local state outside library components under `lib/`. Move this value and its actions into `emailTemplaterLogic` or a dedicated Kea logic.

**Context Used:** Rules for writing frontend code at PostHog (mostly React + Typescript with Kea) ([source](https://github.com/ravionhq/posthog/blob/master/.cursor/rules/react-typescript.mdc))

---

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

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

)
}

function SenderField(): JSX.Element {

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 Header components share one file. The frontend guide requires one component per file, named after its export. This new file also defines HeaderField, SenderField, and several other components. Split them into feature-local files with named exports.

Context Used: frontend/src/AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/hog-functions/email-templater/QuillEmailHeaderFields.tsx
Line: 286

Comment:
**Header components share one file.** The frontend guide requires one component per file, named after its export. This new file also defines `HeaderField`, `SenderField`, and several other components. Split them into feature-local files with named exports.

**Context Used:** frontend/src/AGENTS.md ([source](https://github.com/ravionhq/posthog/blob/master/frontend/src/AGENTS.md))

---

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

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@tembo

tembo Bot commented Nov 19, 2026

Copy link
Copy Markdown
Author

@greptile-apps[bot] I'm working on your request now and will update you when I'm done.

View on Tembo

@tembo tembo Bot closed this Nov 20, 2026
@tembo tembo Bot reopened this Nov 20, 2026
@tembo tembo Bot closed this Nov 20, 2026
@tembo tembo Bot reopened this Nov 20, 2026
@tembo tembo Bot closed this Nov 20, 2026
@tembo tembo Bot reopened this Nov 20, 2026
@tembo tembo Bot closed this Nov 20, 2026
@tembo tembo Bot reopened this Nov 20, 2026
Comment on lines +199 to +207
return SavedPage(
imported=result.people,
counts={
"people": result.people,
"new_people": result.new_people,
"skipped_new_people": result.skipped_new_people,
"dropped": result.dropped,
},
items=tuple(items),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Failed contacts appear completed

When import_provider_contacts returns status="failed"—for example, because first_name is not writable—save_contact_lists still returns a normal SavedPage. The runner marks Contacts completed, so contact_properties passes its dependency check despite the failure. Without that optional step, the whole run can report success with no contacts imported.

Propagate the failed result to the step before marking it completed.

Prompt To Fix With AI
This is a comment left during a code review.
Path: products/messaging/backend/provider_imports/contacts.py
Line: 199-207

Comment:
**Failed contacts appear completed**

When `import_provider_contacts` returns `status="failed"`—for example, because `first_name` is not writable—`save_contact_lists` still returns a normal `SavedPage`. The runner marks Contacts completed, so `contact_properties` passes its dependency check despite the failure. Without that optional step, the whole run can report success with no contacts imported.

Propagate the failed result to the step before marking it completed.

---

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

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants