paperclip-github-plugin 0.17.6 → 0.17.7

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
@@ -85,7 +85,7 @@ A pull-request link may include `followThroughAssigneeAgentId`, an optional Pape
85
85
 
86
86
  The worker validates an explicit owner against the authoritative Paperclip agent service before writing the link. The agent must exist and belong to the authenticated company; missing and cross-company ids fail closed. Successful owner changes carry `followThroughAssigneeUpdatedAt` in the durable link and agent-tool changes remain visible in the existing issue interaction ledger.
87
87
 
88
- The owner is stored on the PR-link entity, so unrelated title/state refreshes, process restarts, and execution-state cleanup do not remove it. Old link records without the property remain valid and use the previous fallback behavior. For actionable direct-PR work, assignment precedence is: an active execution-state `returnAssignee`, the PR's durable follow-through owner, the configured company executor, then the configured default assignee. Red CI, unresolved review threads, trusted follow-up, and merge-conflict/action-required states assign and wake the selected owner. A healthy external-maintainer wait remains `in_review` and unassigned. Effective-state fingerprints include durable routing so unchanged polls neither repeat the mutation nor enqueue another wake.
88
+ The owner is stored on the PR-link entity, so unrelated title/state refreshes, process restarts, and execution-state cleanup do not remove it. Old link records without the property remain valid and use the previous fallback behavior. For actionable direct-PR work, assignment precedence is: an active execution-state `returnAssignee`, the PR's durable follow-through owner, the configured company executor, then the configured default assignee. Red CI, unresolved review threads, trusted follow-up, and merge-conflict/action-required states assign and wake the selected owner. A healthy external-maintainer wait remains `in_review` with no agent assignee; a human assignee is left in place, because a person parked on such an issue is the reviewer the work is waiting on. Effective-state fingerprints include durable routing so unchanged polls neither repeat the mutation nor enqueue another wake.
89
89
 
90
90
  ### Project pull request command center
91
91
 
@@ -203,7 +203,7 @@ Additional behavior:
203
203
  - Newly imported issues that finish sync in `todo` and are assigned to an agent enqueue an assignee wakeup so the agent can pick them up promptly.
204
204
  - For linked pull requests, GitHub Sync treats merge-conflict, behind-branch, blocked, draft, unstable merge states, and unresolved review threads as executor work, while merge-ready states such as `CLEAN` and `HAS_HOOKS` can move work into `in_review` when CI is green and review threads are resolved. If an issue is already `blocked` and GitHub reports only pending external merge requirements while CI is unfinished, sync preserves the external wait instead of waking an executor. A stale aggregate `CHANGES_REQUESTED` review decision alone does not move that maintainer wait back to active execution. Transient `UNKNOWN` mergeability also does not move an already `in_review` maintainer wait back to active execution when CI is green and review threads are resolved.
205
205
  - Imported issues that are already `blocked` stay `blocked` while any first-class `blockedBy` issue is still non-terminal, even if the linked GitHub pull request is otherwise green and review-ready.
206
- - When sync moves work into `in_review`, GitHub Sync first follows the Paperclip issue execution policy's current reviewer or approver when that stage is visible on the issue. If Paperclip exposes an internal review or approval stage but not yet the participant, the plugin falls back to the configured reviewer or approver handoff assignee. If the transition is only a healthy linked-PR wait with no visible internal review or approval stage, GitHub Sync leaves the issue unassigned so it can wait on normal maintainer review without waking an internal owner. An execution state explicitly marked `completed` contains historical stage and decision fields, not active routing: GitHub Sync clears that completed policy/state and the stale internal assignee atomically when restoring `done` to `in_review`, and it emits no assignment wakeup.
206
+ - When sync moves work into `in_review`, GitHub Sync first follows the Paperclip issue execution policy's current reviewer or approver when that stage is visible on the issue. If Paperclip exposes an internal review or approval stage but not yet the participant, the plugin falls back to the configured reviewer or approver handoff assignee. If the transition is only a healthy linked-PR wait with no visible internal review or approval stage, GitHub Sync leaves the issue unassigned so it can wait on normal maintainer review without waking an internal owner. An execution state explicitly marked `completed` contains historical stage and decision fields, not active routing: GitHub Sync clears that completed policy/state and the stale internal agent assignee atomically when restoring `done` to `in_review`, keeps any human assignee, and emits no assignment wakeup.
207
207
  - When sync moves work back into active execution, GitHub Sync first follows the Paperclip issue execution policy `returnAssignee` when it is available. Otherwise it uses the durable pull-request follow-through owner, then falls back to the configured executor handoff assignee and finally to the default imported assignee.
208
208
  - Sync-driven handoffs to agent assignees best-effort enqueue an explicit wakeup so the next reviewer, approver, or executor can pick the issue up even when their agent is not running heartbeats.
209
209
  - After applying a GitHub-derived state, GitHub Sync immediately stores a bounded fingerprint of the effective issue/PR condition (including head SHA, closure outcome, and the highest-priority actionable check/review/merge condition). While local Paperclip status, assignment, and execution metadata still match the desired state, the same fingerprint remains quiescent: sync does not repeat the transition, comment, or wake, including for `done`/`cancelled` closure outcomes and directly PR-linked issues. If local state later drifts under unchanged remote evidence, sync reconciles it through a drift-specific journal attempt and issues one required wake when the corrected state is actionable and agent-owned. Raw `UNKNOWN`/aggregate jitter that does not change the effective action cannot re-arm the transition. A changed effective fingerprint or a trusted new issue/PR/review comment bypasses suppression; untrusted comment-count changes do not. Status/comment watermarks advance only after their action succeeds. When a required assignee wake fails, the successful mutation and a bounded pending-wake record are already durable, so the next sync retries only the wake without repeating the status change or comment.
package/dist/manifest.js CHANGED
@@ -719,7 +719,7 @@ var COMPANY_METRIC_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/a
719
719
  var require2 = createRequire(import.meta.url);
720
720
  var packageJson = require2("../package.json");
721
721
  var SCHEDULE_TICK_CRON = "* * * * *";
722
- var MANIFEST_VERSION = "0.17.6"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
722
+ var MANIFEST_VERSION = "0.17.7"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
723
723
  var COMPANY_SECRET_REF_VALUE_SCHEMA = {
724
724
  anyOf: [
725
725
  { type: "string" },
package/dist/worker.js CHANGED
@@ -6430,6 +6430,10 @@ function normalizePaperclipIssueExecutionState(value) {
6430
6430
  ...lastDecisionOutcome !== null ? { lastDecisionOutcome } : {}
6431
6431
  };
6432
6432
  }
6433
+ function readPaperclipIssueAssigneeUserId(issue) {
6434
+ if (!issue) return null;
6435
+ return normalizeOptionalString2(issue.assigneeUserId) ?? null;
6436
+ }
6433
6437
  function getPaperclipIssueAssigneePrincipal(issue) {
6434
6438
  const record = issue;
6435
6439
  const assigneeAgentId = normalizeOptionalString2(record.assigneeAgentId);
@@ -10190,6 +10194,9 @@ async function updatePaperclipIssueState(ctx, params) {
10190
10194
  syncContext,
10191
10195
  nextAssignee
10192
10196
  });
10197
+ const liveIssue = await ctx.issues.get(issueId, companyId);
10198
+ const liveCurrentStatus = liveIssue?.status ?? currentStatus;
10199
+ const liveSyncContext = liveIssue ? getPaperclipIssueSyncContext(liveIssue) : syncContext;
10193
10200
  const issuePatch = {
10194
10201
  status: nextStatus,
10195
10202
  ...syncExecutionStatePatch !== void 0 ? { executionState: syncExecutionStatePatch } : {},
@@ -10205,7 +10212,7 @@ async function updatePaperclipIssueState(ctx, params) {
10205
10212
  }
10206
10213
  } else if (clearAssignee) {
10207
10214
  issuePatch.assigneeAgentId = null;
10208
- issuePatch.assigneeUserId = null;
10215
+ issuePatch.assigneeUserId = readPaperclipIssueAssigneeUserId(liveIssue) ?? (syncContext.assignee?.kind === "user" ? syncContext.assignee.id : null);
10209
10216
  }
10210
10217
  if (statusWillChange && !trimmedTransitionComment) {
10211
10218
  throw new Error("GitHub Sync refused to update a Paperclip issue status without an explanatory transition comment.");
@@ -10213,9 +10220,6 @@ async function updatePaperclipIssueState(ctx, params) {
10213
10220
  if (statusWillChange && typeof ctx.issues.createComment !== "function") {
10214
10221
  throw new Error("This Paperclip runtime does not expose issue comment creation, so GitHub Sync refused to update a Paperclip issue status without an explanatory comment.");
10215
10222
  }
10216
- const liveIssue = await ctx.issues.get(issueId, companyId);
10217
- const liveCurrentStatus = liveIssue?.status ?? currentStatus;
10218
- const liveSyncContext = liveIssue ? getPaperclipIssueSyncContext(liveIssue) : syncContext;
10219
10223
  const issuePatchAlreadyApplied = isPaperclipIssuePatchApplied({
10220
10224
  currentStatus: liveCurrentStatus,
10221
10225
  syncContext: liveSyncContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.17.6",
3
+ "version": "0.17.7",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",