paperclip-github-plugin 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -167,6 +167,7 @@ Only the worker reads it, and the token is never copied into plugin state or con
167
167
  - **Webhook deliveries fail with 502.** Releases before 0.20 read instance-wide config while handling a delivery, which Paperclip 2026.1117 refuses with `company context is required`. Upgrade the plugin.
168
168
  - **Upgrading to 0.21.** Webhook wakes now need the `issues.read`, `issues.create`, `issues.update`, `issues.wakeup`, `issues.orchestration.read` and `jobs.schedule` capabilities and no longer use `agents.invoke`. Approve the new capabilities when Paperclip asks during the upgrade, or wakes fail and deliveries show as failed.
169
169
  - **A wake issue is blocked.** The agent was woken 3 times and no run succeeded. Read the issue's runs, fix the cause, then set the issue back to `todo` and it is woken on the next sweep.
170
+ - **Deliveries fail with `Rate limit exceeded for secret resolution`.** Releases before 0.21.1 resolved the webhook secret on every delivery, and Paperclip allows 30 a minute per company. Upgrade, then redeliver the failed `completed` deliveries from the App's delivery log.
170
171
  - **No agent wakes.** In the App's delivery log on GitHub, check the delivery got a 2xx. Then check the company has a webhook secret (the settings page shows **Secret saved**), the App is subscribed to the route's events, and the route's filters match. Comment routes need an `@<app slug>` mention unless `requireMention` is `false`.
171
172
  - **Tools fail with `deny_default`.** No tool profile grants the tool to that agent. See [Granting the tools to agents](#granting-the-tools-to-agents).
172
173
  - **`Secret is not bound to plugin` or `Invalid secret reference for plugin`.** The company's plugin config still holds a pre-2026.831 bare secret id. Open the settings page in that company so it re-saves the reference as a binding, or save the credentials again.
package/dist/manifest.js CHANGED
@@ -821,7 +821,7 @@ var GITHUB_WEBHOOK_ENDPOINT_KEY = "github";
821
821
  // src/manifest.ts
822
822
  var require2 = createRequire(import.meta.url);
823
823
  var packageJson = require2("../package.json");
824
- var MANIFEST_VERSION = "0.21.0"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
824
+ var MANIFEST_VERSION = "0.21.1"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
825
825
  var COMPANY_SECRET_REF_VALUE_SCHEMA = {
826
826
  anyOf: [
827
827
  { type: "string" },
package/dist/worker.js CHANGED
@@ -2261,12 +2261,24 @@ function readCompanyScopedConfigValue(config, key, companyId) {
2261
2261
  const map = config[key];
2262
2262
  return isPlainRecord(map) ? map[companyId] : void 0;
2263
2263
  }
2264
+ var PLUGIN_SECRET_CACHE_TTL_MS = 5 * 60 * 1e3;
2265
+ var resolvedPluginSecrets = /* @__PURE__ */ new Map();
2266
+ function clearResolvedPluginSecrets() {
2267
+ resolvedPluginSecrets.clear();
2268
+ }
2264
2269
  async function resolvePluginSecret(ctx, secretId, options = {}) {
2265
2270
  const companyId = normalizeCompanyId(options.companyId);
2266
- return ctx.secrets.resolve(toSecretRefBinding(secretId), {
2271
+ const cacheKey = JSON.stringify([companyId ?? null, options.configPath ?? null, secretId]);
2272
+ const cached = resolvedPluginSecrets.get(cacheKey);
2273
+ if (cached && cached.expiresAt > Date.now()) {
2274
+ return cached.value;
2275
+ }
2276
+ const value = await ctx.secrets.resolve(toSecretRefBinding(secretId), {
2267
2277
  ...companyId ? { companyId } : {},
2268
2278
  ...options.configPath ? { configPath: options.configPath } : {}
2269
2279
  });
2280
+ resolvedPluginSecrets.set(cacheKey, { value, expiresAt: Date.now() + PLUGIN_SECRET_CACHE_TTL_MS });
2281
+ return value;
2270
2282
  }
2271
2283
  function normalizeGitHubLowercaseString(value) {
2272
2284
  if (typeof value !== "string") {
@@ -2509,6 +2521,11 @@ async function handleGitHubWebhook(ctx, input) {
2509
2521
  if (!installationId) {
2510
2522
  throw new Error("GitHub webhook delivery has no App installation. Deliveries must come from a GitHub App.");
2511
2523
  }
2524
+ const ci = describeGitHubCiCompletion(headers.event, payload);
2525
+ const directSubject = ci ? void 0 : describeGitHubEvent(headers.event, payload);
2526
+ if (!ci && !directSubject && headers.event !== "ping") {
2527
+ return;
2528
+ }
2512
2529
  const { companies, candidates } = await resolveVerifiedGitHubWebhookCompanies(
2513
2530
  ctx,
2514
2531
  installationId,
@@ -2522,11 +2539,6 @@ async function handleGitHubWebhook(ctx, input) {
2522
2539
  ctx.logger.info("GitHub App webhook verified.", { installationId, companies: companies.map((company) => company.companyId) });
2523
2540
  return;
2524
2541
  }
2525
- const ci = describeGitHubCiCompletion(headers.event, payload);
2526
- const directSubject = ci ? void 0 : describeGitHubEvent(headers.event, payload);
2527
- if (!ci && !directSubject) {
2528
- return;
2529
- }
2530
2542
  const failures = [];
2531
2543
  for (const company of companies) {
2532
2544
  const routes = company.routes.filter((route) => ci ? route.event === "ci_completed" : route.event !== "ci_completed");
@@ -5528,6 +5540,7 @@ var plugin = definePlugin({
5528
5540
  const companyId = normalizeCompanyId(context?.companyId) ?? null;
5529
5541
  rememberTrustedConfig(companyId, newConfig);
5530
5542
  clearGitHubRepositoryTokenCapabilityAudits();
5543
+ clearResolvedPluginSecrets();
5531
5544
  pluginRuntimeContext?.logger.debug("The GitHub plugin received company-scoped plugin config.", {
5532
5545
  companyId,
5533
5546
  configKeys: Object.keys(isPlainRecord(newConfig) ? newConfig : {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "Paperclip plugin that gives agents a GitHub App identity, GitHub tools, webhook wakes and shared memory.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",