feat(babysitter): wake on real PR review feedback, not only verdicts

Merged
KH
2mo ago
+1718-39

F1 in the Babysitter owner plan. The plan's goal: a flow that wakes on PR feedback, loads the original session, and fixes the feedback in a sandbox.

What changes

Until now the standalone Babysitter acted only on failing checks, CHANGES_REQUESTED reviews, and @babysitter directives. A reviewer's inline comments, or a review bot's findings, could never make a PR actionable.

  • signals.ts now also reads /pulls/:n/comments, and returns reviewFeedback:
    • inline comments that are not outdated (line != null), newer than Babysitter's last comment, with no later reply in their thread from botLogin or an ownAgents account;
    • non-empty COMMENTED review bodies, newer than Babysitter's last comment.
  • Who counts: the PR author, OWNER/MEMBER/COLLABORATOR, or a policy reviewBots login. Never botLogin or ownAgents.
    • AgentRelayBot (MEMBER) posts "Fixed in …" thread replies on our PRs. Without ownAgents those replies would count as human feedback and loop.
  • Journal budget: shortened like the other text, then dropped oldest-first after comments. Still ≤ 50KB.
  • The agent task lists each item: Review comment by X on path:line: … or Review by X: ….
  • Wake contract unchanged. GitHub sends pull_request_review.submitted for every review, including a single inline comment. Cloud's trigger profile (checks,comments,events,repository,reviews) still matches.

⚠️ Reviewer attention

  • The policy pin changed on purpose. tests/standalone-artifact.test.ts asserts the exact standalone-policy.json. I updated that assertion to the new reviewBots/ownAgents lists, because changing the policy is what this PR does. Please confirm both lists. Is kjgbot ours?
  • The artifact digest moves: eed5e5de… → af8d51743982e018b1a0c0aceb66e5a4f038bf2a55ff7a75d543de8276e2322a (37,044 bytes).
    • Cloud #4226 pins the old digest, so it will refuse this artifact until the Cloud pin moves (plan step C1).
    • Nothing is deployed today, so merging enables nothing.

Not in this PR

  • Fix/push mode (F2), the Cloud pin move (C1), and per-PR sandbox reuse (C2/F3).
  • Resolved-thread detection: REST does not expose it, so only "answered by us" and outdated threads are dropped.

Evidence (examples/babysitter/evidence/f1-feedback-filter/, unedited output)

  • 01-signals-red.txt: the 4 new reader tests fail before the implementation.
  • 02-standalone-red.txt: the flow tests fail before the implementation.
  • 03-own-agents-red.txt: the ownAgents tests fail before the implementation.
  • 04-all-babysitter-green.txt: tests 107, pass 100, fail 0, todo 7, exit 0. The 7 todos are the existing deliberate gates.
  • 05-artifact-check.txt: build-standalone.mjs --check reproduces af8d5174….
  • 06-typecheck.txt: in my local environment, main@fe60dd4c has 73 tsc errors, all environmental (missing @relayfile/relay-helpers/ai-hist and a dual-package Ctx). This branch has 75: the same classes, plus 2 from the two new body(f) test calls. 0 errors outside those classes. CI is the authority here.
  • 07-flows-check.txt: flows check on the artifact passes.
  • 08-sdk-shipped-source.txt: the shipped-source model pins pass, 2/2.
  • 09-mutation.txt: reverting ownAgents thread-answering makes our own agent accounts are never feedback… fail. The file was restored byte-for-byte (cmp identical) and the tests are green again.
    • Caveat: the git diff --stat line in that file is against HEAD (uncommitted work at that point), not the mutation alone.

🤖 Generated with Claude Code


[!NOTE]
Medium Risk
Changes when Babysitter runs on live PRs (new wake reasons, policy allowlists, and Garden auto-scope); misconfigured reviewBots/ownAgents could miss feedback or cause unwanted wakes, but behavior is bounded to diagnose-only with existing head-binding guards.

Overview
Standalone Babysitter now treats unanswered PR review feedback as actionable, alongside failing checks, change requests, and @babysitter directives.

Signal read (signals.ts) paginates /pulls/:n/comments and returns reviewFeedback: non-outdated inline threads and non-empty COMMENTED review bodies newer than Babysitter’s last marked comment, filtered to the PR author, collaborators, or policy reviewBots, and excluding botLogin and ownAgents (so our “Fixed in …” replies don’t re-wake the flow). Thread replies from Babysitter or ownAgents mark threads answered. Payload stays within the 50KB journal budget (truncate, then drop oldest feedback). The diagnose agent task lists each item with path/line when inline.

Policy & scope: standalone-policy.json pins reviewBots and ownAgents. Same-repo relayflow/* Software Garden PRs are in scope by default (drafts included); other PRs still need the babysit label. When Garden shares the app login, only comments with a <!-- babysitter: marker count as Babysitter’s own for the comment window and thread answers.

The committed standalone artifact and manifest digest update accordingly; Cloud must move its pinned digest before deploy.

Reviewed by Cursor Bugbot for commit c176f9c99696c1503b8d0d03be8d78aed237aeca. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

The Babysitter now wakes on real PR review feedback — inline review comments and non-empty COMMENTED review bodies — not just failing checks, CHANGES_REQUESTED reviews, and @babysitter directives.

  • Reads /pulls/:n/comments and lists each item in the agent task as Review comment by X on path:line: … or Review by X: ….
  • Feedback counts only from the PR author, OWNER/MEMBER/COLLABORATOR, or a policy reviewBots login; never from botLogin or ownAgents, so our "Fixed in …" thread replies can't loop the flow.
  • File-level comments count and render without a line; outdated line comments are dropped; pending-review comments date from the review's submitted_at; the since-last-report cutoff is inclusive because timestamps are per-second.
  • An @babysitter directive from an ownAgents account is not a directive.
  • Software Garden PRs (same-repo relayflow/* head branches) are babysat by default, including drafts — Garden opens draft PRs with failing checks, and getting them out of draft with feedback fixed is the job. Any other PR still opts in with the babysit label, and label opt-in drafts still decline.
  • A botLogin comment counts as Babysitter's own only when it carries a <!-- babysitter: marker, so Garden's adversarial-review comment no longer moves the "since last comment" window or marks threads answered.
  • standalone-policy.json now pins reviewBots and ownAgents (AgentRelayBot; kjgbot was dropped as it may be a shared human account). The artifact digest moves to 70e27d2c…, so Cloud must move its pinned digest before deploying this artifact.

Agent Relay sessions

  • claude session 497569fc · opened via gh pr create · last active 2026-10-09