Skip to content

self-driving: choose a base branch per environment, not just per repo #105055

Description

@christiaan-ph

Is your feature request related to a problem?

Self-driving pull requests often target the wrong branch for a team that runs one PostHog project across a whole DTAP setup (development, test, acceptance, production) and separates the environments by host or another event property. Only one base branch can be set, per repository, so every report on that repository opens its pull request against that same branch, whichever environment the signal came from.

Describe the solution you'd like

A way to choose the base branch from the team's own rules, the way repo routing rules already choose the repository. For example, a signal whose host is the acceptance environment would open its pull request against the acceptance branch.

Describe alternatives you've considered

  • Repo routing rules. They steer which repository a report goes to, but carry no branch: a rule is rule_text, repository and priority only.
  • One PostHog project per environment. SignalTeamConfig is one-to-one with a team, so base branches are already per project. This would work, but it splits a setup that is deliberately kept unified.
  • Re-targeting each pull request by hand after it opens.

Additional context

Confirmed on master. SignalTeamConfig.autostart_base_branches is a flat map of lowercased owner/repo to a single branch name, and base_branch_for() takes a repository string and nothing else, so auto-start resolves the branch with no report or signal property in play. The inbox "Create PR" button reads the same map, so both paths behave the same way.

The documentation describes the setting the same way: the PostHog Desktop settings docs say "Choose a base branch for automatically opened pull requests in each repository", shared by the web app and the Agents tab.

No event currently records the resolved base branch or repository of an auto-start run, so how often this misfires is not measurable today.

Related work

Debug info

  • PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]
  • PostHog Hobby self-hosted with docker compose, version/commit: [please provide]
  • PostHog self-hosted with Kubernetes (deprecated, see Sunsetting Kubernetes support), version/commit: [please provide]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions