Skip to content

[3550 by Claude Opus 5.5] Plugin inbound webhooks: verified endpoints that call a handler - #3579

Merged
propr-dev[bot] merged 8 commits into
3542-epic-plugin-system-xu8from
3550/claude-opus-5-5-plugin-inbound-webhooks-v-20261115-1755-x67
Nov 15, 2026
Merged

propr-dev[bot] merged 8 commits into
3542-epic-plugin-system-xu8from
3550/claude-opus-5-5-plugin-inbound-webhooks-v-20261115-1755-x67

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3550

Branch: 3550/claude-opus-5-5-plugin-inbound-webhooks-v-20261115-1755-x67
Commits: ✅ Changes committed (c2b0f6c)


AI Processing Completed

Execution Details:

Summary:
External services can now call a plugin at POST /api/plugins/<installation key>/hooks/<name>. ProPR checks the request's signature or token before any plugin code runs, then runs the plugin's handler from a queue. Everything I ran passes: 19 server-side test files including the new ones, 58 UI component tests and 5 Playwright tests. Typecheck, the zero-warning lint and the OpenAPI check are clean too. I didn't run the full repository suite or a docs site build.

Manifest. A webhook is now declared as { name, description, handler, verification, deliveryIdHeader?, respond? }. verification is one of:

  • hmac-sha256: a header holding an optional prefix plus the HMAC of the raw body, in hex or base64.
  • slack-v0: Slack's signature, with the timestamp required to be within 5 minutes.
  • token-header: a header holding an optional prefix plus the secret, compared in constant time.

Each scheme uses one of the plugin's signing-secret connections. This replaces the old placeholder { name, description, connection }, so I updated the two tests that used it.

What the route does with a request:

  • 404: an unknown or regenerated key, a disabled or uninstalled plugin, or a webhook name the manifest doesn't declare. Nothing is loaded.
  • 401: a missing or wrong signature, a stale Slack timestamp, or no signing secret set. It is counted per installation and logged with only the plugin, webhook and reason.
  • 409: a delivery id that was already received (a replay).
  • 413: a body over 256 KiB.
  • 429: the same rate limiter /webhook uses, applied before the body is read.
  • 202: verified and queued. The handler then runs as a delivery of kind webhook, shown in Activity, with the same retry schedule as event deliveries.

Challenge responses. respond names another function in handlers.ts. It runs after verification and gets only the frozen request, never ctx, and it must return synchronously. Slack's url_verification echo works this way.

Installation key. It is stored in a new plugin_webhook_keys table. Regenerate replaces it in one step, so the old URLs answer 404 at once, and it is recorded in the audit trail. Uninstalling deletes the key, so a reinstall gets a new URL. Two new admin routes list the URLs and regenerate the key; I regenerated the OpenAPI spec and client types.

Plugins page. The Connect step now has a Webhook URLs section: one URL per webhook with Copy, the count of rejected requests, and Regenerate behind a confirmation. Preview screenshots (desktop, the confirmation, and phone) are attached separately.

Behaviour you might not expect:

  • Request bodies are never written anywhere, so the queue lives only in the API process's memory. A webhook delivery still waiting when the API stops is marked failed on the next start, and a failed webhook delivery has no Retry button; the sending service has to send it again.
  • Webhook failures don't count towards the plugin's Degraded or Paused health. While event deliveries are paused, new webhook requests get 503.
  • A webhook's signing secret isn't required to enable the plugin. Until it is set, requests get 401.

Acceptance criteria

  • AC1: met — pluginWebhookReceiver.ts, pluginWebhookRoutes.ts; packages/core/test/pluginWebhooks.test.ts ("a verified request runs its handler once; … run no plugin code") checks the handler runs once and no plugin module loads for a bad signature, stale timestamp or replay; packages/api/test/pluginWebhookRoutes.test.ts covers 413 for oversized bodies and 429 from the rate limiter.
  • AC2: met — pluginWebhooks.test.ts uses GitHub's documented vector and RFC 4231 test case 2 for hmac-sha256 (hex and base64), Slack's documented request for slack-v0, and GitLab-style and bearer vectors for token-header, each with tampered cases.
  • AC3: met — pluginWebhooks.test.ts ("the synchronous challenge response …"): the challenge is echoed with no handler run, and a respond function that reaches for ctx gets one frozen argument, fails with 500, and changes nothing. The route test also checks the echo over HTTP.
  • AC4: met — pluginWebhooks.test.ts and pluginWebhookRoutes.test.ts: disabled, uninstalled and reinstalled plugins answer 404, and after Regenerate the old URL answers 404 while the new one works.
  • AC5: met — sentinel tests in pluginWebhooks.test.ts and pluginWebhookRoutes.test.ts dump every table and capture every log and console line. I also added a deliberate body log, and the test caught it.
  • AC6: met — propr-ui/src/pages/PluginsPage/PluginWebhookUrls.tsx in PluginConnections.tsx; PluginWebhookUrls.test.tsx, propr-ui/e2e/plugin-webhooks.pw.ts.
  • AC7: met — docs/docs/features/plugins.md (Inbound webhooks: the URL, verification schemes, delivery, challenge responses, routes) and docs/docs/architecture/plugin-runtime.md (Inbound webhooks: key, request path, schemes table, respond function, delivery runner, what is stored).

Review digest

Acceptance criteria (7 of 7 met, as stated by the agent)

  • ✅ AC1 (met): Valid signature runs the handler once; bad signature, stale timestamp, replayed delivery id and oversized body are rejected without running plugin code; the rate limiter applies. — `pluginWebhookReceiver.ts`, `pluginWebhookRoutes.ts`; `packages/core/test/pluginWebhooks.test.ts` ("a verified request runs its handler once; … run no plugin code") checks the handler runs once and no plugin module loads for a bad signature, stale timestamp or replay; `packages/api/test/pluginWebho…
  • ✅ AC2 (met): Each verification scheme has a test with a documented test vector. — `pluginWebhooks.test.ts` uses GitHub's documented vector and RFC 4231 test case 2 for `hmac-sha256` (hex and base64), Slack's documented request for `slack-v0`, and GitLab-style and bearer vectors for `token-header`, each with tampered cases.
  • ✅ AC3 (met): The synchronous challenge response works and cannot call `ctx`. — `pluginWebhooks.test.ts` ("the synchronous challenge response …"): the challenge is echoed with no handler run, and a respond function that reaches for `ctx` gets one frozen argument, fails with 500, and changes nothing. The route test also checks the echo over HTTP.
  • ✅ AC4 (met): A disabled plugin's URL answers 404; regenerating the key invalidates the old URL. — `pluginWebhooks.test.ts` and `pluginWebhookRoutes.test.ts`: disabled, uninstalled and reinstalled plugins answer 404, and after Regenerate the old URL answers 404 while the new one works.
  • ✅ AC5 (met): Request bodies and signature headers are never stored or logged (sentinel test). — sentinel tests in `pluginWebhooks.test.ts` and `pluginWebhookRoutes.test.ts` dump every table and capture every log and console line. I also added a deliberate body log, and the test caught it.
  • ✅ AC6 (met): The Plugins page shows the URL per webhook with copy and Regenerate. — `propr-ui/src/pages/PluginsPage/PluginWebhookUrls.tsx` in `PluginConnections.tsx`; `PluginWebhookUrls.test.tsx`, `propr-ui/e2e/plugin-webhooks.pw.ts`.
  • ✅ AC7 (met): Docs: webhook verification schemes and the URL in `docs/docs/features/plugins.md` and `docs/docs/architecture/plugin-runtime.md`. — `docs/docs/features/plugins.md` (Inbound webhooks: the URL, verification schemes, delivery, challenge responses, routes) and `docs/docs/architecture/plugin-runtime.md` (Inbound webhooks: key, request path, schemes table, respond function, delivery runner, what is stored).

Risk-tiered paths

  • High risk (1 file)
    • packages/core/src/db/migrations/20261116000000_plugin_webhook_keys.js (added, +30/−0): database migration
  • Normal risk (22 files)
    • packages/api/openapi/directRoutes.ts (+2/−0)
    • packages/api/openapi/registeredRoutes.ts (+1/−1)
    • packages/api/openapi/routeDocsPlugins.ts (+28/−1)
    • packages/api/openapi/schemasPlugins.ts (+18/−7)
    • packages/api/pluginRouteRegistry.ts (+5/−2)
    • packages/api/routes/pluginWebhookRoutes.ts (added, +71/−0)
    • packages/api/server.ts (+12/−1)
    • packages/client/src/generated/apiTypes.ts (+38/−10)
    • packages/core/src/index.ts (+3/−0)
    • packages/core/src/plugins/pluginStore.ts (+2/−0)
    • packages/core/src/plugins/pluginWebhookReceiver.ts (added, +125/−0)
    • packages/core/src/plugins/pluginWebhookRunner.ts (added, +167/−0)
    • packages/core/src/plugins/pluginWebhooks.ts (added, +213/−0)
    • packages/shared/src/pluginDeliveries.ts (+10/−5)
    • packages/shared/src/pluginInstallations.ts (+1/−1)
    • packages/shared/src/pluginSdk.ts (+32/−1)
    • packages/shared/src/plugins.ts (+48/−5)
    • propr-ui/src/api/pluginsApi.ts (+7/−0)
    • propr-ui/src/pages/PluginsPage/PluginActivity.tsx (+8/−6)
    • propr-ui/src/pages/PluginsPage/PluginConnections.tsx (+3/−1)
    • propr-ui/src/pages/PluginsPage/PluginWebhookUrls.tsx (added, +95/−0)
    • propr-ui/src/pages/PluginsPage/usePluginWebhooks.ts (added, +33/−0)
  • Low risk (18 files)
    • docs/docs/architecture/plugin-runtime.md (+128/−2)
    • docs/docs/features/plugins.md (+162/−5)
    • docs/docs/operations/configuration-reference.md (+1/−1)
    • docs/static/openapi/propr-api.yaml (+265/−6)
    • packages/api/test/pluginActivityRoutes.test.ts (+4/−2)
    • packages/api/test/pluginRoutes.test.ts (+4/−2)
    • packages/api/test/pluginWebhookRoutes.test.ts (added, +183/−0)
    • packages/core/test/fixtures/plugins/fixture-webhooks/handlers.ts (added, +45/−0)
    • packages/core/test/fixtures/plugins/fixture-webhooks/manifest.json (added, +34/−0)
    • packages/core/test/fixtures/plugins/registry.json (+2/−1)
    • packages/core/test/helpers/pluginHandlerFixture.ts (+2/−1)
    • packages/core/test/pluginContributions.test.ts (+2/−1)
    • packages/core/test/pluginStore.test.ts (+3/−2)
    • packages/core/test/pluginWebhooks.test.ts (added, +257/−0)
    • packages/shared/test/plugins.test.ts (+20/−2)
    • propr-ui/e2e/plugin-webhooks.pw.ts (added, +86/−0)
    • propr-ui/src/pages/PluginsPage/PluginActivity.test.tsx (+11/−0)
    • propr-ui/src/pages/PluginsPage/PluginWebhookUrls.test.tsx (added, +113/−0)

Validation evidence

  • No repository validation commands ran.

Diff size: 41 files changed, +2,274/−66 lines

Detailed Logs:

  • Conversation: 36 messages
  • Session: 9ec4bcf7-6210-40a3-b9af-c0c5552352de

Log files stored at:

  • conversation: /usr/src/app/logs/executions/issue-3550-2026-11-15T18-26-13-060Z-conversation.json
  • output: /usr/src/app/logs/executions/issue-3550-2026-11-15T18-26-13-060Z-output.txt
Latest Conversation Messages
ASSISTANT: [content unavailable]

ASSISTANT: External services can now call a plugin at `POST /api/plugins/<installation key>/hooks/<name>`. ProPR checks the request's signature or token before any plugin code runs, then runs the plugin's handle...


This PR was created automatically by ProPR after processing issue #3550.


💡 Need changes?

Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!


Visual preview

Webhook URLs in the Connect step (desktop)

Webhook URLs in the Connect step (desktop)

Below the signing secret, one URL per webhook with its verification scheme and a Copy button (the second just copied), the count of rejected unverified requests, and Regenerate.

Full-size original

Webhook URLs after Regenerate (phone)

Webhook URLs after Regenerate (phone)

The new URLs at 390 px wide, with full-width Copy buttons and no horizontal overflow; the rejected count started over with the new key.

Full-size original

Regenerate confirmation (desktop)

Regenerate confirmation (desktop)

Regenerate asks for confirmation first: every URL stops working at once.

Full-size original

…lation key>/hooks/<name>`. ProPR checks the request's signature or token before any plugin code runs, then runs the plugin's handler from a queue. Everything I ran passes: 19 server-side test files including the new ones, 58 UI component tests and 5 Playwright tests. Typecheck, the zero-warning lint and the OpenAPI check are clean too. I didn't run the full repository suite or a docs site build.

