Skip to content

feat(signals): hand research the team's open self-driving PRs instead of relying on gh pr list #90187

Open

Description

@andrewm4894

Problem

Research decides already_addressed by following a prompt instruction. products/signals/backend/report_generation/research.py ("Work already in flight", around line 442) tells the agent to run gh pr list --state open --search, look at recent branches and assigned issues, and carry what it finds into ActionabilityAssessment.already_addressed. The pipeline itself hands the agent nothing.

That check is only as good as the run. On one customer project a research run at 08:37 executed with two open self-driving PRs on the exact file it was about to name, returned already_addressed: false, auto-started, and opened a third PR. A research run on a sibling report thirteen hours later found all three. The pipeline knew about the first two the whole time: it created them (pr_created events with signal_report_id, task_run artefacts with pr_url, SignalReportTask rows with the branch).

Fixes

  1. Build the list from our own data. Before starting research, collect the team's self-driving PRs that are still open: implementation task_run artefacts and SignalReportTask rows for the team whose PR is not merged or closed (the pr_reviewed / pr_merged events, or the GitHub integration's PR state where available). Include repository, PR URL, branch, report title, and the finding's relevant_code_paths from the originating report.
  2. Inject it into the research prompt as a block the agent must read before its own in-flight check: "PostHog already opened these PRs for this repository; if the fix you are about to propose overlaps one of them, set already_addressed true and name it." Keep the agent's gh check for PRs opened by humans.
  3. Bound the block. Cap at the most recent 20 open self-driving PRs and truncate paths, so it fits the prompt budget.
  4. Record what was passed. Put the list (ids only) on the research task_run artefact or a log artefact so a wrong already_addressed: false can be audited against what the agent was shown.
  5. Test the prompt builder with zero, one, and many open PRs.

Why

We should never have to hope the agent finds a PR we opened ourselves. This is the mechanism half of the fix; the deterministic sibling check before auto-start is the companion issue.

From this Slack thread; the investigation is written up in the self-driving-debugging skill in the skills store.

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