Skip to content

: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.

fix(desktop): clarify cloud github setup actions (#103271)

Dylan Martin562d27aac6f2
diff --git a/products/desktop/docs/CONVENTIONS.md b/products/desktop/docs/CONVENTIONS.md
index 51215af099fb..dcb7a847c855 100644
--- a/products/desktop/docs/CONVENTIONS.md
+++ b/products/desktop/docs/CONVENTIONS.md
@@ -138,6 +138,13 @@ Barrel files hide dependency edges, increase circular import risk, and make refa
## Styling
+The cloud GitHub setup dialog separates its introduction from its actions.
+Use full-width primary and dismiss buttons, followed by a muted permissions caption with an inline, underlined Details link.
+Keep the action order: Connect GitHub, Not now, Details.
+The caption must cover repository writes, read access to email addresses and organization membership, and authorization to act as the user.
+Do not imply that writes are limited to pull requests or that every connection requires a new repository selection.
+Existing installations can use the personal OAuth flow without the repository picker.
+
Use Tailwind first. The project uses Tailwind v4 with Radix CSS variables. Those *variables* are fine and stay; Radix *components* are banned (see [UI Components](../AGENTS.md#ui-components)).
Examples:
diff --git a/products/desktop/packages/ui/src/features/integrations/components/GithubConnectionIcon.tsx b/products/desktop/packages/ui/src/features/integrations/components/GithubConnectionIcon.tsx
index 86c5a53d6c6f..8a99a52f07a7 100644
--- a/products/desktop/packages/ui/src/features/integrations/components/GithubConnectionIcon.tsx
+++ b/products/desktop/packages/ui/src/features/integrations/components/GithubConnectionIcon.tsx
@@ -1,4 +1,8 @@
-import { GithubLogoIcon, HeartIcon } from "@phosphor-icons/react";
+import {
+ ArrowsLeftRightIcon,
+ GithubLogoIcon,
+ HeartIcon,
+} from "@phosphor-icons/react";
import Logo from "@posthog/ui/primitives/Logo";
import { Spinner } from "@posthog/ui/primitives/Spinner";
import { domAnimation, LazyMotion, m, useReducedMotion } from "framer-motion";
@@ -6,11 +10,13 @@ import { domAnimation, LazyMotion, m, useReducedMotion } from "framer-motion";
interface GithubConnectionIconProps {
connected: boolean;
loading?: boolean;
+ paired?: boolean;
}
export function GithubConnectionIcon({
connected,
loading = false,
+ paired = false,
}: GithubConnectionIconProps) {
const shouldReduceMotion = useReducedMotion() === true;
const movementTransition = {
@@ -23,8 +29,7 @@ export function GithubConnectionIcon({
delay: shouldReduceMotion ? 0 : 0.8,
ease: [0.215, 0.61, 0.355, 1] as const,
};
- const tileClassName =
- "absolute top-1/2 left-1/2 flex size-8 items-center justify-center rounded-md border border-border bg-muted";
+ const tileClassName = `absolute top-1/2 left-1/2 flex size-8 items-center justify-center rounded-md bg-muted ${paired ? "" : "border border-border"}`;
return (
<LazyMotion features={domAnimation}>
@@ -97,6 +102,31 @@ export function GithubConnectionIcon({
<GithubLogoIcon size={17} weight="fill" />
</m.span>
</div>
+ ) : paired && !loading ? (
+ <div
+ className="flex h-8 w-28 items-center justify-center gap-2"
+ aria-label="Connect PostHog to GitHub"
+ role="img"
+ >
+ <span
+ aria-hidden="true"
+ className="flex size-8 items-center justify-center rounded-md bg-muted"
+ >
+ <span className="[&>svg]:h-3.5 [&>svg]:w-auto">
+ <Logo wordmark={false} />
+ </span>
+ </span>
+ <ArrowsLeftRightIcon
+ aria-hidden="true"
+ className="size-4 text-muted-foreground"
+ />
+ <span
+ aria-hidden="true"
+ className="flex size-8 items-center justify-center rounded-md bg-muted"
+ >
+ <GithubLogoIcon className="size-4" weight="fill" />
+ </span>
+ </div>
) : (
<div className="relative h-8 w-28" aria-label="GitHub" role="img">
<m.span
diff --git a/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialog.test.tsx b/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialog.test.tsx
index 8ab87837fda9..852f952b8e88 100644
--- a/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialog.test.tsx
+++ b/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialog.test.tsx
@@ -1,5 +1,11 @@
import { useRendererWindowFocusStore } from "@posthog/ui/shell/rendererWindowFocusStore";
-import { act, fireEvent, render, screen } from "@testing-library/react";
+import {
+ act,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { CloudGithubSetupDialog } from "./CloudGithubSetupDialog";
@@ -57,7 +63,7 @@ describe("CloudGithubSetupDialog", () => {
).toBeInTheDocument();
expect(
screen.getByText(
- "To run this task in the cloud, PostHog reads the GitHub repositories you authorize so agents can use their latest code. Code changes are sent in a pull request for your review.",
+ "Agents work from the latest code in the repos you authorize. Changes come back as pull requests for you to review.",
),
).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "Connect GitHub" }));
@@ -69,9 +75,14 @@ describe("CloudGithubSetupDialog", () => {
const user = userEvent.setup();
render(<CloudGithubSetupDialog onConnected={vi.fn()} onClose={vi.fn()} />);
+ expect(
+ screen.getByRole("button", { name: "Details" }).closest("p"),
+ ).toHaveTextContent(
+ "Read/write access to authorized repos, plus read access to email addresses and organization membership. PostHog can act as you on GitHub. Details",
+ );
await user.click(
screen.getByRole("button", {
- name: "What permissions does this grant?",
+ name: "Details",
}),
);
@@ -80,6 +91,32 @@ describe("CloudGithubSetupDialog", () => {
);
});
+ it("orders the actions as Connect GitHub, Not now, and Details", async () => {
+ const user = userEvent.setup();
+ render(<CloudGithubSetupDialog onConnected={vi.fn()} onClose={vi.fn()} />);
+
+ await waitFor(() =>
+ expect(
+ screen.getByRole("button", { name: "Connect GitHub" }),
+ ).toHaveFocus(),
+ );
+ expect(
+ screen.getByRole("img", { name: "Connect PostHog to GitHub" }),
+ ).toBeInTheDocument();
+ await user.tab();
+ expect(screen.getByRole("button", { name: "Not now" })).toHaveFocus();
+ expect(document.activeElement).toHaveAttribute(
+ "data-attr",
+ "github-setup-not-now",
+ );
+ await user.tab();
+ expect(screen.getByRole("button", { name: "Details" })).toHaveFocus();
+ expect(document.activeElement).toHaveAttribute(
+ "data-attr",
+ "github-permissions",
+ );
+ });
+
it("shows the onboarding visual while it waits for GitHub", () => {
connectState.isConnecting = true;
diff --git a/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.stories.tsx b/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.stories.tsx
index dd3e8246d843..121158a97c3c 100644
--- a/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.stories.tsx
+++ b/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.stories.tsx
@@ -1,4 +1,6 @@
+import { Button } from "@posthog/quill";
import type { Meta, StoryObj } from "@storybook/react-vite";
+import { useState } from "react";
import { CloudGithubSetupDialogContent } from "./CloudGithubSetupDialogContent";
const meta = {
@@ -24,3 +26,20 @@ export const GitHubRequired: Story = {};
export const WaitingForGitHub: Story = {
args: { loading: true },
};
+
+export const OpenFromButton: Story = {
+ render: function Render(args) {
+ const [open, setOpen] = useState(false);
+ return (
+ <>
+ <Button onClick={() => setOpen(true)}>Open GitHub setup</Button>
+ {open && (
+ <CloudGithubSetupDialogContent
+ {...args}
+ onClose={() => setOpen(false)}
+ />
+ )}
+ </>
+ );
+ },
+};
diff --git a/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.tsx b/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.tsx
index 015a37eae9aa..03037b6c1665 100644
--- a/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.tsx
+++ b/products/desktop/packages/ui/src/features/task-detail/components/CloudGithubSetupDialogContent.tsx
@@ -1,4 +1,3 @@
-import { GITHUB_CODE_CONTEXT_MESSAGE } from "@posthog/core/integrations/connectErrors";
import {
Button,
Dialog,
@@ -43,7 +42,7 @@ export function CloudGithubSetupDialogContent({
: loading
? "Finish authorizing in your browser, then return here."
: (connectionMessage ??
- `To run this task in the cloud, ${GITHUB_CODE_CONTEXT_MESSAGE}`);
+ "Agents work from the latest code in the repos you authorize. Changes come back as pull requests for you to review.");
return (
<Dialog
@@ -55,14 +54,27 @@ export function CloudGithubSetupDialogContent({
if (!nextOpen && !loading) onClose();
}}
>
- <DialogContent className="max-w-sm" showCloseButton={false}>
+ <DialogContent className="max-w-sm gap-6 p-4" showCloseButton={false}>
{/* The dialog role speaks the title and description once, on open, so
the later waiting, error and connected states need a live region. */}
- <DialogHeader className="items-center text-center" aria-live="polite">
- <GithubConnectionIcon connected={connected} loading={loading} />
+ <DialogHeader
+ className="items-center gap-2 p-0 text-center"
+ aria-live="polite"
+ >
+ <div className="mb-2">
+ <GithubConnectionIcon
+ connected={connected}
+ loading={loading}
+ paired
+ />
+ </div>
<DialogTitle>{title}</DialogTitle>
<DialogDescription
- className={hasError || isTimedOut ? "text-destructive" : undefined}
+ className={
+ hasError || isTimedOut
+ ? "text-balance text-destructive"
+ : "text-balance"
+ }
>
{description}
</DialogDescription>
@@ -73,6 +85,7 @@ export function CloudGithubSetupDialogContent({
<Button
type="button"
variant="primary"
+ className="w-full"
loading={loading}
disabled={!canConnect || loading}
onClick={onConnect}
@@ -81,20 +94,27 @@ export function CloudGithubSetupDialogContent({
</Button>
<Button
type="button"
- variant="link-muted"
- data-attr="github-permissions"
- onClick={onOpenPermissions}
- >
- What permissions does this grant?
- </Button>
- <Button
- type="button"
- variant="link-muted"
+ variant="default"
+ className="w-full text-muted-foreground"
data-attr="github-setup-not-now"
onClick={onClose}
>
Not now
</Button>
+ <p className="mt-2 text-balance text-center text-muted-foreground text-xs">
+ Read/write access to authorized repos, plus read access to email
+ addresses and organization membership. PostHog can act as you on
+ GitHub.{" "}
+ <Button
+ type="button"
+ variant="link-muted"
+ className="inline h-auto p-0 text-xs underline"
+ data-attr="github-permissions"
+ onClick={onOpenPermissions}
+ >
+ Details
+ </Button>
+ </p>
</>
) : (
<Button type="button" variant="primary" onClick={onClose}>