: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(github): treat missing GitHub integration ID as non-retryable (#63992)
Tom Owers200720b96879
diff --git a/posthog/temporal/data_imports/sources/github/source.py b/posthog/temporal/data_imports/sources/github/source.pyindex 356f560c2996..fe7cf9beedc6 100644--- a/posthog/temporal/data_imports/sources/github/source.py+++ b/posthog/temporal/data_imports/sources/github/source.py@@ -108,6 +108,9 @@ class GithubSource(ResumableSource[GithubSourceConfig, GithubResumeConfig], OAut"403 Client Error": "Access forbidden. Your token may lack required permissions or have hit rate limits.","404 Client Error": "Repository not found. Please verify the repository name and access permissions.","Bad credentials": "Your GitHub connection is invalid or expired. Please reconnect.",+ # The OAuth source has no GitHub account selected, so there's no integration to mint a+ # token from. A config problem — retrying never resolves it; the user must reconnect.+ "Missing GitHub integration ID": "No GitHub account is connected to this source. Please reconnect your GitHub account.",# The GitHub App isn't configured on this PostHog instance, so an OAuth source can't mint# the App JWT to refresh its installation token. Deterministic — retrying never resolves it."GITHUB_APP_CLIENT_ID is not configured": "The GitHub App is not configured on this PostHog instance. Please contact support.",diff --git a/posthog/temporal/tests/data_imports/github/test_github_source.py b/posthog/temporal/tests/data_imports/github/test_github_source.pyindex 223169ed38c8..d6cc1a05abf8 100644--- a/posthog/temporal/tests/data_imports/github/test_github_source.py+++ b/posthog/temporal/tests/data_imports/github/test_github_source.py@@ -7,6 +7,7 @@ from unittest import mockimport requestsfrom parameterized import parameterized+from posthog.temporal.data_imports.sources.generated_configs import GithubAuthMethodConfig, GithubSourceConfigfrom posthog.temporal.data_imports.sources.github.github import (GithubResumeConfig,_build_initial_params,@@ -887,6 +888,7 @@ class TestGithubSourceNonRetryableErrors:("403",),("404",),("bad_credentials",),+ ("missing_integration_id",),("client_id_not_configured",),("private_key_not_configured",),]@@ -897,11 +899,25 @@ class TestGithubSourceNonRetryableErrors:"403": "403 Client Error","404": "404 Client Error","bad_credentials": "Bad credentials",+ "missing_integration_id": "Missing GitHub integration ID","client_id_not_configured": "GITHUB_APP_CLIENT_ID is not configured","private_key_not_configured": "GITHUB_APP_PRIVATE_KEY is not configured",}assert expected_keys[_name] in self.source.get_non_retryable_errors()+ def test_oauth_without_integration_id_raises_non_retryable_error(self) -> None:+ config = GithubSourceConfig(+ auth_method=GithubAuthMethodConfig(selection="oauth", github_integration_id=None),+ repository="owner/repo",+ )++ with pytest.raises(ValueError) as exc_info:+ self.source._get_access_token(config, team_id=123)++ # The raised message must stay a recognised non-retryable substring so a misconfigured+ # OAuth source stops retrying instead of failing forever.+ assert any(key in str(exc_info.value) for key in self.source.get_non_retryable_errors())+@parameterized.expand([("[ErrorDetail(string='GITHUB_APP_CLIENT_ID is not configured', code='invalid')]",),