: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(desktop): restore multi-repo selection on space new task (#86219)
Alessandro Pogliaghi8ff965205a0e
diff --git a/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.test.tsx b/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.test.tsxindex 47ed684b6db2..c85a547071c1 100644--- a/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.test.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.test.tsx@@ -47,6 +47,8 @@ vi.mock("@posthog/ui/features/canvas/hooks/useTaskChannels", () => ({name: "project-bluebird",channel_type: "public",starred: false,+ repositories: ["PostHog/posthog"],+ github_integration: 7,},],}),@@ -126,11 +128,17 @@ describe("WebsiteNewTask context panel", () => {);});- it("uses the standard repository and branch selectors", () => {+ it("passes the space's repository defaults so cloud tasks can span repos", () => {useFolderInstructions.mockReturnValue({ data: undefined });renderNewTask();- expect(taskInputProps.mock.lastCall?.[0]).not.toHaveProperty("allowNoRepo");+ expect(taskInputProps).toHaveBeenLastCalledWith(+ expect.objectContaining({+ allowNoRepo: true,+ channelRepositories: ["PostHog/posthog"],+ channelGithubIntegration: 7,+ }),+ );});it("opens the context panel and tracks view_context when the chip is clicked", async () => {diff --git a/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.tsx b/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.tsxindex 6c5971aedc90..29e5ed2967df 100644--- a/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/WebsiteNewTask.tsx@@ -146,6 +146,9 @@ export function WebsiteNewTask({ channelId }: { channelId: string }) {channelName={channelName}channelId={channelId}channelContextId={channelId}+ allowNoRepo+ channelRepositories={channel?.repositories}+ channelGithubIntegration={channel?.github_integration}// So a prompt handed to openTaskInput survives routing into a channel.initialPrompt={view.initialPrompt}initialPromptKey={view.taskInputRequestId}diff --git a/products/desktop/packages/ui/src/features/task-detail/components/TaskInput.tsx b/products/desktop/packages/ui/src/features/task-detail/components/TaskInput.tsxindex 527320bf661d..a111d258645f 100644--- a/products/desktop/packages/ui/src/features/task-detail/components/TaskInput.tsx+++ b/products/desktop/packages/ui/src/features/task-detail/components/TaskInput.tsx@@ -142,9 +142,10 @@ interface TaskInputProps {*/channelContextId?: string;/**- * Channels "generic chat box" mode: hide the repo/branch pickers and let the- * task be submitted without a repo. The agent decides at runtime whether it- * needs a repo and attaches one lazily.+ * Channels "generic chat box" mode: in cloud mode, swap the repo/branch+ * pickers for the multi-repository chip and let the task be submitted without+ * a repo. The agent decides at runtime whether it needs a repo and attaches+ * one lazily. Local mode keeps the repo + branch pickers a worktree needs.*/allowNoRepo?: boolean;channelRepositories?: string[];@@ -795,6 +796,8 @@ export function TaskInput({const effectiveWorkspaceMode = workspaceMode;+ const repoOptional = !!allowNoRepo && workspaceMode === "cloud";+// Get current values from preview config options for task creation.// Defaults ensure values are always passed even before the preview config loads.const currentModel =@@ -862,11 +865,11 @@ export function TaskInput({useWarmTask({workspaceMode,selectedRepository: selectedCloudRepository,- repositories: allowNoRepo ? taskRepositories : undefined,- githubIntegrationId: allowNoRepo+ repositories: repoOptional ? taskRepositories : undefined,+ githubIntegrationId: repoOptional? (taskGithubIntegration ?? undefined): orgGithubIntegrationId,- allowNoRepo,+ allowNoRepo: repoOptional,branch: workspaceMode === "cloud" ? selectedBranch : null,editorIsEmpty,runtimeAdapter: adapter ?? null,@@ -984,14 +987,12 @@ export function TaskInput({} = useTaskCreation({editorRef,sessionId,- selectedDirectory: allowNoRepo ? taskFolder : selectedDirectory,+ selectedDirectory: repoOptional ? taskFolder : selectedDirectory,selectedRepository: selectedCloudRepository,- repositories:- allowNoRepo && workspaceMode === "cloud" ? taskRepositories : undefined,- githubIntegrationId:- allowNoRepo && workspaceMode === "cloud"- ? (taskGithubIntegration ?? undefined)- : undefined,+ repositories: repoOptional ? taskRepositories : undefined,+ githubIntegrationId: repoOptional+ ? (taskGithubIntegration ?? undefined)+ : undefined,githubUserIntegrationId: selectedGithubUserIntegrationId,workspaceMode: effectiveWorkspaceMode,branch: branchForTaskCreation,@@ -1019,7 +1020,7 @@ export function TaskInput({channelName,channelId,channelContextId,- allowNoRepo,+ allowNoRepo: repoOptional,});// Wraps the prompt in the autoresearch kickoff: protocol preamble first,@@ -1293,7 +1294,7 @@ export function TaskInput({onCustomImageChange={setSelectedCustomImageId}size="1"/>- {allowNoRepo && (+ {repoOptional && (<TaskRepositoryChipcloud={workspaceMode === "cloud"}repositoryCount={taskRepositories.length}@@ -1302,7 +1303,7 @@ export function TaskInput({onOpen={() => setRepositoryDialogOpen(true)}/>)}- {!allowNoRepo && workspaceMode === "worktree" && (+ {!repoOptional && workspaceMode === "worktree" && (<EnvironmentSelectorrepoPath={effectiveRepoPath ?? null}value={selectedEnvironment}@@ -1315,7 +1316,7 @@ export function TaskInput({}/>)}- {!allowNoRepo && (+ {!repoOptional && (<ButtonGroupref={buttonGroupRef}data-tour="folder-picker"@@ -1405,7 +1406,7 @@ export function TaskInput({/></ButtonGroup>)}- {!allowNoRepo && workspaceMode !== "cloud" && (+ {!repoOptional && workspaceMode !== "cloud" && (<AdditionalDirectoriesButtonvalues={additionalDirectories}onChange={setAdditionalDirectories}@@ -1656,7 +1657,7 @@ export function TaskInput({</Box></Flex>- {allowNoRepo && (+ {repoOptional && (<TaskRepositoryDialogopen={repositoryDialogOpen}onOpenChange={setRepositoryDialogOpen}