Skip to content

fix(desktop): keep task startup in loading state - #95870

Merged
trunk-io[bot] merged 4 commits into
masterfrom
posthog/optimistic-task-loading
Sep 7, 2026
Merged

trunk-io[bot] merged 4 commits into
masterfrom
posthog/optimistic-task-loading

Conversation

@adamleithp

@adamleithp adamleithp commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

People see several infrastructure states while a task starts, which makes normal startup look stalled or inactive.

Setup logs can also replace the startup spinner before the agent starts the first prompt.

Changes

  • Task creation, worktree setup, queueing, sandbox setup, and connection setup now show a spinner with Loading.
  • Setup logs keep the loading state active until the active run sends its first prompt.
  • A failed run replaces the spinner with a red Failed status.
  • The status marker uses the standard spinner instead of the dot-ring animation.
  • Run-bound markers prevent old run updates from ending a successor run's loading state.
  • Transcript hydration preserves the first-prompt state across window replacement and event eviction.

Before:

flowchart LR
    A[Submit task] --> B[Starting task]
    B --> C[Queue status]
    C --> D[Sandbox status]
    D --> E[Conversation]
    classDef phBlue fill:#1d4aff,stroke:#1d4aff,color:#fff;
    classDef phYellow fill:#f9bd2b,stroke:#f9bd2b,color:#000;
    class A,E phBlue;
    class B,C,D phYellow;
Loading

After:

flowchart LR
    A[Submit task] --> B[Loading]
    B --> C[First prompt]
    C --> D[Working]
    B --> E[Failed]
    classDef phBlue fill:#1d4aff,stroke:#1d4aff,color:#fff;
    classDef phRed fill:#f54e00,stroke:#f54e00,color:#fff;
    classDef phYellow fill:#f9bd2b,stroke:#f9bd2b,color:#000;
    class A,C,D phBlue;
    class B phYellow;
    class E phRed;
Loading

No screenshot: the local Electron app did not finish booting in this sandbox.

How did you test this code?

  • The session tests cover fresh, resumed, stale, offline, failed, hydrated, evicted, and terminal runs.
  • The UI tests cover Loading, Working, Failed, permissions, and standard spinner rendering.
  • The thermo-nuclear code quality review approved the final transition model.
  • pnpm typecheck
  • Biome checks for the full Desktop workspace and packages/core
  • node scripts/check-host-boundaries.mjs
  • uv run ./bin/hogli ci:preflight --strict

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Automatic notifications

  • Publish to changelog?

Docs update

No docs change. This change only affects transient task status text and icons.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • The PostHog Desktop agent used independent review agents and repository file tools.
  • Skills: /posthog-desktop, /writing-ui-components, /writing-user-facing-copy, /writing-tests, /writing-code-comments, /writing-simplified-technical-english, /qa-team, /dynamic-workflows, /running-ci-preflight, /test-electron-app, and /writing-pr-descriptions.
  • The review found lifecycle races, and the final design uses one run-scoped core lifecycle model.
  • The duplicate search found no open PR for this change.
  • The public diff contains no private task material.

Created with PostHog Desktop

@adamleithp adamleithp self-assigned this Sep 7, 2026
@trunk-io

trunk-io Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@adamleithp adamleithp added the skip-inkeep-docs Use this label to skip an Inkeep docs PR in posthog.com label Sep 7, 2026 — with PostHog
@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

React Doctor found 2 issues in 2 files · 2 warnings.

2 warnings

packages/ui/src/features/sessions/components/SessionView.tsx

packages/ui/src/features/sidebar/components/items/TaskStatusDot.tsx

Reviewed by React Doctor for commit a6add0f.

@github-actions github-actions Bot added the feature/desktop Feature Tag: Desktop label Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane (fe:product:desktop)

This PR is assigned to the non-backend lane (fe:product:desktop). It does not run backend Python tests and may merge in parallel with PRs in other lanes.

@hosthog

hosthog Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

HostHog preview — posthog-desktop-web

The previews for this PR have been torn down and no longer serve.

@adamleithp
adamleithp marked this pull request as ready for review September 7, 2026 14:49
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team September 7, 2026 14:51
@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "Merge branch 'master' into posthog/optim..." | Re-trigger Greptile

@adamleithp
adamleithp force-pushed the posthog/optimistic-task-loading branch from 881e9f0 to 570529b Compare September 7, 2026 14:56
Show one optimistic loading state until the active run starts. Replace the loading state with a clear failure result when startup fails.

Generated-By: PostHog Desktop
Task-Id: 43a66a0d-939d-4204-ac8a-c6a5d8233eb5
Track startup by run and preserve first-prompt state across hydration. Clear loading only for matching prompt, failure, offline, or terminal transitions.

Generated-By: PostHog Desktop
Task-Id: 43a66a0d-939d-4204-ac8a-c6a5d8233eb5
Update the recovery test for run-bound startup markers.

Generated-By: PostHog Desktop
Task-Id: 43a66a0d-939d-4204-ac8a-c6a5d8233eb5
Keep the latest session summary component while removing obsolete startup imports.

Generated-By: PostHog Desktop
Task-Id: 43a66a0d-939d-4204-ac8a-c6a5d8233eb5
@adamleithp
adamleithp force-pushed the posthog/optimistic-task-loading branch from b752543 to a6add0f Compare September 7, 2026 15:04
@adamleithp adamleithp added the stamphog Request AI approval (no full review) label Sep 7, 2026 — with PostHog

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved.

Contained UI/state-machine change to the desktop app's own task-status display (no auth, billing, migration, or CI surface), authored by a member of the owning team with extensive new/updated tests covering the added lifecycle edge cases, and no unresolved reviewer concerns.

  • Author wrote 21% of the modified lines and has 53 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
  • 27 of the 27 changed files are governed by products/desktop/AGENT_APPROVALS.md.
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 577L, 17F substantive, 942L/27F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1d-complex (942L, 27F, single-area, fix)
stamphog 2.0.0b4 .stamphog/policy.yml @ a6add0f · reviewed head a6add0f

@trunk-io
trunk-io Bot merged commit bf7cf45 into master Sep 7, 2026
227 of 228 checks passed
@trunk-io
trunk-io Bot deleted the posthog/optimistic-task-loading branch September 7, 2026 19:52
@deployment-status-posthog

deployment-status-posthog Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-07 20:09 UTC Run
prod-us ✅ Deployed 2026-09-07 20:22 UTC Run
prod-eu ✅ Deployed 2026-09-07 20:28 UTC Run

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

Labels

feature/desktop Feature Tag: Desktop skip-inkeep-docs Use this label to skip an Inkeep docs PR in posthog.com stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant