fix: add deeplinking to posthog code git setup#1733
Merged
Conversation
…king_to_posthog_code_git_setup # Conflicts: # apps/code/src/main/services/github-integration/service.ts # packages/agent/src/adapters/codex/codex-agent.test.ts
jonathanlab
approved these changes
Apr 20, 2026
| this.deepLinkService.registerHandler("integration", (_path, params) => | ||
| this.handleCallback(params), | ||
| ); | ||
| log.info("Registered integration deep link handler"); |
Contributor
There was a problem hiding this comment.
nit: trying to keep log noise down, in general let's only log the failure cases
Contributor
Author
There was a problem hiding this comment.
Good call — removed the noisy success logs throughout this file and kept only failure/warn logs.
Comment on lines
79
to
83
| } catch (error) { | ||
| this.clearFlowTimeout(); | ||
| return { | ||
| success: false, | ||
| error: error instanceof Error ? error.message : "Unknown error", |
Contributor
There was a problem hiding this comment.
nit: could use another log here just to know what went wrong in prod?
Contributor
Author
There was a problem hiding this comment.
Added a log.error in the catch block including the projectId and error message.
Only log failure cases and add error log in catch block of startFlow for prod debuggability. Generated-By: PostHog Code Task-Id: 18a9315c-bc74-4528-8ab8-73e4fedcdeca
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TLDR
The GitHub integration flow previously relied entirely on polling to detect when a user completed the GitHub App install in their browser. This meant the app had no reliable way to know when the flow succeeded or failed, and the UI couldn't react immediately or surface meaningful error states.
Changes
GitHubIntegrationServicethat listens forintegrationcallbacks from PostHog Cloud after the GitHub App install completes. The service emits typed events (Callback,FlowTimedOut) and queues callbacks that arrive before the renderer has subscribed.FlowTimedOutif no deep link callback is received.onCallbackandonFlowTimedOutsubscriptions, and aconsumePendingCallbackquery to drain any callback that arrived before the renderer mounted.useGitHubIntegrationCallbackhook that subscribes to both events and drains any pending callback on mount, callingonSuccess,onError, oronTimedOutaccordingly.GitIntegrationStepnow shows a timeout banner with a retry prompt, displays the connected GitHub account name when available, and surfaces a callout when GitHub is already connected on a different project.GitHubIntegrationSectionin settings follows the same pattern, replacing polling-based detection with the new callback hook.nextredirect URL after GitHub authorization now points to/account/social-connectedwith query params instead of the project root, enabling the deep link callback to carry status, installation ID, and error details back to the app.