@sentry/junior-github 0.315.0 → 0.316.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -682,11 +682,22 @@ function gitHubPullRequestSubscription(config) {
682
682
  * Watch of a draft also gets them. Marking the pull request ready sends the
683
683
  * review request. GitHub also asks the code owners then, so a draft with code
684
684
  * owners waits for the person who asked for it, unless they said otherwise.
685
- * A repository's AGENTS.md can also ask that drafts wait for a person.
685
+ * A repository's AGENTS.md can also ask that drafts wait for a person. A
686
+ * draft that waits asks only that person to review it on GitHub, and the
687
+ * Inbox item follows from that request, so the thread gets no message.
686
688
  * Each passing suite wakes the Watch, so a suite that leaves the required
687
689
  * checks unfinished must stay silent, or every suite posts.
688
690
  */
689
- const DRAFT_CHECKS_RECOVERED_GUIDANCE = "If the pull request is still a draft, call github_getPullRequest and read its `checks`, `code_owners`, and `agents_md`. When `checks.required` is `passing` and no decision is open, in the pull request body or in an open inbox item that waits on the person who asked for it: mark it ready with github_updatePullRequest and draft false, when the person who asked for it said to mark it ready, or when `code_owners` is empty and `agents_md` does not ask for draft pull requests or say that a person marks them ready. Otherwise keep it a draft: marking it ready would ask the code owners to review, or break the AGENTS.md rule. Tell the person who asked for it in the originating thread that the checks pass and the draft waits for their review, and name why: the code owners that marking it ready asks, or the AGENTS.md rule. If you already told them for this head commit, stay silent. When it is `failing`, fix the failing checks like a failed check. When it is `pending` or `not_reported`, stay silent: a later passing suite wakes you again. `not_reported` means the required checks may not have started on the latest commit yet, not that none are required.";
691
+ const DRAFT_CHECKS_RECOVERED_GUIDANCE = "If the pull request is still a draft, call github_getPullRequest and read its `checks`, `code_owners`, and `agents_md`. When `checks.required` is `passing` and no decision is open, in the pull request body or in an open inbox item that waits on the person who asked for it: mark it ready with github_updatePullRequest and draft false, when the person who asked for it said to mark it ready, or when `code_owners` is empty and `agents_md` does not ask for draft pull requests or say that a person marks them ready. Otherwise keep it a draft, because marking it ready would ask the code owners to review or break the AGENTS.md rule, and call github_updatePullRequest with request_review true, so GitHub asks the person who asked for it to review it. Their Inbox then asks them to review it and mark it ready, so stay silent in the thread. When it is `failing`, fix the failing checks like a failed check. When it is `pending` or `not_reported`, stay silent: a later passing suite wakes you again. `not_reported` means the required checks may not have started on the latest commit yet, not that none are required.";
692
+ /**
693
+ * The requester's approval is the review that a held draft waits for. Marking
694
+ * it ready then asks the code owners after the requester has looked. A draft
695
+ * that the requester asked to keep, or that AGENTS.md leaves for a person to
696
+ * mark ready, stays a draft, and its Inbox item asks the requester to mark it
697
+ * ready (`webhooks/pull-request-action.ts`). Whether Junior held the draft, or the requester
698
+ * asked to keep it, is in the Conversation, so the agent decides.
699
+ */
700
+ const DRAFT_APPROVED_GUIDANCE = "If the pull request is still a draft and `sender_login` in Verified details is `opener_username`, the person who asked for it approved it. Call github_getPullRequest and read its `agents_md`. Mark it ready with github_updatePullRequest and draft false, so GitHub asks its code owners now that this person has looked. Keep it a draft when this person asked to keep it a draft, or when `agents_md` says that a person marks drafts ready: their Inbox then asks them to mark it ready. Stay silent in the thread.";
690
701
  /**
691
702
  * State changes that need no action but that a later Turn must know, so that
692
703
  * it does not call an approved pull request unreviewed, or a merged or
@@ -704,16 +715,19 @@ const QUIET_PULL_REQUEST_EVENTS = [
704
715
  * passing check suite.
705
716
  */
706
717
  function gitHubPullRequestCreateWatch(config, pullRequest) {
707
- const quietEvents = [...QUIET_PULL_REQUEST_EVENTS, ...pullRequest.draft ? ["pull_request.ready_for_review"] : []].filter((eventType) => !config.events.includes(eventType));
718
+ const quietEvents = [...QUIET_PULL_REQUEST_EVENTS.filter((eventType) => !pullRequest.draft || eventType !== "pull_request.review.approved"), ...pullRequest.draft ? ["pull_request.ready_for_review"] : []].filter((eventType) => !config.events.includes(eventType));
708
719
  return {
709
720
  events: [.../* @__PURE__ */ new Set([
710
721
  ...config.events,
711
722
  "pull_request.merge_conflict",
712
- ...pullRequest.draft ? ["pull_request.checks.recovered"] : [],
723
+ ...pullRequest.draft ? ["pull_request.checks.recovered", "pull_request.review.approved"] : [],
713
724
  ...quietEvents
714
725
  ])],
715
726
  ...quietEvents.length > 0 ? { quietEvents } : void 0,
716
- ...pullRequest.draft ? { guidance: { "pull_request.checks.recovered": DRAFT_CHECKS_RECOVERED_GUIDANCE } } : void 0,
727
+ ...pullRequest.draft ? { guidance: {
728
+ "pull_request.checks.recovered": DRAFT_CHECKS_RECOVERED_GUIDANCE,
729
+ "pull_request.review.approved": DRAFT_APPROVED_GUIDANCE
730
+ } } : void 0,
717
731
  intent: config.intent
718
732
  };
719
733
  }