2919 Commits

Author SHA1 Message Date
Gustavo H. Strassburger
8425c2bf82 chore: improved cohorts calculation observability (#41465)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-13 21:19:00 -03:00
Michael Matloka
80356b50b0 feat(ai): Show recordings filters from within session_summarization (#41466) 2025-11-13 19:31:31 +00:00
Lucas Ricoy
0623433fe2 feat(web-analytics): add posthog ai filter tool (#41235)
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-13 18:51:06 +00:00
Emanuele Capparelli
ff5f297df9 fix(ph-ai): tell agent to use sentence case (#41473)
## Problem
The writing style guidelines for headers in our agent modes are inconsistent with our general writing style rule of using sentence case.

## Changes
Added a specific guideline for headers to use sentence case rather than title case in the writing style section of the agent modes prompts.

## How did you test this code?
Didn't
2025-11-13 18:49:32 +00:00
Emanuele Capparelli
9163fd6f62 fix(ph-ai): run FF tool on experiments page (#41343)
## Problem
This PR makes it possible to use the FF tool directly on the experiments page, since we have removed navigation.

It also adds suggestion pills for FF and experiments.

## Changes
- Added suggestions for feature flags and experiments
- Added the feature flag creation tool to the experiments page so users can create flags without navigating away

## How did you test this code?
Tests + locally
2025-11-13 18:16:53 +00:00
Oliver Browne
a09d30208a fix(arr): agents api is kill, rm "environment" (#41133)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joshua Snyder <joshua@posthog.com>
2025-11-13 17:22:34 +00:00
Georgiy Tarasov
7058c80c10 chore(ph-ai): bump limits for an org (#41464) 2025-11-13 17:17:35 +00:00
Emanuele Capparelli
daa062b202 feat(ph-ai): create experiments max tool (#40753)
## Problem
This PR introduces a new `MaxTool` to create experiments. It builds on top of the `create_feature_flag` `MaxTool` with multivariate flag support.

## Changes
- Added a new `CreateExperimentTool` that allows creating experiments via PostHog AI

## How did you test this code?
New tests + evals

## Changelog: (features only) Is this feature complete?
Yes, this feature is complete and ready to be included in the changelog.
2025-11-13 16:59:58 +00:00
Georgiy Tarasov
d8fdf6bbfe fix(ph-ai): conversation compaction edge cases (#41443) 2025-11-13 16:44:28 +00:00
Georgiy Tarasov
da1a1fb6d9 chore(ph-ai): increase cache ttl (#41458) 2025-11-13 16:42:58 +00:00
Emanuele Capparelli
ef116c6218 feat(ph-ai): create multivariate flags max tool (#40752)
## Problem
The feature flag `MaxTool` currently only supports simple boolean flags, but users need to create multivariate flags for A/B testing and experiments.

## Changes
- Added support for creating multivariate feature flags with multiple variants

## How did you test this code?
- Added unit tests and evals

## Changelog: (features only) Is this feature complete?
Yes, this feature is complete and ready to be included in the changelog.
2025-11-13 16:03:46 +00:00
Kim Svatos Dugan
e778b63e33 fix(replay): too small a limit causes 0 results with sampled replays (#41398)
## Problem

https://posthog.slack.com/archives/C03PB072FMJ/p1762902442761889?thread_ts=1762194137.014209&cid=C03PB072FMJ

we had a client who, when using the UI to filter, saw no results of session recordings. However, when going into recordsings manually, saw the filtered-for event. 

turns out with a high rate of sampling or recent sessions WITHOUT recordings (it appears every session of this client's should have this event, they have ~80K sessions per day, replay was turned off 9 days ago) the 10000 LIMIT is very likely to select event sessions that do NOT have a corresponding replay, meaning when we do this join we confusingly get 0 results. 

## Changes

Increase the limit. 
I asked claude if this was risky for perf: 
```
  Real-world risk: LOW
  - The query is already constrained by date range and team_id
  - ClickHouse handles large IN clauses routinely
  - Worst case: slightly slower query (probably milliseconds)
```

## How did you test this code?

spoofed user, ran this query directly in SQL -- with 10K limit, no results, with 1M limit, saw results (session replays returend)

<!-- Docs reminder: If this change requires updated docs, please do that! Engineers are the primary people responsible for their documentation. 🙌 -->

👉 _Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review._

## Changelog: (features only) Is this feature complete?

<!-- Yes if this is okay to go in the changelog. No if it's still hidden behind a feature flag, or part of a feature that's not complete yet, etc.  -->
<!-- Removing this section does not mean the changelog bot won't pick it up, because *some people* like to not use the template, so we can't rely on it existing. -->
2025-11-13 07:48:41 -08:00
Georgiy Tarasov
0de910862c chore(ph-ai): increase context window to 1M (#41445)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-13 15:27:55 +00:00
Emanuele Capparelli
001b04a34a fix(ph-ai): clarify prompt about person id join limitation (#41446)
## Problem

The current documentation for the `person_id_join_limitation` in HogQL AI generation is unclear and lacks comprehensive guidance on how to properly handle joins involving person_id fields. This leads to agents creating queries that result in ClickHouse errors due to forward references to override tables.

## Changes

Enhanced the `person_id_join_limitation` documentation in both `ee/hogai/graph/sql/prompts.py` and `posthog/hogql/ai.py` to:

## How did you test this code?

Hopefully it solves [https://us.posthog.com/project/2/error_tracking/0199e7eb-4ec0-73b1-8bc5-937a564aa75d?timestamp=2025-11-10T12%3A14%3A39.085000-08%3A00](error), will monitor
2025-11-13 15:14:22 +00:00
Yasen
d451e64e7f feat: Add access control to activity logs (#40801)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-13 16:04:14 +02:00
Paul D'Ambra
f0f29ca9a2 chore: move backend parts of session recording out of EE and into OSS (#41403)
we want to remove the EE licensed part of posthog
let's move all of the EE to OSS for replay backend
2025-11-13 13:36:30 +00:00
Alessandro Pogliaghi
70bdd5b1a4 feat(ph-ai): MaxTool error wrapper (#41289) 2025-11-13 13:51:03 +01:00
Yasen
5d786138f6 fix: Change all alog signal receivers to mutable ones … (#41422) 2025-11-13 13:11:06 +02:00
Emanuele Capparelli
1b3e03c640 fix(ph-ai): don't throw error when tool is hallucinated (#41418)
## Problem
The current implementation of `get_contextual_tool_class` only catches `KeyError` exceptions when looking up a tool by name, but it doesn't handle `ValueError` exceptions that can occur when an invalid tool name is passed to the `AssistantTool` constructor.

## Changes
Updated the exception handling in `get_contextual_tool_class` to catch both `KeyError` and `ValueError` exceptions, ensuring the function properly returns `None` for any invalid tool name.

## How did you test this code?
Didn't, sue me
2025-11-13 10:51:34 +00:00
Paweł Szczur
92e7c42c4e feat: Upgrade ClickHouse to 25.8.11.66 for CI and local dev (#41358)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-12 21:21:38 +01:00
PostHog Bot
4d0f8285a9 chore(deps): Update posthog-js to 1.292.0 (#41377) 2025-11-12 17:50:53 +01:00
Arthur Moreira de Deus
e487e83036 fix(customers): Invalidate query cache when usage metrics change (#41273)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-12 07:42:37 -08:00
PostHog Bot
6904b2696d chore(deps): Update posthog-js to 1.291.0 (#41353) 2025-11-12 14:15:22 +01:00
Hugues Pouillot
9ac691bf5d fix(err): fix similar issues query runner (#41055)
Signed-off-by: Hugues Pouillot <hpouillot@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-12 13:11:21 +01:00
Georgiy Tarasov
01b7125e6c fix(ph-ai): import contextual tools (#41342) 2025-11-12 11:20:13 +00:00
Alessandro Pogliaghi
b0e67ff485 feat(ph-ai): billing for posthog-ai (#40881) 2025-11-12 11:48:19 +01:00
Emanuele Capparelli
e4e25b23b0 fix(ph-ai): remove navigation tool (#41293)
## Problem
We have discussed ([online](https://posthog.slack.com/archives/C06NZEZ7V3Q/p1762190095126769) and offline at the offsite) that the navigation tool is currently disrupting:
- it breaks interactions on the current page by forcing the user to move to a different page
- it navigates to the SQL editor page whenever SQL is involved
- multi-tool flows need the agent to navigate between different pages (create ff/experiments)
- we want to move towards a ChatGPT/backend first agent, rather than a browser-use one
 
This PR removes the `navigate` tool.

## Changes
Removed any navigation tool-related code.

## How did you test this code?
Locally
2025-11-12 09:51:17 +00:00
Kim Svatos Dugan
85d57554d0 chore(replay): switch replay paging to cursor, not offset (#41136)
## Problem

we're using offset based pagination in session replay which is not as performant as using timestamp (or ORDER BY based) pagination: 
https://posthog.com/docs/api/queries#5-use-timestamp-based-pagination-instead-of-offset

## Changes

create a new paginator to paginate based on the order_by field
this uses a combination of the order_by field and session ID to tie-break (ie, if the user is sorting by clicks, there could be many many recordings with X clicks, we need to know which to start the next page on) 

Fallback to offset based pagination if there is no cursor

## How did you test this code?

Wrote tests, confirmed pagination still behaved as expected in product

[field_based_paginating.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.com/user-attachments/thumbnails/cf0c99bb-3efc-4b7e-a0b2-97a59ad5a7db.mov" />](https://app.graphite.com/user-attachments/video/cf0c99bb-3efc-4b7e-a0b2-97a59ad5a7db.mov)

<!-- Docs reminder: If this change requires updated docs, please do that! Engineers are the primary people responsible for their documentation. 🙌 -->

👉 _Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review._

## Changelog: (features only) Is this feature complete?

<!-- Optional, but helpful for our content team! -->
<!-- Yes if this is okay to go in the changelog. No if it's still hidden behind a feature flag, or part of a feature that's not complete yet, etc.  -->
2025-11-11 20:09:45 -08:00
Dustin Byrne
cbcc528b22 revert: Remove people from cohort creation activity log (#41290) (#41304) 2025-11-11 20:16:49 +00:00
Juraj Majerik
074b294ca7 feat(experiments): Add velocity stats (#41180)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-11 14:44:57 +01:00
Michael Matloka
94b2af0a3a fix(ai): Replace "Max can" with "PostHog AI can" (#41214)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2025-11-10 23:53:47 +00:00
Georgiy Tarasov
77963a6b12 feat(max): agent abstraction (#40539)
Co-authored-by: kappa90 <e.capparelli@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Emanuele Capparelli <kappa90@users.noreply.github.com>
2025-11-10 19:24:35 +01:00
Haven
fa9b9401d3 chore(workflows): remove Mailjet as email provider for Workflows (#41141)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-10 08:43:59 -08:00
Alessandro Pogliaghi
c5e39db25a fix(ph-ai): mock API call (#41189) 2025-11-10 13:46:18 +01:00
Georgiy Tarasov
bbb3e9f3dd fix(ph-ai): unhandled message type exception (#41168) 2025-11-09 10:15:10 +00:00
PostHog Bot
f82cebfbc7 chore(deps): Update posthog-js to 1.290.0 (#41128) 2025-11-07 17:48:56 +01:00
Alex Lebedev
26f97da3be feat(llma): Generate and embed LLM traces issue-search summaries (#40364)
Co-authored-by: Andrew Maguire <andrewm4894@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-07 11:03:21 +00:00
Tom Piccirello
2d2863f9aa chore(dev): revert: Allow local PostHog to connect to prod PG (#41097) 2025-11-07 10:32:29 +00:00
Michael Matloka
56a500afff fix(ai): Clarify array splitting requires null guard (#41024)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-07 03:20:52 +00:00
Michael Matloka
76fc9855f5 chore(dev): Allow local PostHog to connect to prod PG (#39854)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-07 03:13:40 +00:00
PostHog Bot
96455d5344 chore(deps): Update posthog-js to 1.289.0 (#41072) 2025-11-06 22:31:06 +01:00
Andy Zhao
90caacf3ed fix(subscriptions): retry sending msg when slack api fails to download (#40982) 2025-11-06 12:58:10 -05:00
PostHog Bot
02e5cb92e0 chore(deps): Update posthog-js to 1.288.1 (#41029) 2025-11-06 16:17:05 +01:00
Paul D'Ambra
5f002756ab chore: fix flapping test (#41000) 2025-11-06 09:38:34 +00:00
Alex Lebedev
41b9efc8ec feat(ph-ai): Get a limit of how many sessions to summaries from user's query. (#40953) 2025-11-05 18:25:27 +01:00
PostHog Bot
7830a9aa35 chore(deps): Update posthog-js to 1.288.0 (#40950) 2025-11-05 16:43:29 +01:00
Georgiy Tarasov
beadde8e4e feat(max): parallel tool calls (#39954)
Co-authored-by: kappa90 <e.capparelli@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-05 16:08:31 +01:00
Alex Lebedev
d2790da948 feat(max): Validate issues for session summaries with videos (behind FF) (#38507) 2025-11-05 14:36:10 +00:00
Paweł Szczur
5d723de47f feat: fix queries and tests before upgrading to ClickHouse v25.8.11.66 (#40927) 2025-11-05 13:55:49 +00:00
PostHog Bot
6a3e4cffaa chore(deps): Update posthog-js to 1.287.0 (#40928) 2025-11-05 12:24:24 +01:00