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(tasks): allow public repository reads without GitHub authentication (#119517)

Alessandro Pogliaghi39599928fc94
diff --git a/docs/internal/task-run-api.md b/docs/internal/task-run-api.md
index f2fda75eb67f..89fe595f326c 100644
--- a/docs/internal/task-run-api.md
+++ b/docs/internal/task-run-api.md
@@ -57,6 +57,8 @@ GitHub credentials that require user action fail the run without retrying. Fresh
Sandbox GitHub tokens are scoped to the repositories requested by the run. When GitHub rejects a repository scope, the run refreshes installation access and resolves renamed repositories by their GitHub ID. Public repositories outside the installation can be cloned anonymously; private or missing repositories require the user to check repository access. Public-only access results are cached for five minutes before checking again. GitHub outages and connection failures remain retryable, including failures during token refresh.
+Without an authenticated GitHub token, the agent can still read public repositories and repository files already in its workspace. It asks the user to connect GitHub when the work requires unavailable private repository or publishing access.
+
## Model selection
Task runs accept `gpt-6.1-sol` with the `codex` runtime adapter and `low`, `medium`, `high`, `xhigh`, or `max` reasoning effort.
diff --git a/packages/agent/packages/agent/src/server/agent-server.test.ts b/packages/agent/packages/agent/src/server/agent-server.test.ts
index b949e160d0cd..305abbde3519 100644
--- a/packages/agent/packages/agent/src/server/agent-server.test.ts
+++ b/packages/agent/packages/agent/src/server/agent-server.test.ts
@@ -7160,7 +7160,9 @@ describe("AgentServer HTTP Mode", () => {
"`posthog:metric-list`",
"`posthog:metric-describe`",
"`posthog:data-catalog-metric-run`",
- "You do not have GitHub access in this session.",
+ "This session has no authenticated GitHub access.",
+ "Read public or already cloned repository content without asking the user to connect GitHub.",
+ "Only when the requested work requires unavailable private repository or publishing access:",
"Codebase analysis and code review require readable repository content.",
"do not replace the requested code work with generic guidance or PostHog data analysis",
"The connection applies to a new task, not this task.",
diff --git a/packages/agent/packages/harness/src/extensions/task-system-prompt/cloud.ts b/packages/agent/packages/harness/src/extensions/task-system-prompt/cloud.ts
index b690f18830d4..cbdfbd3b5b7a 100644
--- a/packages/agent/packages/harness/src/extensions/task-system-prompt/cloud.ts
+++ b/packages/agent/packages/harness/src/extensions/task-system-prompt/cloud.ts
@@ -128,11 +128,14 @@ You have GitHub access in this session.`;
const settingsUrl = `${this.options.apiUrl.replace(/\/$/, "")}/project/${this.options.projectId}/settings/user-personal-integrations`;
return `
## GitHub access
-You do not have GitHub access in this session.
+This session has no authenticated GitHub access.
- You can read repository content that is already in the workspace.
- You can clone an exact public repository. Do not call \`list_repos\` without GitHub access.
+- Read public or already cloned repository content without asking the user to connect GitHub.
- Codebase analysis and code review require readable repository content.
-- Code changes also require publishing access.
+- Publishing changes requires authenticated GitHub access.
+
+Only when the requested work requires unavailable private repository or publishing access:
- If the required access is unavailable, do not replace the requested code work with generic guidance or PostHog data analysis.
- Tell the user to connect GitHub at ${settingsUrl}.
- The connection applies to a new task, not this task.