: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(phai): stop completed progress labels sticking as thinking status (#73255)
Georgiy Tarasov32de12f38d15
diff --git a/products/posthog_ai/frontend/logics/runStreamLogic.test.ts b/products/posthog_ai/frontend/logics/runStreamLogic.test.tsindex 88ae645ee278..89458e0d5838 100644--- a/products/posthog_ai/frontend/logics/runStreamLogic.test.ts+++ b/products/posthog_ai/frontend/logics/runStreamLogic.test.ts@@ -2412,6 +2412,36 @@ describe('runStreamLogic', () => {])})+ it('clears currentProgress when a step finishes so the milestone label never sticks as live status', async () => {+ await expectLogic(logic, () => {+ logic.actions.ingestAcpFrame(+ notification('_posthog/progress', {+ sessionId: 's',+ step: 'agent',+ status: 'in_progress',+ label: 'Starting agent',+ group: 'setup:run-1',+ })+ )+ }).toFinishAllListeners()++ expect(logic.values.currentProgress).toEqual('Starting agent')++ await expectLogic(logic, () => {+ logic.actions.ingestAcpFrame(+ notification('_posthog/progress', {+ sessionId: 's',+ step: 'agent',+ status: 'completed',+ label: 'Started agent',+ group: 'setup:run-1',+ })+ )+ }).toFinishAllListeners()++ expect(logic.values.currentProgress).toBeNull()+ })+it('falls back to detail when label is absent', async () => {await expectLogic(logic, () => {logic.actions.ingestAcpFrame(diff --git a/products/posthog_ai/frontend/logics/runStreamLogic.ts b/products/posthog_ai/frontend/logics/runStreamLogic.tsindex 58d7fb1c8c63..d59480002fbc 100644--- a/products/posthog_ai/frontend/logics/runStreamLogic.ts+++ b/products/posthog_ai/frontend/logics/runStreamLogic.ts@@ -1587,8 +1587,8 @@ export interface runStreamLogicActions {setCurrentMode: (mode: string) => {mode: string}- setCurrentProgress: (progress: string) => {- progress: string+ setCurrentProgress: (progress: string | null) => {+ progress: string | null}setCurrentStage: (stage: string | null) => {stage: string | null@@ -1817,7 +1817,7 @@ export const runStreamLogic = kea<runStreamLogicType>([handleStreamError: (envelope: StreamErrorEnvelope) => envelope,// Value-fold side effects emitted by ingestAcpFrame (thread items are derived in the projection).setCurrentMode: (mode: string) => ({ mode }),- setCurrentProgress: (progress: string) => ({ progress }),+ setCurrentProgress: (progress: string | null) => ({ progress }),/** Optional `task_run_state.stage` — wired for a future richer status surface (G6). */setCurrentStage: (stage: string | null) => ({ stage }),markRunStarted: true,@@ -3226,9 +3226,17 @@ export const runStreamLogic = kea<runStreamLogicType>([}if (method === '_posthog/progress') {const progress = (notification.params ?? {}) as PosthogProgressParams- actions.setCurrentProgress(- stringifyOptional(progress.label) ?? stringifyOptional(progress.detail) ?? ''- )+ const status = normalizeProgressStatus(progress.status)+ // A finished step is a milestone (the thread's progress card keeps it), not the current+ // activity — clear it so the thinking line falls back to the rotating message instead of+ // sticking on e.g. "Started agent" for the rest of the turn.+ if (status === 'completed' || status === 'failed') {+ actions.setCurrentProgress(null)+ } else {+ actions.setCurrentProgress(+ stringifyOptional(progress.label) ?? stringifyOptional(progress.detail) ?? ''+ )+ }return}// The agent-server persists the permission lifecycle to the run log — pending approvals