Manifest. A webhook is now declared as `{ name, description, handler, verification, deliveryIdHeader?, respond? }`. `verification` is one of:
- `hmac-sha256`: a header holding an optional prefix plus the HMAC of the raw body, in hex or base64.
- `slack-v0`: Slack's signature, with the timestamp required to be within 5 minutes.
- `token-header`: a header holding an optional prefix plus the secret, compared in constant time.

Each scheme uses one of the plugin's signing-secret connections. This replaces the old placeholder `{ name, description, connection }`, so I updated the two tests that used it.

What the route does with a request:
- 404: an unknown or regenerated key, a disabled or uninstalled plugin, or a webhook name the manifest doesn't declare. Nothing is loaded.
- 401: a missing or wrong signature, a stale Slack timestamp, or no signing secret set. It is counted per installation and logged with only the plugin, webhook and reason.
- 409: a delivery id that was already received (a replay).
- 413: a body over 256 KiB.
- 429: the same rate limiter `/webhook` uses, applied before the body is read.
- 202: verified and queued. The handler then runs as a delivery of kind `webhook`, shown in Activity, with the same retry schedule as event deliveries.

Challenge responses. `respond` names another function in `handlers.ts`. It runs after verification and gets only the frozen request, never `ctx`, and it must return synchronously. Slack's `url_verification` echo works this way.

Installation key. It is stored in a new `plugin_webhook_keys` table. Regenerate replaces it in one step, so the old URLs answer 404 at once, and it is recorded in the audit trail. Uninstalling deletes the key, so a reinstall gets a new URL. Two new admin routes list the URLs and regenerate the key; I regenerated the OpenAPI spec and client types.

Plugins page. The Connect step now has a Webhook URLs section: one URL per webhook with Copy, the count of rejected requests, and Regenerate behind a confirmation. Preview screenshots (desktop, the confirmation, and phone) are attached separately.

Behaviour you might not expect:
- Request bodies are never written anywhere, so the queue lives only in the API process's memory. A webhook delivery still waiting when the API stops is marked failed on the next start, and a failed webhook delivery has no Retry button; the sending service has to send it again.
- Webhook failures don't count towards the plugin's Degraded or Paused health. While event deliveries are paused, new webhook requests get 503.
- A webhook's signing secret isn't required to enable the plugin. Until it is set, requests get 401.

Acceptance criteria
- AC1: met — `pluginWebhookReceiver.ts`, `pluginWebhookRoutes.ts`; `packages/core/test/pluginWebhooks.test.ts` ("a verified request runs its handler once; … run no plugin code") checks the handler runs once and no plugin module loads for a bad signature, stale timestamp or replay; `packages/api/test/pluginWebhookRoutes.test.ts` covers 413 for oversized bodies and 429 from the rate limiter.
- AC2: met — `pluginWebhooks.test.ts` uses GitHub's documented vector and RFC 4231 test case 2 for `hmac-sha256` (hex and base64), Slack's documented request for `slack-v0`, and GitLab-style and bearer vectors for `token-header`, each with tampered cases.
- AC3: met — `pluginWebhooks.test.ts` ("the synchronous challenge response …"): the challenge is echoed with no handler run, and a respond function that reaches for `ctx` gets one frozen argument, fails with 500, and changes nothing. The route test also checks the echo over HTTP.
- AC4: met — `pluginWebhooks.test.ts` and `pluginWebhookRoutes.test.ts`: disabled, uninstalled and reinstalled plugins answer 404, and after Regenerate the old URL answers 404 while the new one works.
- AC5: met — sentinel tests in `pluginWebhooks.test.ts` and `pluginWebhookRoutes.test.ts` dump every table and capture every log and console line. I also added a deliberate body log, and the test caught it.
- AC6: met — `propr-ui/src/pages/PluginsPage/PluginWebhookUrls.tsx` in `PluginConnections.tsx`; `PluginWebhookUrls.test.tsx`, `propr-ui/e2e/plugin-webhooks.pw.ts`.
- AC7: met — `docs/docs/features/plugins.md` (Inbound webhooks: the URL, verification schemes, delivery, challenge responses, routes) and `docs/docs/architecture/plugin-runtime.md` (Inbound webhooks: key, request path, schemes table, respond function, delivery runner, what is stored).
@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

/ultrafix goal=8 max=10
Triggered automatically by the requested execution settings.

@propr-dev propr-dev Bot added the ultrafix label Nov 15, 2026
@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 10)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Validate unsigned linux-x64 package

Please investigate and fix this CI failure.

  • Check: Validate unsigned linux-x64 package
  • Result: failure
  • Commit: c2b0f6c63499 (c2b0f6c6349915add4caa287ddba9f795899b327)
  • Details: View CI failure

Failure evidence

.github:38
Process completed with exit code 2.

.github:43
Type 'null' is not assignable to type 'number'.

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 3da3c8e

Summary of Changes

I fixed the CI failure: the propr-ui typecheck (tsc --noEmit) was failing on a test file this PR added. The packaging job runs that typecheck, so it went red too.

Cause: In propr-ui/e2e/plugin-webhooks.pw.ts, the mock state for the rejected-request count starts with lastAt set to a number. TypeScript therefore typed lastAt as number. The Regenerate route mock then sets it to null (line 43), which the type didn't allow.

Fix: I declared lastAt on line 19 as number | null, the same way lastReason is already declared as string | null. This only changes a type, so the test behaves exactly as before.

tsc --noEmit and ESLint on that file now pass in propr-ui. I didn't rerun the Playwright test or the full packaging job, since the test's behaviour didn't change. There are no new previews because nothing visible changed.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • propr-ui/e2e/plugin-webhooks.pw.ts (+1/−1)

Validation evidence

  • No repository validation commands ran.

Diff size: 1 file changed, +1/−1 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 3m 47s
  • Tokens: 193,632 (192,670 in / 962 out)
  • Cost: $0.25

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 6899204646✓

