Skip to content

Bug report: desktop - setup script doesn't run until the Setup tab is clicked #115533

Description

@christiaan-ph

In PostHog Desktop, an environment's setup script does not start when a new worktree task is created. The task shows a Setup: <environment name> tab with a loading spinner, but the script only begins running once that tab is clicked. The environment settings say the script "Runs in the worktree root right after it's created, before the agent starts." The agent also starts without waiting for the setup script to finish.

How to reproduce

  1. In PostHog Desktop, go to Settings > Environment and create an environment named default for a local repository, with the setup script date > setup-ran.txt.
  2. Create a new local task in a worktree, pick the default environment in the worktree picker, and approve the setup script prompt.
  3. Stay on the task's chat. The "Setup: default" tab shows a spinner, setup-ran.txt does not appear in the worktree, and the agent starts working.
  4. Click the "Setup: default" tab. The script starts running and setup-ran.txt appears.

Additional context

From support ticket 69215

Reported on desktop-v0.61.22 (macOS). The setup dispatch code is unchanged on master as of desktop-v0.61.671. It starts at dispatchEnvironmentSetup in taskCreationSaga.ts.

Activity

  1. posthog commented on Oct 12, 2026

    @posthog
    Contributor

    PostHog self-driving picked up this issue and researched it. Somebody may already be working on it, so ask before you start a fix.

    Report (team access only): https://us.posthog.com/project/2/inbox/reports/01a130af-9a1c-7469-bcac-4d469a77333a?link_source=github_comment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions