Skip to content

feat(code): GitHub settings page + cloud-mode missing-integration warning#2027

Merged
VojtechBartos merged 2 commits intomainfrom
posthog-code/github-settings-no-team-fallback
May 5, 2026
Merged

feat(code): GitHub settings page + cloud-mode missing-integration warning#2027
VojtechBartos merged 2 commits intomainfrom
posthog-code/github-settings-no-team-fallback

Conversation

@VojtechBartos
Copy link
Copy Markdown
Member

@VojtechBartos VojtechBartos commented May 5, 2026

Problem

Two adjacent gaps in the personal-GitHub UX for cloud tasks:

  • If a user has no personal GitHub integration, the cloud repo picker silently renders empty — no signal that anything is wrong, no path to fix it.
  • There's no dedicated place to manage personal GitHub installations. Users can have multiple (different orgs/accounts), but settings doesn't surface them and offers no Disconnect.

Solution

  • Cloud-mode warning — when workspace mode is "cloud" and the user has no personal GitHub integration, render an amber callout under the prompt input with a one-click Connect GitHub button (uses the existing useGithubUserConnect hook).
  • GitHub settings page — new sidebar category that lists every linked personal GitHub installation, each with its own Disconnect confirmation. Single Connect / Connect-another-account button at the top.
  • Cloud tasks still use the user's personal integration only — no team-integration fallback, so cloud PRs are always authored as the user.

Combines the spirit of #1989 and #2009 with adjustments: drop the team fallback, keep the warning, extend the settings page to handle multiple installations.

Test plan

  • No personal GitHub: switch task input to Cloud → amber notice appears → Connect opens GitHub install URL.
  • One installation: Settings → GitHub shows one row → Disconnect → row disappears, cloud notice reappears in task input.
  • Multiple installations: Connect another account → two rows render → disconnect one leaves the other intact.
  • Saga unchanged: cloud task creation still sends `github_user_integration`; signal-report tasks still send `github_integration`.

Created with PostHog Code

@VojtechBartos VojtechBartos force-pushed the posthog-code/github-settings-no-team-fallback branch from 3296b3d to 0bfc805 Compare May 5, 2026 11:48
@VojtechBartos VojtechBartos self-assigned this May 5, 2026
@VojtechBartos VojtechBartos requested a review from a team May 5, 2026 11:51
@VojtechBartos VojtechBartos marked this pull request as ready for review May 5, 2026 11:51
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 5, 2026

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/code/src/renderer/features/task-detail/components/CloudGithubMissingNotice.tsx:13-16
`timed-out` state silently swallowed — no feedback to the user

When a GitHub connection attempt times out after 5 minutes (`POLL_TIMEOUT_MS = 300_000`), `state` becomes `"timed-out"`, but neither `isConnecting` (`state === "connecting"`) nor `hasError` (`state === "error"`) covers this case. The component falls back to the default "Connect your personal GitHub…" message and an enabled button with no indication that anything went wrong. The same issue exists in `GitHubSettings.tsx` where neither `isConnecting` nor `hasConnectError` handles `timed-out`. Consider treating `"timed-out"` similarly to an error, mapping it to a descriptive message like "Connection timed out — please try again."

### Issue 2 of 2
apps/code/src/renderer/features/settings/components/sections/GitHubSettings.tsx:49-55
The local `openInBrowser` function is identical to the private `openUrlInBrowser` already defined in `useGithubUserConnect.ts`. Having two copies of the same try/catch-then-`window.open` pattern violates OnceAndOnlyOnce. Consider exporting `openUrlInBrowser` from the hook file (or a shared `browser.ts` utility) and importing it here.

```suggestion
// Import openUrlInBrowser from a shared utility instead of duplicating here
export async function openInBrowser(url: string) {
  try {
    await trpcClient.os.openExternal.mutate({ url });
  } catch {
    window.open(url, "_blank", "noopener,noreferrer");
  }
}
```

Reviews (1): Last reviewed commit: "feat(code): GitHub settings page and clo..." | Re-trigger Greptile

Comment on lines +13 to +16

const isConnecting = state === "connecting";
const hasError = state === "error";
const canConnect = projectId != null && cloudRegion != null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 timed-out state silently swallowed — no feedback to the user

When a GitHub connection attempt times out after 5 minutes (POLL_TIMEOUT_MS = 300_000), state becomes "timed-out", but neither isConnecting (state === "connecting") nor hasError (state === "error") covers this case. The component falls back to the default "Connect your personal GitHub…" message and an enabled button with no indication that anything went wrong. The same issue exists in GitHubSettings.tsx where neither isConnecting nor hasConnectError handles timed-out. Consider treating "timed-out" similarly to an error, mapping it to a descriptive message like "Connection timed out — please try again."

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/task-detail/components/CloudGithubMissingNotice.tsx
Line: 13-16

Comment:
`timed-out` state silently swallowed — no feedback to the user

When a GitHub connection attempt times out after 5 minutes (`POLL_TIMEOUT_MS = 300_000`), `state` becomes `"timed-out"`, but neither `isConnecting` (`state === "connecting"`) nor `hasError` (`state === "error"`) covers this case. The component falls back to the default "Connect your personal GitHub…" message and an enabled button with no indication that anything went wrong. The same issue exists in `GitHubSettings.tsx` where neither `isConnecting` nor `hasConnectError` handles `timed-out`. Consider treating `"timed-out"` similarly to an error, mapping it to a descriptive message like "Connection timed out — please try again."

How can I resolve this? If you propose a fix, please make it concise.

Comment thread apps/code/src/renderer/features/settings/components/sections/GitHubSettings.tsx Outdated
…arning

Adds a new "GitHub" settings category that lists every personal GitHub
installation linked to the user's account, each individually disconnectable,
with a single Connect / Connect-another button.

Adds an amber callout below the task input in cloud mode when the user has
no personal GitHub integration, prompting them to connect. The cloud repo
picker stays user-only — no team-integration fallback — so PRs are always
authored as the user.

Generated-By: PostHog Code
Task-Id: 955e2a44-cbb3-4ab8-9ba4-21deae8ffe19
@VojtechBartos VojtechBartos force-pushed the posthog-code/github-settings-no-team-fallback branch from 0bfc805 to 2b4e596 Compare May 5, 2026 11:55
Copy link
Copy Markdown
Contributor

@joshsny joshsny left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread apps/code/src/renderer/features/settings/components/sections/GitHubSettings.tsx Outdated
<Flex direction="column" gap="3">
<Flex align="center" justify="between" gap="3" wrap="wrap">
<Text className="text-(--gray-11) text-[13px]">
Personal GitHub installations linked to your PostHog account. Cloud
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

general question (out of the scope of this PR) - how do we handle integration selection when multiple integrations have access to a repo?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If 2 integrations expose same repo we pick whichever resolve first. Kinda good enough, but we could in future extend the picker and allow users choose which integration they would like to use

<Text size="1">
{hasError
? describeGithubConnectError(error)
: "Connect your personal GitHub to create cloud tasks. Cloud PRs are authored as you."}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we can probably drop "cloud PRs are authored as you" - since this is the default experience users would expect

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated

Generated-By: PostHog Code
Task-Id: 955e2a44-cbb3-4ab8-9ba4-21deae8ffe19
@VojtechBartos VojtechBartos enabled auto-merge (squash) May 5, 2026 12:20
@VojtechBartos VojtechBartos merged commit de31b62 into main May 5, 2026
15 checks passed
@VojtechBartos VojtechBartos deleted the posthog-code/github-settings-no-team-fallback branch May 5, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants