Skip to content

Wire pr-feedback-loop production seams (evaluateCurrentHead + dispatch) at init #2745

Description

@zaxbysauce

Context

PR #2744 (issue #2502) ships the autonomous PR babysitting settling loop (src/background/pr-feedback-loop.ts). All three opt-in flags default off, and every external-effect seam has a fail-closed default:

  • _internals.evaluateCurrentHead returns null → every classified event is ambiguous and stays PENDING (no write-class action is ever authorized).
  • _internals.dispatchOversight / _internals.performAuthorizedAction default to fail-closed outcomes.

This was the invariant-4-compliant replacement for the original process.cwd() gh poll (removed in the Copilot review round). Two independent review ladders accepted it: the approved fix-plan's Wiring section (.agents/issue-traces/2502-pr-babysitting-loop/07-approved-plan.md §3) scopes only the pr-event-subscribers notify hook + monitor tick, and the acceptance checks validated the full pipeline via _internals seam injection.

Net effect: even with all three flags enabled, the loop is currently inert in production until a host wires the seams.

Requested change

At plugin init (or the first notify site, where ctx.directory is already available), inject production implementations:

  1. evaluateCurrentHead(directory, repoFullName, prNumber) — resolve fresh head via the authenticated poll snapshot (getPRPollSnapshot(prNumber, repoFullName, directory)), returning null on failure (existing ambiguous → PENDING semantics preserved).
  2. Confirm dispatchOversight / performAuthorizedAction defaults are the intended production paths, or wire host-aware equivalents.
  3. Add a test asserting the init-time wiring exists (so the seam can't silently regress to fail-closed-inert).

Acceptance

  • With pr_monitor.enabled + pr_monitor.auto_pr_feedback + pr_feedback_loop.enabled all set, a real monitor event can reach an authorized action and a visible terminal state (AC3's end-to-end shape, no seam injection).
  • Without the flags, behavior is unchanged (fail-closed, no action).

Related: #2502, #2501 (PR #2741/#2744 review round).

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions