feat: handle pull_request_review webhook event for changes_requested on bot PRs (CYPACK-842)#896
feat: handle pull_request_review webhook event for changes_requested on bot PRs (CYPACK-842)#896PaytonWebber merged 5 commits intomainfrom
Conversation
…on bot PRs (CYPACK-842) Add support for the pull_request_review GitHub webhook event type so that when a reviewer requests changes on a PR created by cyrusagent, the client posts an instant acknowledgement comment and starts working on the changes. - Add GitHubReview and GitHubPullRequestReviewPayload types - Extend GitHubEventType union to include pull_request_review - Add isPullRequestReviewPayload type guard; disambiguate from review comments - Update all extractor functions to handle review payloads - Add translatePullRequestReview methods to GitHubMessageTranslator - Handle pull_request_review in EdgeWorker with acknowledgement comment, change request system prompt, and empty review body fallback - Update core platform data types to include pull_request_review eventType - Add comprehensive tests for all new functionality Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CYHOST forwards Slack webhooks with Bearer token auth — it verifies the original Slack signature itself and does not forward the X-Slack-Signature/X-Slack-Request-Timestamp headers to the droplet. Only use direct Slack signature verification when both SLACK_SIGNING_SECRET is set AND CYRUS_HOST_EXTERNAL=true (self-hosted). Cloud droplets now correctly fall back to proxy mode (Bearer token). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a pull_request_review has an empty body (reviewer only left line-level comments), the taskInstructions was an empty string. This caused Claude's API to reject the request with "cache_control cannot be set for empty text blocks". Provide a meaningful fallback prompt instructing the agent to read the review comments to understand what needs to be changed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-842) Add process.env.SLACK_BOT_TOKEN fallback in SlackChatAdapter so the token is resolved at usage time rather than only at event-creation time. During startup transitions (e.g. switching from cloud to self-host), the env update carrying the token may arrive after the first webhook, causing the event object to have an undefined slackBotToken. The fallback ensures the token is picked up once it becomes available in process.env. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@cyrusagent does this require the GH token ENV var to be on path at runtime? |
|
This repository is not configured with Cyrus. Please add it at https://app.atcyrus.com/repos to start using Cyrus here. |
|
I can't connect to your local environment because the Cyrus process isn't running. Run |
|
No, this PR does not require a new GH token env var. The existing pattern is already in place:
The new TL;DR: If your deployment already handles GitHub webhooks (with the proxy forwarding installation tokens), this PR works out of the box. The |
…ts (CYPACK-842) The mention gate ran before the review-type check, silently dropping all pull_request_review webhooks when GITHUB_BOT_USERNAME was set. Reorder guards so the changes_requested state check and mention-skip happen in the correct sequence. Also add an explicit prNumber null guard, extract duplicated review-to-comment mapping into buildReviewAsCommentRef, and use nullish coalescing in getSlackBotToken. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
process.envfallback.gh api.Commits
feat: handle pull_request_review webhook event for changes_requested on bot PRs— Newpull_request_reviewevent type incyrus-github-event-transport, EdgeWorker handler with acknowledgement comment, change-request system prompt, and defensivechanges_requestedstate check.fix: use proxy mode for Slack webhooks on cloud droplets— Aligns Slack webhook verification mode with GitHub webhooks on cloud droplets.fix: provide fallback prompt when review body is empty— When a review body is empty, instructs the agent to usegh apito read PR review comments.fix: resolve Slack bot token unavailable after runtime switch— AddedgetSlackBotToken()helper toSlackChatAdapterwithprocess.env.SLACK_BOT_TOKENfallback.Test plan
pnpm test:packages:run)pull_request_reviewwebhook handlingCloses CYPACK-842