…Emit`) was failing on a test file this PR added. The packaging job runs that typecheck, so it went red too.

I fixed the CI failure: the `propr-ui` typecheck (`tsc --noEmit`) was failing on a test file this PR added. The packaging job runs that typecheck, so it went red too.

**Cause:** In `propr-ui/e2e/plugin-webhooks.pw.ts`, the mock state for the rejected-request count starts with `lastAt` set to a number. TypeScript therefore typed `lastAt` as `number`. The Regenerate route mock then sets it to `null` (line 43), which the type didn't allow.

**Fix:** I declared `lastAt` on line 19 as `number | null`, the same way `lastReason` is already declared as `string | null`. This only changes a type, so the test behaves exactly as before.

`tsc --noEmit` and ESLint on that file now pass in `propr-ui`. I didn't rerun the Playwright test or the full packaging job, since the test's behaviour didn't change. There are no new previews because nothing visible changed.

PR: #3579
Comment by: @propr-dev[bot] (ID: 6899204646)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

This PR adds inbound webhook verification, queued delivery, installation-key management, and UI/documentation support. It needs significant corrections before merge: replay handling, payload confidentiality, recovery ownership, and delivery identity have verified defects.

✅ Verification before dispatch — All three schemes validate credentials before handler dispatch; Slack verification also checks timestamp freshness.

✅ Administrative controls — URL management reuses durable administrator authorization, and regeneration requires the existing preflight-protected mutation contract.

✅ Focused coverage — Added tests cover signature vectors, key rotation, disabled installations, body limits, and UI interactions.

This review is a static analysis of the supplied diff and context; no commands were run. The authoritative checks show 31 passed, three pending, and no failures.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F1: 🔴 Responders run before replay rejection

  • Category: correctness

  • Required behavior: AC1 requires replayed delivery IDs to be rejected without running plugin code.

  • Evidence: packages/core/src/plugins/pluginWebhookReceiver.ts:109 — receive calls respond before deriving or reserving the delivery ID.

    1. A declared webhook has both respond and deliveryIdHeader; its responder returns null for ordinary events.
    2. A verified request executes the responder and is subsequently accepted into the delivery table.
    3. The sender repeats that request with the same delivery ID.
    4. The receiver loads and executes the responder again before runner.accept discovers the duplicate and returns 409.

    The duplicate has already run plugin code, violating the explicit refusal guarantee. If the responder returns a challenge response, the receiver returns immediately without recording or checking that delivery ID at all. Verification authenticates the request but does not establish freshness. Existing replay tests use signed, which has no responder.

    static trace: verified from the ordering in receive, respond, and PluginWebhookRunner.accept.

  • Minimum fix: Validate and atomically reserve declared delivery IDs before invoking any responder, including challenge responses, while preserving appropriate retry behavior when processing fails. Add coverage combining a responder with a delivery-ID header.

F2: 🔴 Handler logs can persist request bodies

  • Category: security

  • Required behavior: AC5 requires request bodies never to be stored or logged.

  • Evidence: packages/core/src/plugins/pluginWebhookRunner.ts:150, packages/core/src/plugins/pluginWebhookRunner.ts:160 — webhook input reaches the ordinary handler runner, and its returned errors and logs are persisted.

    1. A verified request contains ordinary text such as customer-private-message-123.
    2. Its handler calls ctx.log.info(input.body) or throws new Error(input.body), for example while reporting an unexpected payload.
    3. The existing context redacts credentials and recognized secret patterns; it is not given the webhook body as sensitive input.
    4. The webhook runner writes the resulting text into plugin_deliveries.logs or error, making it available through Activity.

    Arbitrary request content is not necessarily a credential or recognizable secret. The supplied sentinel fixture deliberately records only body length, so its passing assertion does not exercise this path.

    static trace: verified through the new runner’s invocation and persistence calls and the supplied pluginHandlerRunner and pluginContext excerpts.

  • Minimum fix: Enforce webhook payload confidentiality at the diagnostic boundary, covering errors and log messages/fields before persistence. If arbitrary handler diagnostics cannot meet that guarantee, retain only safe webhook diagnostic metadata. Add sentinel cases that deliberately log and throw request content.

F3: 🔴 Startup recovery fails another process’s deliveries

  • Category: correctness

  • Required behavior: Recovery must only abandon deliveries whose owning process has stopped; starting another API process must not discard accepted work.

  • Evidence: packages/core/src/plugins/pluginWebhookRunner.ts:61 — recover; packages/api/server.ts:693 — startup invokes recovery for every new runner.

    1. API process A accepts a webhook, returns 202, and holds its request while the delivery waits for a retry.
    2. API process B starts against the same database while A remains alive.
    3. B calls recover() with an empty local held map and marks every unfinished webhook delivery failed, including A’s.
    4. When A’s retry timer fires, attempt reads the failed status and deletes its held request without executing the retry.

    This permanently drops accepted work. The server explicitly accommodates multiple API processes, but recovery has no process ownership or liveness condition. Excluding IDs in B’s local map cannot protect A’s deliveries. The supplied recovery test inserts an orphan and does not exercise a live owner.

    static trace: verified from startup, the unrestricted recovery update, and the status guard in attempt. The competing actor is B’s startup recovery during A’s scheduled retry delay; no lease or transaction fences that update.

  • Minimum fix: Associate unfinished webhook deliveries with their owning process and recover only owners established to be dead, or enforce a single webhook runner owner before performing recovery. Add a two-runner regression proving startup cannot finalize a live runner’s pending or retrying work.

F4: 🔴 Delivery IDs collide across webhook names

  • Category: correctness

  • Required behavior: Replay detection must distinguish different webhooks and their respective sender delivery IDs.

  • Evidence: packages/core/src/plugins/pluginWebhookReceiver.ts:94 — deliveryId; packages/core/src/plugins/pluginWebhookRunner.ts:73 — insertion uses the resulting string as the unique delivery identity.

    1. One plugin declares valid webhook names a and a-b, both with delivery-ID headers.
    2. Webhook a receives sender ID b-c, producing whk-a-b-c.
    3. Webhook a-b receives sender ID c, also producing whk-a-b-c.
    4. The second legitimate request conflicts with the first record’s (plugin_id, delivery_id) key and returns 409 without delivery.

    Both names and IDs satisfy the new validators. A shared plugin ID and ambiguous hyphen concatenation make distinct requests indistinguishable; signature verification cannot prevent this collision.

    static trace: verified from deliveryId, the permitted webhook-name/delivery-ID characters, and the delivery table’s unique constraint.

  • Minimum fix: Use an unambiguous encoding or a separate composite uniqueness key for webhook name and sender ID. Add the two-webhook collision case.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Describe raw bodies in OpenAPI

packages/api/openapi/routeDocsPlugins.ts describes arbitrary raw input but models the request as a JSON object, and documents only a text challenge response despite supporting JSON. Aligning these schemas and media types would improve generated-client usability. This is optional because the runtime route already accepts the documented body formats.

Score

The implementation has useful verification and UI coverage, but four demonstrated defects affect explicit acceptance criteria and reliable delivery. Passing checks do not cover these failure sequences.

Score: 5/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 4s
  • Tokens: 100,166 (98,319 in / 1,847 out)
  • Cost: $0.97

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F1 F2 F3 F4 S1

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 2031768

Addressed 1 AI review comment (IDs: 6899511469)

Addressed findings F1, F2, F3, F4

Summary of Changes

I fixed F1–F4. The core plugin suites pass (35 tests across pluginStore, pluginContributions and pluginWebhooks), and so do the three API route test files. pluginRoutes passed and then hung at exit until the timeout killed it, which is a known pattern for API tests in this container. Typecheck for core and api, the zero-warning lint on the changed source files, the OpenAPI check and the PluginActivity UI test are clean.

F1 – a replay could run the responder. The receiver now works out the delivery id first (400 if malformed). It then reserves it in plugin_deliveries before any plugin code runs, so a replay gets 409 without loading the module or calling respond. The runner gained reserve, start, answered and release, and accept is now just reserve then start.

  • Challenge answered: if the id came from the sender, the record is marked succeeded under the respond function's name, so a replayed challenge also gets 409. A ProPR-assigned id can't be sent again, so its record is deleted.
  • Refused before delivery: a respond failure (500), a paused plugin (503) or an error releases the reservation, so the sender's retry is accepted rather than treated as a replay.
  • New test: a responder combined with X-Delivery-Id, checking that it ran once on a replayed ordinary event and on a replayed challenge, and that a paused-then-retried request is delivered.

F2 – handler output could store the body. A webhook attempt now keeps only each log line's level and time, and a fixed error: "The webhook handler failed (its error is not kept: it may contain the request)" or "…timed out". Matching the body text isn't enough, because a handler can log any part or transformation of it. The same change applies where a respond function fails: that log no longer includes the error's name, since a plugin can set it to anything. A new leakyWebhook fixture logs the body as a message and in fields and throws it, and the sentinel test checks that no table or log line contains customer-private-message-123.

F3 – a starting process could fail another's deliveries. Each runner now has an owner name and a heartbeat in a new plugin_webhook_runners table, renewed every 30 s. Each delivery records its owner in a new webhook_owner column. Recovery runs at startup and with every heartbeat, as a single UPDATE, and fails only deliveries with no owner or whose owner's heartbeat is more than 2 minutes old. A new test runs two runners: starting B fails nothing of A, A's retry still succeeds, and a delivery owned by a runner with a stale heartbeat is failed.

F4 – delivery ids collided across webhooks. Ids are now whk-<webhook>:<sender id>, or whk-<webhook>/<uuid> when ProPR assigns one. Webhook names can't contain : or /, so the name always ends where the separator is. The new test sends a with b-c and a-b with c, and both are delivered.

Things to know:

  • I added the new table and column to this PR's existing migration, 20261116000000_plugin_webhook_keys.js, rather than a new file, because tests list migrations by name. Each step is guarded, so it is safe to re-run.
  • Webhook Activity entries no longer show the handler's error or log text. That costs debugging detail, and it's the only way to meet AC5 for arbitrary request content.
  • A process whose event loop stalls for more than 2 minutes would be taken for stopped, and its deliveries failed. That's inherent in using a heartbeat.
  • I updated the docs (plugins.md, plugin-runtime.md), the deliveryId description in the OpenAPI spec and generated client types, and the existing tests that expected the old id format and error text. The fixture manifest has four new webhooks, so the route test's list of webhooks changed too.
  • There are no visible UI changes, so I made no previews.

Not fixed, outside these findings: the audit record that ctx.propr calls write to plugin_audit stores the call's details. A webhook handler that puts request content into such a call (for example a comment body) would have it stored there.

Review digest

Risk-tiered paths

  • High risk (1 file)
    • packages/core/src/db/migrations/20261116000000_plugin_webhook_keys.js (+16/−2): database migration
  • Normal risk (6 files)
    • packages/api/openapi/schemasPlugins.ts (+1/−1)
    • packages/api/server.ts (+1/−1)
    • packages/client/src/generated/apiTypes.ts (+1/−1)
    • packages/core/src/plugins/pluginWebhookReceiver.ts (+47/−21)
    • packages/core/src/plugins/pluginWebhookRunner.ts (+136/−16)
    • packages/shared/src/pluginDeliveries.ts (+1/−1)
  • Low risk (8 files)
    • docs/docs/architecture/plugin-runtime.md (+34/−17)
    • docs/docs/features/plugins.md (+18/−12)
    • docs/static/openapi/propr-api.yaml (+1/−1)
    • packages/api/test/pluginWebhookRoutes.test.ts (+1/−1)
    • packages/core/test/fixtures/plugins/fixture-webhooks/handlers.ts (+16/−0)
    • packages/core/test/fixtures/plugins/fixture-webhooks/manifest.json (+20/−1)
    • packages/core/test/pluginWebhooks.test.ts (+97/−4)
    • propr-ui/src/pages/PluginsPage/PluginActivity.test.tsx (+1/−1)

Validation evidence

  • No repository validation commands ran.

Diff size: 15 files changed, +391/−80 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 21m 59s
  • Tokens: 5,180,886 (5,144,801 in / 36,085 out)
  • Cost: $2.36

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

… `pluginStore`, `pluginContributions` and `pluginWebhooks`), and so do the three API route test files. `pluginRoutes` passed and then hung at exit until the timeout killed it, which is a known pattern for API tests in this container. Typecheck for core and api, the zero-warning lint on the changed source files, the OpenAPI check and the `PluginActivity` UI test are clean.

I fixed F1–F4. The core plugin suites pass (35 tests across `pluginStore`, `pluginContributions` and `pluginWebhooks`), and so do the three API route test files. `pluginRoutes` passed and then hung at exit until the timeout killed it, which is a known pattern for API tests in this container. Typecheck for core and api, the zero-warning lint on the changed source files, the OpenAPI check and the `PluginActivity` UI test are clean.

**F1 – a replay could run the responder.** The receiver now works out the delivery id first (400 if malformed). It then reserves it in `plugin_deliveries` before any plugin code runs, so a replay gets 409 without loading the module or calling `respond`. The runner gained `reserve`, `start`, `answered` and `release`, and `accept` is now just reserve then start.
- **Challenge answered:** if the id came from the sender, the record is marked succeeded under the respond function's name, so a replayed challenge also gets 409. A ProPR-assigned id can't be sent again, so its record is deleted.
- **Refused before delivery:** a respond failure (500), a paused plugin (503) or an error releases the reservation, so the sender's retry is accepted rather than treated as a replay.
- **New test:** a responder combined with `X-Delivery-Id`, checking that it ran once on a replayed ordinary event and on a replayed challenge, and that a paused-then-retried request is delivered.

**F2 – handler output could store the body.** A webhook attempt now keeps only each log line's level and time, and a fixed error: "The webhook handler failed (its error is not kept: it may contain the request)" or "…timed out". Matching the body text isn't enough, because a handler can log any part or transformation of it. The same change applies where a respond function fails: that log no longer includes the error's name, since a plugin can set it to anything. A new `leakyWebhook` fixture logs the body as a message and in fields and throws it, and the sentinel test checks that no table or log line contains `customer-private-message-123`.

**F3 – a starting process could fail another's deliveries.** Each runner now has an owner name and a heartbeat in a new `plugin_webhook_runners` table, renewed every 30 s. Each delivery records its owner in a new `webhook_owner` column. Recovery runs at startup and with every heartbeat, as a single UPDATE, and fails only deliveries with no owner or whose owner's heartbeat is more than 2 minutes old. A new test runs two runners: starting B fails nothing of A, A's retry still succeeds, and a delivery owned by a runner with a stale heartbeat is failed.

**F4 – delivery ids collided across webhooks.** Ids are now `whk-<webhook>:<sender id>`, or `whk-<webhook>/<uuid>` when ProPR assigns one. Webhook names can't contain `:` or `/`, so the name always ends where the separator is. The new test sends `a` with `b-c` and `a-b` with `c`, and both are delivered.

Things to know:
- I added the new table and column to this PR's existing migration, `20261116000000_plugin_webhook_keys.js`, rather than a new file, because tests list migrations by name. Each step is guarded, so it is safe to re-run.
- Webhook Activity entries no longer show the handler's error or log text. That costs debugging detail, and it's the only way to meet AC5 for arbitrary request content.
- A process whose event loop stalls for more than 2 minutes would be taken for stopped, and its deliveries failed. That's inherent in using a heartbeat.
- I updated the docs (`plugins.md`, `plugin-runtime.md`), the `deliveryId` description in the OpenAPI spec and generated client types, and the existing tests that expected the old id format and error text. The fixture manifest has four new webhooks, so the route test's list of webhooks changed too.
- There are no visible UI changes, so I made no previews.

Not fixed, outside these findings: the audit record that `ctx.propr` calls write to `plugin_audit` stores the call's details. A webhook handler that puts request content into such a call (for example a comment body) would have it stored there.

PR: #3579
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

This PR adds inbound webhook verification, delivery tracking, challenge responses, and administration UI. It needs changes before merge: asynchronous responder failures, concurrent capacity admission, and installation lifecycle races remain.

✅ Verification before execution — Signature verification and delivery-ID reservation precede responder loading, including replayed challenges.

✅ Restricted diagnostics — Webhook delivery records discard handler error text and log contents that could contain request data.

✅ End-to-end coverage — The diff includes verification vectors, route tests, lifecycle tests, and UI coverage.

The supplied current-head status shows 32 passed, 2 pending, and no failed checks. This review is based on static tracing; no commands were run.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F5: 🔴 Rejected responder promises remain unhandled

  • Category: correctness

  • Required behavior: A responder returning a promise must produce a controlled 500 response without disrupting the API process.

  • Evidence: packages/core/src/plugins/pluginWebhookReceiver.ts, checkedResponse and respond

    static trace:

    1. A configured responder is accidentally declared async and throws while parsing a verified request, producing a rejected promise.
    2. Reflect.apply returns that promise. checkedResponse detects its then method and throws a separate synchronous validation error.
    3. respond catches the validation error and returns 500, but never attaches a rejection handler to the responder's original promise.

    The original rejection remains unhandled and can terminate the Node process under its default unhandled-rejection behavior. The surrounding try/catch catches only the synchronous validation error. The fixture tests exercise a synchronous throw, not a rejected promise. Verification is a static trace; no runtime test was executed.

  • Minimum fix: Consume rejection from returned promises while still refusing asynchronous responses with 500. Add a regression covering an async responder that throws, including after an await.

F6: 🔴 Concurrent requests bypass queue capacity

  • Category: correctness

  • Required behavior: Admission must enforce the configured maximum of held and reserved webhook deliveries.

  • Evidence: packages/core/src/plugins/pluginWebhookRunner.ts, reserve

    static trace:

    1. The runner has 999 held or reserved deliveries under the default 1,000 limit.
    2. Two verified requests with distinct delivery IDs call reserve. Both pass the capacity check before either increments any reservation count.
    3. Both yield at await this.register() and subsequently at the database insertion. Each successfully inserts a different delivery and adds its record to reserved.
    4. Both requests can start, leaving 1,001 requests retained in memory. A larger concurrent burst exceeds the limit further.

    The database's unique index prevents duplicate IDs, not excess admission. Even an already-resolved registration promise yields at await; no semaphore or provisional counter protects this window. Per-client rate limiting does not serialize requests or enforce aggregate runner capacity.

  • Minimum fix: Claim a capacity slot synchronously before the first await, and release or transfer that slot on every success, duplicate, error, and shutdown path. Test concurrent admission at the limit.

F7: 🔴 Old requests can recreate deliveries after uninstall

  • Category: correctness

  • Required behavior: Webhook deliveries and replay reservations must belong to the installation that accepted them; uninstall must prevent old requests from contaminating a replacement installation.

  • Evidence: packages/core/src/plugins/pluginWebhookRunner.ts, reserve and current; packages/core/src/plugins/pluginWebhookReceiver.ts, receive

    static trace:

    1. A verified request resolves installation A and enters reserve, then yields at await this.register() before inserting its delivery.
    2. An administrator uninstalls A during that window. Uninstall deletes its delivery records and webhook key. The plugin is then reinstalled as B.
    3. The suspended reservation resumes and inserts A's delivery using only plugin_id and delivery_id; it never checks that A still exists.
    4. The runner's later current check correctly prevents execution against B, but marks the newly inserted record failed and leaves it stored.
    5. The sender submits that delivery ID to B's new URL. The unique (plugin_id, delivery_id) constraint rejects it as a replay, although B never received it.

    Uninstall's transaction cannot delete a row inserted after it commits. The later installation check protects handler execution but does not prevent the stale reservation from poisoning B's replay history. This is a static trace of the explicit await and supplied uninstall behavior.

  • Minimum fix: Validate that the target installation still exists with the same installed_at and is enabled inside the transaction that inserts the reservation. Refuse stale requests without inserting a record. Add an uninstall/reinstall interleaving regression.

Suggestions

These are optional follow-ups and are not sent to /fix.

S2: 🟢 Clarify responder isolation claims

The new documentation says responders cannot send HTTP requests because they receive no ctx, while the same documentation permits Node built-ins and describes plugins as trusted, in-process code. Clarify that responders receive no SDK capabilities, rather than implying runtime isolation. This is optional documentation precision within the existing trusted-plugin model.

Score

The implementation covers the intended feature broadly, but three localized runtime and lifecycle defects require correction. Passing checks do not cover these failure sequences.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 2s
  • Tokens: 104,962 (103,373 in / 1,589 out)
  • Cost: $0.98

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F5 F6 F7 S2

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit c8af153

Addressed 1 AI review comment (IDs: 6900110040)

Addressed findings F5, F6, F7

Summary of Changes

I fixed F5, F6 and F7. Three new regression tests pass and fail when I put the old runner and receiver code back. All 13 tests in pluginWebhooks.test.ts pass, and so do pluginWebhookRoutes.test.ts and pluginStore.test.ts. Core typecheck (including the changed test file) and the zero-warning lint on the two changed source files are clean.

F5: async responder rejections. The check that refuses a promise-shaped answer (checkedResponse in pluginWebhookReceiver.ts) now attaches a no-op rejection handler to the promise before throwing. The request still gets the same 500 and its reservation is still given back. The regression uses an async responder that throws at once and one that throws after an await. It records unhandled rejections and also checks that nothing was queued. On the old code Node reported the after-await rejection as unhandled.

F6: queue capacity under concurrency. reserve in pluginWebhookRunner.ts now takes a capacity slot before its first await. That slot counts towards the limit along with held and reserved deliveries. It turns into a reservation at the same moment the record is added, and is given back on every other path: duplicate, stale installation, shutdown during registration, or an error. The regression sends a burst of 5 concurrent reserves at maxPending: 2 and exactly 2 get in. It also checks that a duplicate or a stale request leaves its slot free, and that a released slot can be used once.

F7: stale requests after uninstall. reserve now checks the installation and inserts the record in the same transaction. If the installation is gone, has a different installed_at, or is disabled, it refuses with a new reason, gone, and records nothing; the receiver answers that with 404, as it would for a dead URL. The database is a single SQLite connection, so this transaction runs strictly before or after uninstall's transaction: either nothing is inserted, or uninstall deletes the row. The regression holds a verified request after its key was resolved, then uninstalls, reinstalls and re-enables the plugin before letting it continue. The held request gets 404 and leaves no record, and the same delivery id sent to the new URL gets 202 and runs.

I looked at the other places the runner acts on a reserved record (start, answered, release and the attempt loop). After an uninstall they find no record and do nothing, so the same defect isn't there and they needed no change.

There are no visual changes, so I made no previews.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (2 files)
    • packages/core/src/plugins/pluginWebhookReceiver.ts (+12/−2)
    • packages/core/src/plugins/pluginWebhookRunner.ts (+39/−16)
  • Low risk (1 file)
    • packages/core/test/pluginWebhooks.test.ts (+81/−1)

Validation evidence

  • No repository validation commands ran.

Diff size: 3 files changed, +132/−19 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 7m 0s
  • Tokens: 1,578,344 (1,563,836 in / 14,508 out)
  • Cost: $1.00

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

…fail when I put the old runner and receiver code back. All 13 tests in `pluginWebhooks.test.ts` pass, and so do `pluginWebhookRoutes.test.ts` and `pluginStore.test.ts`. Core typecheck (including the changed test file) and the zero-warning lint on the two changed source files are clean.

I fixed F5, F6 and F7. Three new regression tests pass and fail when I put the old runner and receiver code back. All 13 tests in `pluginWebhooks.test.ts` pass, and so do `pluginWebhookRoutes.test.ts` and `pluginStore.test.ts`. Core typecheck (including the changed test file) and the zero-warning lint on the two changed source files are clean.

**F5: async responder rejections.** The check that refuses a promise-shaped answer (`checkedResponse` in `pluginWebhookReceiver.ts`) now attaches a no-op rejection handler to the promise before throwing. The request still gets the same 500 and its reservation is still given back. The regression uses an `async` responder that throws at once and one that throws after an await. It records unhandled rejections and also checks that nothing was queued. On the old code Node reported the after-await rejection as unhandled.

**F6: queue capacity under concurrency.** `reserve` in `pluginWebhookRunner.ts` now takes a capacity slot before its first await. That slot counts towards the limit along with held and reserved deliveries. It turns into a reservation at the same moment the record is added, and is given back on every other path: duplicate, stale installation, shutdown during registration, or an error. The regression sends a burst of 5 concurrent reserves at `maxPending: 2` and exactly 2 get in. It also checks that a duplicate or a stale request leaves its slot free, and that a released slot can be used once.

**F7: stale requests after uninstall.** `reserve` now checks the installation and inserts the record in the same transaction. If the installation is gone, has a different `installed_at`, or is disabled, it refuses with a new reason, `gone`, and records nothing; the receiver answers that with 404, as it would for a dead URL. The database is a single SQLite connection, so this transaction runs strictly before or after uninstall's transaction: either nothing is inserted, or uninstall deletes the row. The regression holds a verified request after its key was resolved, then uninstalls, reinstalls and re-enables the plugin before letting it continue. The held request gets 404 and leaves no record, and the same delivery id sent to the new URL gets 202 and runs.

I looked at the other places the runner acts on a reserved record (`start`, `answered`, `release` and the attempt loop). After an uninstall they find no record and do nothing, so the same defect isn't there and they needed no change.

There are no visual changes, so I made no previews.

PR: #3579
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements inbound webhook verification, delivery tracking, administration, UI, and documentation comprehensively. It needs a localized recovery fix before merge.

✅ Verification precedes plugin execution — Signature verification and delivery-ID reservation happen before loading the responder or queued handler.

✅ Sensitive diagnostics are withheld — Webhook delivery records replace handler messages, fields, and errors with fixed diagnostics, with dedicated sentinel coverage.

✅ Concurrent admission is bounded — The runner counts outstanding reservations and in-flight claims toward its capacity limit.

This was a static review of the supplied code; no commands were run. Current checks report 29 passed, five pending, and no failures.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F8: 🔴 Preserve deliveries after persistence failures

  • Category: correctness

  • Required behavior: Accepted webhook deliveries must reach a final state or remain recoverable; persistence failures must not silently discard their only in-memory request while leaving an unfinished record.

  • Evidence: packages/core/src/plugins/pluginWebhookRunner.ts, schedule, attempt, release, answered, and recoverStopped

    1. A verified request is accepted with 202, and its delivery record belongs to the live runner.
    2. During an attempt, a database operation rejects—for example, the final outcome update encounters a transient database write failure.
    3. The catch in schedule logs the failure and deletes the delivery from held, discarding its request without finalizing its durable record or scheduling another attempt.
    4. Subsequent heartbeats succeed. This runner's recovery explicitly excludes its own records, and other runners exclude records belonging to owners with fresh heartbeats.
    5. The delivery remains pending, running, or retrying indefinitely while the process stays healthy. Redelivery with the same sender ID receives 409, so the sender cannot recover it either.

    The same premature-release assumption occurs in release and answered: both remove the reservation before awaiting the database mutation. If that mutation fails, the receiver's catch calls release again, but it returns immediately because the reservation is already gone. This leaves another unfinished record without a corresponding in-memory obligation.

    static trace: The catch, reservation deletion ordering, and recovery ownership predicates establish these paths directly. Heartbeats prove process liveness, not that the process still holds each request. Existing tests exercise stopped owners and successful cleanup, but do not inject failures at these persistence boundaries.

  • Minimum fix: Retain ownership of the request or cleanup obligation until its database transition succeeds. Retry persistence separately from handler execution, and allow reconciliation of this runner's orphaned unfinished records. Apply the same rule to reservation release and challenge completion; add regression coverage for transient failures at each boundary.

Suggestions

These are optional follow-ups and are not sent to /fix.

S3: 🟢 Clarify responder isolation claims

The new documentation says a responder cannot send HTTP requests because it receives no ctx. The supplied context also permits Node built-ins and runs trusted plugin modules in-process. Describe this as withholding SDK capabilities rather than enforcing a runtime sandbox. This is a documentation clarification, not a request to redesign the trusted-plugin model.

S4: 🟢 Explain failed-delivery redelivery limits

The delivery documentation recommends sending a failed webhook again, but reservation rejects an existing sender delivery ID regardless of its terminal status. Clarify that ordinary redelivery with the same ID remains rejected during retention. Changing that policy is optional because the requested replay behavior explicitly rejects previously received IDs.

Score

The implementation has substantial coverage and clear separation of verification and execution, but persistence failures can strand accepted deliveries permanently while their owner remains live. The remaining CI checks are pending, not failed.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 57s
  • Tokens: 107,668 (106,451 in / 1,217 out)
  • Cost: $1.00

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F8 S3 S4

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit d74a0bc

Addressed 1 AI review comment (IDs: 6900444746)

Addressed finding F8

Summary of Changes

I fixed F8: a webhook delivery is no longer dropped from memory when a database write fails. The runner keeps the request (or the reservation) until the write that moves the delivery on has succeeded.

What changed (packages/core/src/plugins/pluginWebhookRunner.ts):

  • Failed writes are retried. When a write fails during an attempt, the delivery stays held and the step is tried again after 1 s, 5 s, 30 s, then every minute. The delay is configurable with a new persistRetryMs option.
  • The handler never runs twice. If the handler had already run, only its saved outcome is written again. If the earlier write actually went through but reported an error, the retry sees that and treats the outcome as recorded. If the failed write was the one marking the attempt running and it did go through, the retry recognises the mark and runs the handler without counting a new attempt.
  • release keeps its reservation until the record is deleted. A failed delete is retried in the background. answered keeps the reservation until its update succeeds; if the update fails it throws, and the receiver's existing catch then calls release, which now finds the reservation and gives the record back.
  • A runner now cleans up its own lost records. Each heartbeat marks failed any unfinished record this runner owns but no longer holds or has reserved. It skips this while a reservation is being written, because that new record may not be tracked yet.
  • Shutdown and tests: stop() cancels pending release retries, and idle() now also waits for write retries and releases in progress.

I also added a paragraph on this to docs/docs/architecture/plugin-runtime.md.

Tests: four new regressions in packages/core/test/pluginWebhooks.test.ts. They wrap the runner's database so chosen writes fail once, either before the write or after it went through:

  • the final outcome write and the retrying write fail: the handler still ran once per attempt and the delivery ends succeeded.
  • the running mark fails, in both modes: the handler runs once, as attempt 1.
  • a release delete fails on the paused (503) path and an answered-challenge update fails: the sender's resend is delivered or answered, with no 409 and no unfinished record left.
  • an unfinished record this runner owns but doesn't hold is marked failed, and the delivery it does hold is left alone.

All four fail when I put the old runner back. All 19 tests in pluginWebhooks.test.ts pass, as do pluginStore and pluginContributions (25 tests) and pluginWebhookRoutes.test.ts in the API package. Core typecheck is clean, and so is the zero-warning lint on the runner. In a typecheck of the test file alone, the only errors were missing type declarations for the migration files the shared fixture imports, none in the test file.

Two cases that still can't be fully fixed:

  • If the challenge answer's write goes through but reports an error, the sender gets a 500, and resending the same delivery id gets a 409. There's no way to tell from the error whether the write landed.
  • If release deletes keep failing until shutdown, the record isn't cleaned up by this runner. After the runner stops, another runner marks it failed on its next heartbeat.

I found no other problems outside F8. There's nothing visible to users, so I made no preview.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (1 file)
    • packages/core/src/plugins/pluginWebhookRunner.ts (+123/−26)
  • Low risk (2 files)
    • docs/docs/architecture/plugin-runtime.md (+9/−1)
    • packages/core/test/pluginWebhooks.test.ts (+108/−2)

Validation evidence

  • No repository validation commands ran.

Diff size: 3 files changed, +240/−29 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 7m 40s
  • Tokens: 1,442,631 (1,420,856 in / 21,775 out)
  • Cost: $1.13

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

…mory when a database write fails. The runner keeps the request (or the reservation) until the write that moves the delivery on has succeeded.

I fixed F8: a webhook delivery is no longer dropped from memory when a database write fails. The runner keeps the request (or the reservation) until the write that moves the delivery on has succeeded.

**What changed** (`packages/core/src/plugins/pluginWebhookRunner.ts`):
- **Failed writes are retried.** When a write fails during an attempt, the delivery stays held and the step is tried again after 1 s, 5 s, 30 s, then every minute. The delay is configurable with a new `persistRetryMs` option.
- **The handler never runs twice.** If the handler had already run, only its saved outcome is written again. If the earlier write actually went through but reported an error, the retry sees that and treats the outcome as recorded. If the failed write was the one marking the attempt `running` and it did go through, the retry recognises the mark and runs the handler without counting a new attempt.
- **`release` keeps its reservation until the record is deleted.** A failed delete is retried in the background. **`answered` keeps the reservation until its update succeeds;** if the update fails it throws, and the receiver's existing catch then calls `release`, which now finds the reservation and gives the record back.
- **A runner now cleans up its own lost records.** Each heartbeat marks failed any unfinished record this runner owns but no longer holds or has reserved. It skips this while a reservation is being written, because that new record may not be tracked yet.
- **Shutdown and tests:** `stop()` cancels pending release retries, and `idle()` now also waits for write retries and releases in progress.

I also added a paragraph on this to `docs/docs/architecture/plugin-runtime.md`.

**Tests:** four new regressions in `packages/core/test/pluginWebhooks.test.ts`. They wrap the runner's database so chosen writes fail once, either before the write or after it went through:
- the final outcome write and the `retrying` write fail: the handler still ran once per attempt and the delivery ends `succeeded`.
- the `running` mark fails, in both modes: the handler runs once, as attempt 1.
- a release delete fails on the paused (503) path and an answered-challenge update fails: the sender's resend is delivered or answered, with no 409 and no unfinished record left.
- an unfinished record this runner owns but doesn't hold is marked failed, and the delivery it does hold is left alone.

All four fail when I put the old runner back. All 19 tests in `pluginWebhooks.test.ts` pass, as do `pluginStore` and `pluginContributions` (25 tests) and `pluginWebhookRoutes.test.ts` in the API package. Core typecheck is clean, and so is the zero-warning lint on the runner. In a typecheck of the test file alone, the only errors were missing type declarations for the migration files the shared fixture imports, none in the test file.

**Two cases that still can't be fully fixed:**
- If the challenge answer's write goes through but reports an error, the sender gets a 500, and resending the same delivery id gets a 409. There's no way to tell from the error whether the write landed.
- If release deletes keep failing until shutdown, the record isn't cleaned up by this runner. After the runner stops, another runner marks it failed on its next heartbeat.

I found no other problems outside F8. There's nothing visible to users, so I made no preview.

PR: #3579
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements inbound webhook verification, delivery tracking, challenge responses, and administration UI with substantial focused coverage. It needs changes before merge because failed deliveries cannot be redelivered as documented, and delivery-ID configuration can cause credentials to be stored.

✅ Verification before execution — Signature checks and delivery-ID reservation precede responder loading and handler execution.

✅ Failure-path coverage — Tests cover concurrent capacity limits, multiple runners, rejected asynchronous responders, and database writes that commit but report failure.

✅ Restricted diagnostics — Webhook delivery records discard handler-generated log messages, fields, and error text.

The supplied current-head status has no failed checks and five pending checks. This review used static analysis only; no commands were run.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F9: 🔴 Failed deliveries cannot be redelivered

  • Category: correctness

  • Required behavior: The documented recovery path says that the sending service can resend a failed webhook because its request is not retained and Activity cannot retry it.

  • Evidence: packages/core/src/plugins/pluginWebhookRunner.ts, stop, recoverStopped, and reserve; docs/docs/features/plugins.md, “Delivery”.

    1. A verified request carrying a sender delivery ID receives 202 and creates its unique delivery record.
    2. The API stops before the scheduled handler executes. Shutdown or subsequent recovery marks that record failed, and the in-memory request is lost.
    3. The sender redelivers the request with its original delivery ID.
    4. reserve unconditionally ignores conflicts on (plugin_id, delivery_id) and returns duplicate; the receiver answers 409 without executing the handler.

    The request can therefore remain entirely undelivered even after an explicit sender retry. Its failed record blocks redelivery until retention removes it. Neither the recovery heartbeat nor the existing retry machinery reconstructs the lost request, and manual retry explicitly excludes webhooks. static trace: the terminal failure transitions retain the unique delivery ID, while reservation does not distinguish failed deliveries from successful ones.

  • Minimum fix: Provide an explicit recovery mechanism that permits a sender to redeliver a failed webhook, such as an administrator action that releases its failed delivery-ID reservation. Preserve replay rejection for successful and active deliveries, and document and test the recovery procedure.

F10: 🔴 Delivery IDs can persist authorization credentials

  • Category: security

  • Required behavior: Webhook credentials and authorization headers must not be stored or exposed through delivery records.

  • Evidence: packages/shared/src/plugins.ts, checkConnectionReferences; packages/core/src/plugins/pluginWebhooks.ts, senderDeliveryId; packages/core/src/plugins/pluginWebhookRunner.ts, reserve.

    1. A manifest declares verification through x-hook-token and sets deliveryIdHeader to authorization.
    2. Manifest validation accepts this: authorization is absent from RESERVED_WEBHOOK_HEADERS, and it differs from the verification header.
    3. A verified request includes Authorization: Bearer <credential> within the delivery-ID length limit.
    4. senderDeliveryId accepts that value, and reserve stores it verbatim inside delivery_id. Activity subsequently returns it through deliveryView.

    proxy-authorization has the same exposure. Removing these headers in handlerHeaders does not help: delivery-ID extraction and persistence happen separately, before that filtering. static trace: the schema permits both credential headers, the extractor accepts their printable values, and the insertion persists the resulting string without redaction.

  • Minimum fix: Reject authorization and proxy-authorization as delivery-ID headers while retaining authorization-header verification support. Add schema regression cases for both forbidden delivery-ID configurations.

Suggestions

These are optional follow-ups and are not sent to /fix.

S5: 🟢 Clarify responder isolation

The new documentation says that receiving no ctx means responders cannot send HTTP requests or access logs. These are trusted, in-process functions, and the documented import policy allows Node built-ins; withholding ctx does not sandbox them. Describe the guarantee as withholding ProPR’s scoped capabilities. This is optional documentation clarification within the existing trusted-plugin model.

Score

The implementation has substantial coverage and careful verification sequencing, but the recovery contradiction and credential-persistence path need correction. Pending checks are not themselves blockers.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 25s
  • Tokens: 112,759 (111,018 in / 1,741 out)
  • Cost: $1.07

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F9 F10 S5

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 336bcd2

Addressed 1 AI review comment (IDs: 6900787230)

Addressed findings F9, F10

Summary of Changes

I fixed F9 and F10, with regression tests for both. Each new test fails when I put the old code back and passes with the fix.

F9: a failed delivery can now be sent again. I made it automatic rather than adding an admin action. When a request carries the delivery ID of a failed webhook delivery, reserve deletes that failed record and inserts a new one in the same transaction. The request gets 202 and the handler runs. Deliveries that are pending, running, retrying or succeeded still get 409. The fix is in packages/core/src/plugins/pluginWebhookRunner.ts.

  • New record ID: the redelivery gets a new record rather than reusing the failed one. That matters when another API process (one whose heartbeat lapsed, so its delivery was failed) still holds the old record in memory. When it carries on, it finds no record and drops the delivery. Updating the failed row in place would have let that process mark the redelivery as its own.
  • Activity history: the failed attempt disappears from Activity; only the redelivery's record remains.
  • Replays: anyone holding a validly signed copy of a request whose delivery failed can now get its handler run again, just as the real sender's redelivery would. Successful and in-progress deliveries are still protected.
  • Unavoidable race: if a process is still running a handler after its heartbeat lapsed, a redelivery elsewhere can run the handler a second time. That window already existed with heartbeat recovery; I didn't try to close it.

If you'd rather require an admin to release a failed delivery before the sender resends, that's a different design and would need a new route.

F10: credential headers can't be delivery-ID headers.

  • Manifest check: a manifest that names authorization or proxy-authorization as its deliveryIdHeader is now rejected. Verifying with Authorization still works. The change is in packages/shared/src/plugins.ts.
  • Header extraction: senderDeliveryId now also ignores those headers, and the webhook's verification headers, so a credential can't end up stored even if a manifest skipped validation.

Tests:

  • In packages/core/test/pluginWebhooks.test.ts:
    • The API stops before the handler runs, and the redelivery is handled by the next process.
    • Pending, running, retrying and succeeded deliveries are still 409.
    • Two redeliveries arriving at once give one 202 and one 409.
    • A process still holding the old record changes nothing.
    • Credential and verification headers are never read as the delivery ID.
  • In packages/shared/test/plugins.test.ts, both forbidden delivery-ID headers are rejected (including when another header does the verifying), and authorization still works for verification.

Docs: both docs pages now describe resending a failed delivery and the delivery-ID header rule (docs/docs/features/plugins.md and docs/docs/architecture/plugin-runtime.md).

What I ran:

  • Pass: pluginWebhooks.test.ts (22 tests), shared/test/plugins.test.ts (14), pluginStore and pluginContributions (25), and the API pluginWebhookRoutes test after rebuilding core.
  • Clean: the core and shared typechecks, a typecheck of the changed core test file, and the zero-warning lint on the two changed core files.
  • Not linted: packages/shared isn't in any lint gate.

There's no visible UI change, so I didn't make previews.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (3 files)
    • packages/core/src/plugins/pluginWebhookRunner.ts (+6/−1)
    • packages/core/src/plugins/pluginWebhooks.ts (+8/−4)
    • packages/shared/src/plugins.ts (+7/−0)
  • Low risk (4 files)
    • docs/docs/architecture/plugin-runtime.md (+14/−3)
    • docs/docs/features/plugins.md (+9/−2)
    • packages/core/test/pluginWebhooks.test.ts (+86/−6)
    • packages/shared/test/plugins.test.ts (+5/−0)

Validation evidence

  • No repository validation commands ran.

Diff size: 7 files changed, +135/−16 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (high)
  • Requested By: @propr-ultrafix
  • Time: 8m 21s
  • Tokens: 2,773,958 (2,753,347 in / 20,611 out)
  • Cost: $1.47

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

…w test fails when I put the old code back and passes with the fix.

I fixed F9 and F10, with regression tests for both. Each new test fails when I put the old code back and passes with the fix.

**F9: a failed delivery can now be sent again.** I made it automatic rather than adding an admin action. When a request carries the delivery ID of a failed webhook delivery, `reserve` deletes that failed record and inserts a new one in the same transaction. The request gets 202 and the handler runs. Deliveries that are pending, running, retrying or succeeded still get 409. The fix is in `packages/core/src/plugins/pluginWebhookRunner.ts`.

- **New record ID:** the redelivery gets a new record rather than reusing the failed one. That matters when another API process (one whose heartbeat lapsed, so its delivery was failed) still holds the old record in memory. When it carries on, it finds no record and drops the delivery. Updating the failed row in place would have let that process mark the redelivery as its own.
- **Activity history:** the failed attempt disappears from Activity; only the redelivery's record remains.
- **Replays:** anyone holding a validly signed copy of a request whose delivery failed can now get its handler run again, just as the real sender's redelivery would. Successful and in-progress deliveries are still protected.
- **Unavoidable race:** if a process is still running a handler after its heartbeat lapsed, a redelivery elsewhere can run the handler a second time. That window already existed with heartbeat recovery; I didn't try to close it.

If you'd rather require an admin to release a failed delivery before the sender resends, that's a different design and would need a new route.

**F10: credential headers can't be delivery-ID headers.**
- **Manifest check:** a manifest that names `authorization` or `proxy-authorization` as its `deliveryIdHeader` is now rejected. Verifying with `Authorization` still works. The change is in `packages/shared/src/plugins.ts`.
- **Header extraction:** `senderDeliveryId` now also ignores those headers, and the webhook's verification headers, so a credential can't end up stored even if a manifest skipped validation.

**Tests:**
- In `packages/core/test/pluginWebhooks.test.ts`:
  - The API stops before the handler runs, and the redelivery is handled by the next process.
  - Pending, running, retrying and succeeded deliveries are still 409.
  - Two redeliveries arriving at once give one 202 and one 409.
  - A process still holding the old record changes nothing.
  - Credential and verification headers are never read as the delivery ID.
- In `packages/shared/test/plugins.test.ts`, both forbidden delivery-ID headers are rejected (including when another header does the verifying), and `authorization` still works for verification.

**Docs:** both docs pages now describe resending a failed delivery and the delivery-ID header rule (`docs/docs/features/plugins.md` and `docs/docs/architecture/plugin-runtime.md`).

**What I ran:**
- **Pass:** `pluginWebhooks.test.ts` (22 tests), `shared/test/plugins.test.ts` (14), `pluginStore` and `pluginContributions` (25), and the API `pluginWebhookRoutes` test after rebuilding core.
- **Clean:** the core and shared typechecks, a typecheck of the changed core test file, and the zero-warning lint on the two changed core files.
- **Not linted:** `packages/shared` isn't in any lint gate.

There's no visible UI change, so I didn't make previews.

PR: #3579
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements inbound webhook verification, delivery tracking, key rotation, and administration UI with substantial coverage. It needs a localized correctness fix before merge.

✅ Verification before execution — Signature checks and delivery reservations precede loading the responder or scheduling the handler.

✅ Delivery recovery coverage — Tests cover concurrent admission, stopped owners, redelivery, and database writes that fail before or after committing.

✅ Restricted diagnostics — Webhook delivery records discard handler-provided error text and log contents that could expose payloads.

This assessment is a static review; no commands or tests were run. The supplied current-head status has 30 passed checks, four pending, and no failures.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F11: 🔴 Preserve signed bytes before decompression

  • Category: correctness

  • Required behavior: HMAC verification must use the raw request body exactly as received, as specified by the verification contract.

  • Evidence: packages/api/routes/pluginWebhookRoutes.ts:22 — express.raw({ type: () => true, limit: ... }).

    1. An external sender compresses a payload with gzip, signs those transmitted bytes using the declared hmac-sha256 scheme, and sends it with Content-Encoding: gzip.
    2. express.raw uses its default inflation behavior, decompressing the request before assigning req.body.
    3. The route passes that decompressed buffer to PluginWebhookReceiver.receive; verifyPluginWebhook calculates the HMAC over different bytes from those signed.
    4. The valid request receives 401 and its handler never runs.

    The size limiter and constant-time comparison do not preserve the original bytes. Existing HTTP tests exercise JSON and form bodies without content encoding, so they do not cover this failure.

    static trace: the raw-parser configuration, route-to-receiver buffer transfer, and HMAC calculation in packages/core/src/plugins/pluginWebhooks.ts. No reproduction was executed.

  • Minimum fix: Preserve the transmitted body bytes for verification without automatic inflation. Apply any supported decompression separately after verification, with an appropriate size bound, and add an HTTP regression using a compressed body signed over its transmitted bytes.

Suggestions

These are optional follow-ups and are not sent to /fix.

S6: 🟢 Describe raw bodies in OpenAPI

The new receiver documentation in packages/api/openapi/routeDocsPlugins.ts describes arbitrary text and form bodies, but its generated request schema permits only an application/json object. Represent the supported content types and raw body shape so generated consumers reflect the endpoint. This is a documentation follow-up; the runtime already accepts uncompressed form and text requests.

S7: 🟢 Clarify responder capability claims

The new architecture documentation says that withholding ctx prevents outbound HTTP and state access. The same document explains that plugins are trusted, run in-process, and may import Node built-ins. Describe this as withholding SDK capabilities rather than enforcing isolation. No sandbox redesign is needed for the stated trusted-plugin model.

Score

The implementation and failure-path tests are substantial, but decompression before signature verification breaks the advertised raw-body contract. Pending checks alone do not lower the score further.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 19s
  • Tokens: 117,918 (116,133 in / 1,785 out)
  • Cost: $1.14

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F11 S6 S7

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 1d119e7

Addressed 1 AI review comment (IDs: 6901183643)

Addressed finding F11

Summary of Changes

I fixed F11. A gzip-compressed request signed over the bytes it actually sent now verifies and runs its handler, where before it got 401. I added an HTTP test and a core test for this. Both fail when I put the old route and receiver code back and pass with the fix.

What changed

  • Reading the body (packages/api/routes/pluginWebhookRoutes.ts): the route now keeps the body exactly as sent. The parser's own "don't inflate" option can't be used, because it answers 415 to any compressed body. So the route hides the Content-Encoding header while the parser reads the body, then puts it back. The 256 KiB limit and the 413 now apply to the bytes as sent.
  • Decoding after verification (decodePluginWebhookBody in pluginWebhooks.ts, called from pluginWebhookReceiver.ts): the signature is checked over the sent bytes first. Only then is a single gzip, x-gzip, deflate or br encoding decoded, and never to more than 256 KiB. A body that decodes past the limit gets 413, a corrupt one gets 400, and any other encoding, or more than one, gets 415.
    • An unverified request is never decompressed, so a compressed bomb can't cost anything before the signature check.
    • Decoding happens before the delivery id is reserved, so a refused body takes no delivery id and runs no plugin code.
  • Handler headers: content-encoding is no longer passed to handlers, because they get the decoded body.
  • Docs and API spec: plugins.md, plugin-runtime.md and the OpenAPI entry now describe this, including the new 415. I regenerated the spec; the client types didn't change.

Checking for the same mistake elsewhere: this route is the only place in the PR that reads a raw body for signature checks. Slack signatures, token headers and challenge responses all go through the same receiver, so they are covered too. The core test includes a deflate-compressed Slack challenge.

Tests

  • Core test: covers the gzip signature over the sent bytes, the handler getting the decoded body without content-encoding, and a signature over the decoded bytes getting 401. It also checks the bomb (413), corrupt (400) and unsupported or stacked encodings (415): none of them loads plugin code or takes a delivery id, and the refused id can be sent again. It also checks deflate and br decoding.
  • HTTP test: a real gzip request through Express gets 202 and the handler sees the decoded length. A signature over the decoded bytes gets 401, and a bomb gets 413 without loading any plugin code. The new requests pushed this test over its rate limit, so I raised the limit from 12 to 16; the 429 assertion still holds.

Test runs

  • Passing:
    • 48 of 48 in the core plugin suites (pluginWebhooks, pluginStore, pluginContributions).
    • The pluginWebhookRoutes and pluginActivityRoutes route tests.
    • The OpenAPI route-coverage test (16 of 16).
    • The core and API typechecks.
    • The zero-warning lint on the changed source and API test files.
    • The OpenAPI up-to-date check.
  • openapiResponseConformance: every test passed, but the process then hung at exit until the timeout killed it. That's a known pattern for API tests in this container.

This change isn't visible in the UI, so there are no previews.

Not changed: the existing GitHub POST /webhook route also lets the parser inflate the body before checking the signature. It predates this PR and isn't part of F11.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (4 files)
    • packages/api/openapi/routeDocsPlugins.ts (+4/−3)
    • packages/api/routes/pluginWebhookRoutes.ts (+16/−7)
    • packages/core/src/plugins/pluginWebhookReceiver.ts (+16/−5)
    • packages/core/src/plugins/pluginWebhooks.ts (+34/−2)
  • Low risk (5 files)
    • docs/docs/architecture/plugin-runtime.md (+16/−7)
    • docs/docs/features/plugins.md (+7/−4)
    • docs/static/openapi/propr-api.yaml (+9/−3)
    • packages/api/test/pluginWebhookRoutes.test.ts (+21/−4)
    • packages/core/test/pluginWebhooks.test.ts (+41/−1)

Validation evidence

  • No repository validation commands ran.

Diff size: 9 files changed, +164/−36 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (high)
  • Requested By: @propr-ultrafix
  • Time: 21m 47s
  • Tokens: 3,588,838 (3,588,410 in / 428 out)
  • Cost: $1.22
  • Subscription usage: Weekly +1%

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

…s it actually sent now verifies and runs its handler, where before it got 401. I added an HTTP test and a core test for this. Both fail when I put the old route and receiver code back and pass with the fix.

I fixed F11. A gzip-compressed request signed over the bytes it actually sent now verifies and runs its handler, where before it got 401. I added an HTTP test and a core test for this. Both fail when I put the old route and receiver code back and pass with the fix.

**What changed**
- **Reading the body** (`packages/api/routes/pluginWebhookRoutes.ts`): the route now keeps the body exactly as sent. The parser's own "don't inflate" option can't be used, because it answers 415 to any compressed body. So the route hides the `Content-Encoding` header while the parser reads the body, then puts it back. The 256 KiB limit and the 413 now apply to the bytes as sent.
- **Decoding after verification** (`decodePluginWebhookBody` in `pluginWebhooks.ts`, called from `pluginWebhookReceiver.ts`): the signature is checked over the sent bytes first. Only then is a single `gzip`, `x-gzip`, `deflate` or `br` encoding decoded, and never to more than 256 KiB. A body that decodes past the limit gets 413, a corrupt one gets 400, and any other encoding, or more than one, gets 415.
  - An unverified request is never decompressed, so a compressed bomb can't cost anything before the signature check.
  - Decoding happens before the delivery id is reserved, so a refused body takes no delivery id and runs no plugin code.
- **Handler headers:** `content-encoding` is no longer passed to handlers, because they get the decoded body.
- **Docs and API spec:** `plugins.md`, `plugin-runtime.md` and the OpenAPI entry now describe this, including the new 415. I regenerated the spec; the client types didn't change.

**Checking for the same mistake elsewhere:** this route is the only place in the PR that reads a raw body for signature checks. Slack signatures, token headers and challenge responses all go through the same receiver, so they are covered too. The core test includes a deflate-compressed Slack challenge.

**Tests**
- **Core test:** covers the gzip signature over the sent bytes, the handler getting the decoded body without `content-encoding`, and a signature over the decoded bytes getting 401. It also checks the bomb (413), corrupt (400) and unsupported or stacked encodings (415): none of them loads plugin code or takes a delivery id, and the refused id can be sent again. It also checks deflate and br decoding.
- **HTTP test:** a real gzip request through Express gets 202 and the handler sees the decoded length. A signature over the decoded bytes gets 401, and a bomb gets 413 without loading any plugin code. The new requests pushed this test over its rate limit, so I raised the limit from 12 to 16; the 429 assertion still holds.

**Test runs**
- **Passing:**
  - 48 of 48 in the core plugin suites (`pluginWebhooks`, `pluginStore`, `pluginContributions`).
  - The `pluginWebhookRoutes` and `pluginActivityRoutes` route tests.
  - The OpenAPI route-coverage test (16 of 16).
  - The core and API typechecks.
  - The zero-warning lint on the changed source and API test files.
  - The OpenAPI up-to-date check.
- **`openapiResponseConformance`:** every test passed, but the process then hung at exit until the timeout killed it. That's a known pattern for API tests in this container.

This change isn't visible in the UI, so there are no previews.

**Not changed:** the existing GitHub `POST /webhook` route also lets the parser inflate the body before checking the signature. It predates this PR and isn't part of F11.

PR: #3579
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements inbound webhook verification, queued delivery, challenge responses, administration, and UI support with substantial regression coverage. It needs a localized correctness fix before merge.

✅ Verification before execution — Signature checks and delivery reservation precede loading the responder or starting a handler.

✅ Bounded payload handling — The route limits transmitted bytes, and decompression happens after verification with a separate output limit.

✅ Privacy-conscious diagnostics — Webhook delivery records discard handler messages, fields, and error text that could contain request content.

This review used static analysis of the supplied diff and context; no commands ran. Current checks show 29 passed, five pending, and no failures.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F12: 🔴 Recover committed challenge acknowledgements

  • Category: correctness

  • Required behavior: A failed challenge response must permit redelivery; a database acknowledgement failure must not permanently consume the delivery ID without returning the challenge.

  • Evidence: packages/core/src/plugins/pluginWebhookRunner.ts, answered and giveBack; packages/core/src/plugins/pluginWebhookReceiver.ts, receive.

    1. A verified challenge with a sender delivery ID reserves a pending record, and its responder produces a valid challenge answer.
    2. answered() updates that record to succeeded, but the database operation reports an error after committing—the same failure mode explicitly handled by record() and exercised elsewhere in the added tests.
    3. Before the challenge is returned, receive() catches that error and calls release(). Its deletion requires status: 'pending', so it deletes nothing. Nevertheless, giveBack() removes the reservation from memory.
    4. The route returns 500. When the sender retries the challenge, reserve() finds the succeeded record and returns 409 before the responder runs. The sender cannot obtain its challenge answer using that delivery ID.

    static trace: The outcome-write reconciliation in record() does not cover answered(). Existing challenge persistence tests inject rejection before commit, while the after-commit failure test covers ordinary handler outcomes only. proposed regression: Inject an after-commit error into the challenge’s succeeded update and verify that the original request still receives its valid challenge response.

  • Minimum fix: Reconcile an errored answered() update against the owned record. If its challenge completion committed, finish returning the already-produced answer; otherwise retain the existing failure-and-release behavior.

Suggestions

These are optional follow-ups and are not sent to /fix.

S8: 🟢 Clarify responder isolation guarantees

The new documentation says that receiving no ctx prevents outbound HTTP or logging. However, the supplied runtime documentation explicitly permits Node built-ins and describes plugins as trusted, in-process code. Describe this as withholding SDK capabilities rather than enforcing purity or isolation. This clarification is optional because the implementation does satisfy the stated requirement to pass no ctx.

Score

The implementation has strong coverage and careful verification boundaries, but an ambiguous database acknowledgement can strand a challenge delivery. The remaining correction is localized; pending CI alone does not lower the score.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 57s
  • Tokens: 118,141 (116,947 in / 1,194 out)
  • Cost: $1.12

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F12 S8

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 1f0d1f3

Addressed 1 AI review comment (IDs: 6901676992)

Addressed finding F12

Summary of Changes

I fixed F12: when the write that records a challenge answer reports an error after it actually committed, the original request now still gets its challenge answer, where before it got a 500 and every retry got a 409. All 26 tests in pluginWebhooks.test.ts pass, including two new regression cases. Both fail when I put the old code back.

The fix (in packages/core/src/plugins/pluginWebhookRunner.ts; the receiver didn't need changes):

  • Answer write fails: answered() now reads the record back. If the record shows the answer committed, the answer stands and the receiver sends it. If the record is still pending, it behaves as before: it throws and the reservation is given back.
  • Record can't be read back: I also fixed this case, which the finding didn't mention. The delete in giveBack() only matched pending records, so a committed answer could still block the delivery id for good. It now also deletes the record when it holds an answer that was never sent. This is safe because only an answered() call that threw can leave a reserved record marked succeeded. So the request gets a 500 and the record is removed, and the sender's retry gets its answer.

Tests (new test "a challenge answer recorded although its write reported failure…"; I extended the failingWrites helper so it can also fail a read):

  • Answer committed: the write commits and then reports an error. The original request gets 200 challenge-k-1 and a replay gets 409. This fails with the old answered().
  • Answer committed but unreadable: the write commits and reports an error, then the read-back fails. The request rejects (500), the record is gone, the sender's retry is answered, and the next replay gets 409. This fails with only the old giveBack() restored.
  • The existing case where the write fails before committing still passes unchanged.

Other checks:

  • pluginWebhookRoutes, pluginStore and pluginContributions pass after rebuilding the core dist that the API test imports.
  • Core typecheck is clean. The changed test file only shows TS7016 errors from the unchanged fixture helper's JS migration imports.
  • The zero-warning lint on the runner is clean.
  • I added a short paragraph on the new behaviour to docs/docs/architecture/plugin-runtime.md.

Similar code I checked:

  • Already covered: outcome writes (record()) and the running mark already handle this failure mode.
  • Recovers on its own: the "plugin disabled" and "runner closed" writes either converge on retry or leave the record failed, so the sender can deliver again.

Separate observations, not changed:

  • Reservation insert: if the transaction in reserve() commits but reports an error, the record stays pending and isn't tracked in memory. The sender gets a 500, and retries get 409 until the next heartbeat (30 s by default) marks it failed. After that a redelivery works. This existed before this change.
  • Remaining gap: the answer write's reply is lost, the read-back fails, and the delete keeps failing until the runner stops. In that case the answered record stays and that delivery id gets 409. This needs three database failures in a row, and I didn't try to close it.

There's no visual change, so I didn't create a preview.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (1 file)
    • packages/core/src/plugins/pluginWebhookRunner.ts (+16/−5)
  • Low risk (2 files)
    • docs/docs/architecture/plugin-runtime.md (+5/−0)
    • packages/core/test/pluginWebhooks.test.ts (+40/−6)

Validation evidence

  • No repository validation commands ran.

Diff size: 3 files changed, +61/−11 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (xhigh)
  • Requested By: @propr-ultrafix
  • Time: 8m 54s
  • Tokens: 2,209,465 (2,186,032 in / 23,433 out)
  • Cost: $1.40

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

… reports an error after it actually committed, the original request now still gets its challenge answer, where before it got a 500 and every retry got a 409. All 26 tests in `pluginWebhooks.test.ts` pass, including two new regression cases. Both fail when I put the old code back.

I fixed F12: when the write that records a challenge answer reports an error after it actually committed, the original request now still gets its challenge answer, where before it got a 500 and every retry got a 409. All 26 tests in `pluginWebhooks.test.ts` pass, including two new regression cases. Both fail when I put the old code back.

**The fix** (in `packages/core/src/plugins/pluginWebhookRunner.ts`; the receiver didn't need changes):
- **Answer write fails:** `answered()` now reads the record back. If the record shows the answer committed, the answer stands and the receiver sends it. If the record is still pending, it behaves as before: it throws and the reservation is given back.
- **Record can't be read back:** I also fixed this case, which the finding didn't mention. The delete in `giveBack()` only matched pending records, so a committed answer could still block the delivery id for good. It now also deletes the record when it holds an answer that was never sent. This is safe because only an `answered()` call that threw can leave a reserved record marked succeeded. So the request gets a 500 and the record is removed, and the sender's retry gets its answer.

**Tests** (new test "a challenge answer recorded although its write reported failure…"; I extended the `failingWrites` helper so it can also fail a read):
- **Answer committed:** the write commits and then reports an error. The original request gets `200 challenge-k-1` and a replay gets 409. This fails with the old `answered()`.
- **Answer committed but unreadable:** the write commits and reports an error, then the read-back fails. The request rejects (500), the record is gone, the sender's retry is answered, and the next replay gets 409. This fails with only the old `giveBack()` restored.
- The existing case where the write fails before committing still passes unchanged.

**Other checks:**
- `pluginWebhookRoutes`, `pluginStore` and `pluginContributions` pass after rebuilding the core `dist` that the API test imports.
- Core typecheck is clean. The changed test file only shows TS7016 errors from the unchanged fixture helper's JS migration imports.
- The zero-warning lint on the runner is clean.
- I added a short paragraph on the new behaviour to `docs/docs/architecture/plugin-runtime.md`.

**Similar code I checked:**
- **Already covered:** outcome writes (`record()`) and the running mark already handle this failure mode.
- **Recovers on its own:** the "plugin disabled" and "runner closed" writes either converge on retry or leave the record failed, so the sender can deliver again.

**Separate observations, not changed:**
- **Reservation insert:** if the transaction in `reserve()` commits but reports an error, the record stays pending and isn't tracked in memory. The sender gets a 500, and retries get 409 until the next heartbeat (30 s by default) marks it failed. After that a redelivery works. This existed before this change.
- **Remaining gap:** the answer write's reply is lost, the read-back fails, and the delete keeps failing until the runner stops. In that case the answered record stays and that delivery id gets 409. This needs three database failures in a row, and I didn't try to close it.

There's no visual change, so I didn't create a preview.

PR: #3579
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements authenticated inbound plugin webhooks, queued delivery, installation-key management, and the corresponding UI and documentation. No merge-blocking defect was verified from the supplied diff and surrounding context. Merge readiness is conditional on the five pending checks completing successfully.

✅ Verification before execution — Signature verification, bounded decompression, and delivery-ID reservation precede responder or handler execution.

✅ Recovery coverage — Tests cover concurrent admission, stopped runners, redelivery, and database writes that commit but report failure.

✅ Request-safe diagnostics — Webhook delivery records discard handler-written messages, fields, and error text; sentinel tests exercise this behavior.

This was a static review only; no commands or tests were run. The supplied current-head status reports 29 passed checks, five pending, and no failures.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S9: 🟢 Clarify sender redelivery expectations

In docs/docs/features/plugins.md, qualify “Most services redeliver on their own.” Once ProPR returns 202, a sender cannot observe a subsequent process crash or handler failure. Explain that recovery may require manual redelivery or sender-specific reconciliation. This is an optional clarification of the explicitly documented memory-only delivery model.

S10: 🟢 Clarify responder trust boundaries

In docs/docs/architecture/plugin-runtime.md, distinguish withholding ctx from sandboxing. Responders receive no SDK capabilities, but they execute in-process as trusted code, and the documented import rules allow Node built-ins. Saying they cannot perform outbound HTTP or logging overstates the enforced boundary. The required absence of a ctx argument is implemented and tested.

Score

The implementation has substantial coverage of verification, privacy, lifecycle, and persistence failures, with no verified blocker. Pending CI and the absence of independently executed validation limit confidence.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 57s
  • Tokens: 118,739 (117,571 in / 1,168 out)
  • Cost: $1.11

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S9 S10

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 15, 2026
@propr-dev

propr-dev Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

ℹ️ GitHub auto-merge is turned off for this repository, so ProPR merges this PR itself once it is ready (checks passed or no CI configured, and the review goal met).

To let GitHub merge it the moment required checks pass, enable Settings → General → Pull Requests → Allow auto-merge.

@propr-dev
propr-dev Bot merged commit 7cce4c1 into 3542-epic-plugin-system-xu8 Nov 15, 2026
50 checks passed
@propr-dev
propr-dev Bot deleted the 3550/claude-opus-5-5-plugin-inbound-webhooks-v-20261115-1755-x67 branch November 15, 2026 22:03
@propr-dev propr-dev Bot changed the title 🔨 [3550 by Claude Opus 5.5] Plugin inbound webhooks: verified endpoints that call a handler [3550 by Claude Opus 5.5] Plugin inbound webhooks: verified endpoints that call a handler Nov 15, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 18, 2026
… call, and skip any label the PR already has. But I couldn't find a second labelling call in ProPR's code for the normal case, so this may not stop the duplicates you're seeing.

What the PR timelines show. I checked the last 80 PRs and 23 have `AI` added twice, in two patterns:
- Older PRs (#3579–#3711): `AI` and `llm-*` appear twice, 0–1 s apart. ProPR's retry waits at least 2 s, so a retry can't explain this.
- Newer PRs (#3712, #3717): `AI`, `ultrafix` and `llm-*` all appear again 2 s after `ultrafix` is added. No ProPR code adds those three together, and `ultrafix` was already on the PR.

Normal creation makes a single label call. The labels were already in place when the second set appeared. That suggests GitHub may record labels again on a PR it is still setting up, which ProPR can't prevent. I couldn't test that without making real PRs.

Code paths that could label twice, now fixed:
- Final validation: if a step after creation failed, the run lost track of the PR it had opened. Final validation then found that PR and labelled it again. Validation now records the labels the PR already has (`packages/core/src/utils/prValidation.ts`), so that second call sends nothing.
- Creation itself: in `src/jobs/issueJobHelpers.ts`, only the create request is now inside the `try`. Labelling happens once afterwards, so an error after labelling can no longer fall into the "find existing PR" path and label again.
- The other paths (existing PR found after a duplicate error, and the API retry in `src/jobs/issueJobPRRetry.ts`) use the same shared helper and skip labels GitHub already lists on the PR.
- The shared helper in `src/jobs/pullRequestProcessingLabels.ts` now sends only the missing labels, and makes no call at all when nothing is missing.

Tests
- A new file, `test/pullRequestCreationLabels.test.ts`, checks that each creation path makes exactly one label call. It also checks that labels already on the PR aren't re-sent, and that a failed label call isn't repeated through the existing-PR fallback.
- I added cases to `test/recoveredPullRequestLabels.test.ts` covering final validation and the API retry when the PR already has some or all of its labels.
- Against the original `issueJobHelpers.ts`, 2 of the 5 new creation-path tests fail. The single-call tests also pass on the old code, because it already made one call per path.
- The suites that touch these files ran 508 tests with 507 passing and 0 failing. Typecheck is clean for the root and core packages, and lint is clean on the changed source files.

If the duplicates continue after this ships, the next step is to compare ProPR's worker log for one affected PR with its timeline. Two "Added processing labels" log lines would mean ProPR sent two calls; one would mean the duplicate comes from GitHub.

The change isn't visible on screen, so there are no previews.
integry pushed a commit that referenced this pull request Nov 18, 2026
…hen a PR is created (#3721)

What the PR timelines show. I checked the last 80 PRs and 23 have `AI` added twice, in two patterns:
- Older PRs (#3579–#3711): `AI` and `llm-*` appear twice, 0–1 s apart. ProPR's retry waits at least 2 s, so a retry can't explain this.
- Newer PRs (#3712, #3717): `AI`, `ultrafix` and `llm-*` all appear again 2 s after `ultrafix` is added. No ProPR code adds those three together, and `ultrafix` was already on the PR.

Normal creation makes a single label call. The labels were already in place when the second set appeared. That suggests GitHub may record labels again on a PR it is still setting up, which ProPR can't prevent. I couldn't test that without making real PRs.

Code paths that could label twice, now fixed:
- Final validation: if a step after creation failed, the run lost track of the PR it had opened. Final validation then found that PR and labelled it again. Validation now records the labels the PR already has (`packages/core/src/utils/prValidation.ts`), so that second call sends nothing.
- Creation itself: in `src/jobs/issueJobHelpers.ts`, only the create request is now inside the `try`. Labelling happens once afterwards, so an error after labelling can no longer fall into the "find existing PR" path and label again.
- The other paths (existing PR found after a duplicate error, and the API retry in `src/jobs/issueJobPRRetry.ts`) use the same shared helper and skip labels GitHub already lists on the PR.
- The shared helper in `src/jobs/pullRequestProcessingLabels.ts` now sends only the missing labels, and makes no call at all when nothing is missing.

Tests
- A new file, `test/pullRequestCreationLabels.test.ts`, checks that each creation path makes exactly one label call. It also checks that labels already on the PR aren't re-sent, and that a failed label call isn't repeated through the existing-PR fallback.
- I added cases to `test/recoveredPullRequestLabels.test.ts` covering final validation and the API retry when the PR already has some or all of its labels.
- Against the original `issueJobHelpers.ts`, 2 of the 5 new creation-path tests fail. The single-call tests also pass on the old code, because it already made one call per path.
- The suites that touch these files ran 508 tests with 507 passing and 0 failing. Typecheck is clean for the root and core packages, and lint is clean on the changed source files.

If the duplicates continue after this ships, the next step is to compare ProPR's worker log for one affected PR with its timeline. Two "Added processing labels" log lines would mean ProPR sent two calls; one would mean the duplicate comes from GitHub.

The change isn't visible on screen, so there are no previews.

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants