perf(sessions): persist conversation build caches across task re-opens - #76788
perf(sessions): persist conversation build caches across task re-opens#76788arnohillen wants to merge 4 commits into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Reviews (1): Last reviewed commit: "chore(sessions): add lru-cache to the ui..." | Re-trigger Greptile |
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
Generated-By: PostHog Desktop Task-Id: 6ee186ae-f972-424a-9636-b747d12e9cc8
feaf227 to
58d2773
Compare
|
React Doctor found 8 issues in 4 files · 4 errors & 4 warnings. Errors
4 warnings
Reviewed by React Doctor for commit |
HostHog preview —
|
Keeps the persistent conversation build cache and master's transcript stall logging: the stall-detection fields now live on ConversationBuildCache, so they survive a task re-open along with the builder. Generated-By: PostHog Desktop Task-Id: 341e450d-132c-42dd-abf2-52b22f99c3f6
🤖 CI report✅ Trunk lane — non-backend laneThis PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes. |
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
|
This PR was closed due to lack of activity. Feel free to reopen if it's still relevant. |
|
Reviews (2): Last reviewed commit: "chore(desktop): merge master into persis..." | Re-trigger Greptile |
Keep the raw-logs toggle master added around the cloud-run thread, and the persisted footer state this branch passes to the renderer. Generated-By: PostHog Desktop Task-Id: 341e450d-132c-42dd-abf2-52b22f99c3f6
There was a problem hiding this comment.
Not approved yet — waiting on the conditions below.
Re-add the stamphog label to request another review once you have addressed this.
Automated gates denied this PR outright — it adds a new third-party dependency (lru-cache) with a lockfile change and was classified as too large/complex for automated review, so it needs a human to sign off rather than an automated stamp.
- 👍 on the PR from greptile-apps[bot].
- 10 of the 10 changed files are governed by
products/desktop/AGENT_APPROVALS.md. - Gate denied: new dependency (lru-cache) added to package.json with a matching lockfile change, which is on the deny-list for automated approval.
- Gate denied: classified as T2-never (708 lines, 10 files) — outside the size/tier ceiling for automated review regardless of content.
- Author is not on the owning team (@PostHog/team-posthog-desktop) and there are no reviews/approvals yet providing independent assurance.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✗ | matches: deps_toolchain |
| size | ✓ | 403L, 8F substantive, 708L/10F incl. docs/generated/snapshots — within ceiling |
| tier | ✗ | classified as T2-never: T2-never (708L, 10F, single-area, perf) |
| stamphog 2.0.0b4 | .stamphog/policy.yml @ 7be337f · reviewed head 7be337f |
Ports PostHog/code#3976 onto
products/desktop/after the desktop import (the code repo'smainis frozen). Original commits and authorship are preserved viagit am.Problem
Clicking a task in the sidebar takes seconds before the transcript renders, even when the session data is already warm in the store. The task detail route fully unmounts on navigation, and the incremental conversation builder (
useConversationItems) and thread grouper both live in component-scoped refs, so every re-open falls back to a full O(n) re-parse of the transcript on the main thread.yieldToPaintalready documents the mount blocking "for hundreds of ms"; with multi-MB transcripts it is seconds.Changes
conversationDerivedCachemodule: a small LRU cache (8 tasks per scope, backed bylru-cache, already a workspace dependency via harness) keyed per call site + task that keeps the incremental builder state and thread grouper alive across mounts.useConversationItemsaccepts an optional persist key; without one, behavior is unchanged (per-component ref).ConversationViewandAcpChatThreadopt in with distinct scopes;ChatThreadFooternow receivesfooterStateand usage fromAcpChatThreadinstead of running its own duplicate parse.Warm re-opens (session still in the store) now reuse already-built items: idle sessions return the memoized result identity, and streaming sessions take the append-only fast path because the store keeps appending while the view is unmounted and immer preserves element identity.
Compared to the source PR, the only monorepo-specific change is the lockfile: instead of carrying the source
pnpm-lock.yamlhunk blindly, theproducts/desktop/pnpm-lock.yamlimporter entry was regenerated for the newpackages/uidependency (same resolution,lru-cache@11.2.5).How did you test this code?
evictEvents/removeSession, and the no-session exemption (guards rebuild churn on archive surfaces).products/desktop/:pnpm install --frozen-lockfile,pnpm typecheck(24/24 packages), and the full@posthog/uivitest suite (305 files, 2519 tests passing).Automatic notifications
Docs update
Not applicable (desktop app internals),
skip-inkeep-docslabel applied.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
This PR is a port of PostHog/code#3976, recreated here by PostHog Code following the /porting-code-prs skill: patch series applied with
git am --directory=products/desktop/(original authorship and commit messages preserved), source lockfile hunk excluded and re-derived against the monorepo lockfile instead. Part 1 of 3 ported PRs on task re-open latency.Created with PostHog Code