: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(mobile): deduplicate active compaction notices (#128554)
Chris Volzercdb54de7c54f
diff --git a/products/mobile/docs/CHAT.md b/products/mobile/docs/CHAT.mdindex 61c62110cd9d..b247eb802050 100644--- a/products/mobile/docs/CHAT.md+++ b/products/mobile/docs/CHAT.md@@ -390,6 +390,8 @@ New chat drops it.- Assistant text renders as markdown with `react-native-markdown-display`, styled from `src/ui/tokens.ts`.`html: false`; images are dropped. Relative links open on the signed-in host; only http(s) links open.- The status line shows the current stage or tool, "Thinking…", or "Reconnecting…".+- Compacting and clearing each show one active spinner, even when the stream repeats the start.+ Completion removes that spinner, so a later compaction or clear can show a new one.- Thoughts and tool calls fold into activity rows. Every row starts closed, also while it runs. `mobile_chat_activity_expanded` is captured with `running` and `tool_count` when the person opens one.- Background-task notices (including checkmarked completion summaries) align left and show at most two lines by default.Notices that wrap beyond two lines offer Show more to read the full text and Show less to return to the preview.diff --git a/products/mobile/src/features/chat/session/sessionReducer.test.ts b/products/mobile/src/features/chat/session/sessionReducer.test.tsindex 95fd7a3aca36..b8244606adda 100644--- a/products/mobile/src/features/chat/session/sessionReducer.test.ts+++ b/products/mobile/src/features/chat/session/sessionReducer.test.ts@@ -425,6 +425,31 @@ describe('session thread reducer', () => {expect(rows(state)).toEqual(['user: Try again', 'error(undelivered): out of memory'])})+ test.each([LIVE, REPLAY])('keeps one active compaction notice for $source frames', (context) => {+ const start = notification('_posthog/status', { status: 'compacting' })+ const compacting = play([start, start, start], context)+ expect(rows(compacting)).toEqual(['notice(info, spinning): Compacting the conversation'])++ const completed = play([notification('_posthog/compact_boundary', { trigger: 'auto' })], context, compacting)+ expect(rows(completed)).toEqual(['notice(info): Compacted the conversation'])++ const nextCompaction = play([start, start], context, completed)+ expect(rows(nextCompaction)).toEqual([+ 'notice(info): Compacted the conversation',+ 'notice(info, spinning): Compacting the conversation',+ ])+ expect(new Set(nextCompaction.items.map((item) => item.id)).size).toBe(nextCompaction.items.length)+ expect(+ rows(+ play(+ [notification('_posthog/status', { status: 'compacting', isComplete: true })],+ context,+ nextCompaction+ )+ )+ ).toEqual(['notice(info): Compacted the conversation'])+ })+test('progress steps group by id and status spinners leave when their work completes', () => {const state = play([notification('_posthog/progress', { group: 'setup', step: 'clone', status: 'in_progress', label: 'Clone' }),diff --git a/products/mobile/src/features/chat/session/sessionReducer.ts b/products/mobile/src/features/chat/session/sessionReducer.tsindex 1ab0a3a79539..71d49a58dc4c 100644--- a/products/mobile/src/features/chat/session/sessionReducer.ts+++ b/products/mobile/src/features/chat/session/sessionReducer.ts@@ -746,6 +746,10 @@ class Draft {this.retireSpinner(status)return}+ const prefix = `status-${status}-`+ if (this.items.some((item) => item.kind === 'notice' && item.spinning && item.id.startsWith(prefix))) {+ return+ }this.notice(text, 'info', `status-${status}`, true)}