feat: bring webhook mode closer to action mode
Webhook deliveries now run the same issue and PR triage as action mode on open/edit/reopen events, gated by WEBHOOK_TRIAGE_ENABLED; @bot answers embed the host-curated repository knowledge cache from R2 (never the uninitialized scaffold); exact /recheck and /conflict commands get a guidance reply pointing to action mode instead of silence. Cache restores write through a temporary file and rename so concurrent webhook work never reads a partial object. Documents that all webhook local writes stay inside the current working directory.
This commit is contained in:
1 parent
ec601bef93
commit
a6e3fd2fc5
10 files changed
+336
-13
No files matched your search
@@ -44,7 +44,7 @@ When Cloudflare R2 is configured, each successful review stores this metadata in
|
||||
|
||||
When a new commit triggers `synchronize`, or PR metadata/base changes trigger `edited`, the latest cache for that PR is restored. goose receives an earlier-head result plus the current complete PR patch, revalidates old findings, removes fixed findings, and checks the newest content. The previous merge decision is never reused without a fresh review. An `edited` event on the same head still runs a fresh complete review so title, description, and base-branch changes are respected.
|
||||
|
||||
For every `synchronize` event, ghbot posts a commit-scoped progress comment when review starts and updates that same comment when the run completes, fails, or becomes stale because the PR changed again. After the new review is published successfully, ghbot marks inline `review` and `change` threads from earlier bot reviews as resolved and minimizes those resolved comments, dismisses any earlier active bot decision, and reduces its old summary to a superseded marker. If GitHub cannot expose a legacy thread through GraphQL, ghbot deletes only that unmappable inline comment as a fallback. GitHub does not allow a submitted review record itself to be deleted, so the newest review is the only full and active automated result.
|
||||
For every `synchronize` event, ghbot posts a commit-scoped progress comment when review starts and updates that same comment when the run completes, fails, or becomes stale because the PR changed again. Every comment in which the bot starts or completes an operation ends with a collapsed `Runtime environment` block (trigger, runner, goose model, review policy, automation, cache) and a `Created By GHBot` signature linking back to this repository. After the new review is published successfully, ghbot marks inline `review` and `change` threads from earlier bot reviews as resolved and minimizes those resolved comments, dismisses any earlier active bot decision, and reduces its old summary to a superseded marker. If GitHub cannot expose a legacy thread through GraphQL, ghbot deletes only that unmappable inline comment as a fallback. GitHub does not allow a submitted review record itself to be deleted, so the newest review is the only full and active automated result.
|
||||
|
||||
Objects are isolated by repository ID and PR number. `latest.json` accelerates the next review, while `reviews/<head-sha>.json` preserves each successful head result. Closing or merging a PR does not proactively delete these objects. Cache data contains no API keys, full diff, or prompt.
|
||||
|
||||
@@ -114,7 +114,7 @@ Action mode remains the default and is complete without a webhook service. `WEBH
|
||||
|
||||
Enable webhook mode only when you also run a long-lived Node process or the included `Dockerfile.webhook`. It receives GitHub App webhook events and answers `@bot` mentions in Issue/PR conversation comments, review comments, and submitted reviews. It is useful when the App is installed once for an organization and you want those repositories to share one endpoint. The App must be installed on each repository (or the organization selection must include it); a webhook cannot access repositories where the installation has no access.
|
||||
|
||||
Configure the GitHub App webhook URL as `https://your-host/webhooks/github`, use the same value for `WEBHOOK_SECRET`, and subscribe to `Issue comments`, `Pull request review comments`, and `Pull request reviews`. The App needs `Metadata: read`, `Issues: read and write`, and `Pull requests: read and write`. The endpoint exchanges each payload's `installation.id` for the correct short-lived installation token, so one fixed installation ID must not be used for all repositories.
|
||||
Configure the GitHub App webhook URL as `https://your-host/webhooks/github`, use the same value for `WEBHOOK_SECRET`, and subscribe to `Issue comments`, `Pull request review comments`, and `Pull request reviews`, plus `Issues` and `Pull requests` for automatic triage. The App needs `Metadata: read`, `Issues: read and write`, and `Pull requests: read and write`. The endpoint exchanges each payload's `installation.id` for the correct short-lived installation token, so one fixed installation ID must not be used for all repositories.
|
||||
|
||||
Set these service environment variables:
|
||||
|
||||
@@ -126,7 +126,7 @@ Set these service environment variables:
|
||||
|
||||
Start it with `npm run build && npm run webhook`, or build `docker build -f Dockerfile.webhook -t ghbot-webhook .` and run it with the App credentials, webhook secret, and Goose variables. `GET /healthz` is available for service probes. GitHub receives `202` before Goose runs; deliveries are HMAC-verified, deduplicated by `X-GitHub-Delivery`, and failed background deliveries remain retryable.
|
||||
|
||||
Webhook chat is deliberately read-only: Goose receives repository metadata, README, Issue/PR text, bounded diffs, and recent discussion, but no repository tools or credentials. It cannot edit code, run commands, push commits, run `/recheck`, or run `/conflict`; use Action mode for those operations. Replies follow the language of the latest comment and include no provider or GitHub secrets. Leaving `WEBHOOK_ENABLED` unset preserves the normal Action-only deployment.
|
||||
Webhook chat is deliberately read-only: Goose receives repository metadata, README, Issue/PR text, bounded diffs, recent discussion, and the host-curated repository knowledge cache when R2 is configured, but no repository tools or credentials. It cannot edit code, run commands, push commits, or execute `/recheck` and `/conflict`; an exact `/recheck` or `/conflict` command receives a guidance reply pointing to Action mode instead of silence. The webhook service also runs the same automatic issue and pull-request triage as Action mode on `opened`, `edited`, and `reopened` events for App-installed repositories; set `WEBHOOK_TRIAGE_ENABLED=false` to disable it there. All webhook-mode local writes stay inside the current working directory: the per-repository knowledge cache lives at `.ghbot-tmp/webhook-knowledge/<repository id>/`. Replies follow the language of the latest comment and include no provider or GitHub secrets. Leaving `WEBHOOK_ENABLED` unset preserves the normal Action-only deployment.
|
||||
|
||||
## Automatic conflict resolution
|
||||
|
||||
|
||||
Reference in new issue
Block a user