Skip to content

Workload completion should open a pull request — a GO'd, reviewed branch currently just sits on the remote #937

Description

@joryirving

Problem

The pipeline ends one hop short of its artifact. On a fully successful Workload (coder GO → gate GATE-PASS → reviewer GO → phase Completed), the result is a pushed foreman/<workload>/issue-<n> branch — and nothing else. No PR is opened, nothing links the branch to the issue, and no human is notified. Grepping the agent, operator, and docs: there is no PR-creation code anywhere.

Observed in production: first fully-green Workload completed (code GO → verify GATE-PASS → review GO), operator watched the dashboard expecting a PR, and the reviewed branch sat unopened on the remote until a human found it.

Proposed fix

On Workload completion (all tasks terminal, review verdict GO), open a PR:

  • Where: the agent already holds the GitHub token it pushed with — one POST /repos/{repo}/pulls after the review task GOes (or an operator-side finalizer step, which centralizes it and survives agent restarts).
  • Content: head = the workload branch, base = repo default branch, title from the coder's commit subject, body Fixes #<issue> + a summary of gate/review verdicts (the review transcript ref is already in the task result).
  • Config: openPullRequest: true|false on the Workload spec (default true when issues is set), so callers that want branch-only behavior keep it.
  • Idempotency: skip if a PR with the same head already exists (re-runs after LLMKube#934 force-push should update, not duplicate).

A review verdict of request-changes should arguably still open a draft PR carrying the review feedback — that's where a human (or a follow-up fix task) picks it up.

Related: #934 (branch push idempotency across re-runs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions