paperclip-github-plugin 0.15.2 → 0.15.3
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 +2 -0
- package/dist/manifest.js +1 -1
- package/dist/worker.js +219 -84
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,8 @@ If a company already has a Paperclip project bound to a GitHub repository worksp
|
|
|
63
63
|
|
|
64
64
|
The plugin does more than mirror issue text. It looks at linked pull requests, mergeability, CI, review decisions, review threads, and trusted new GitHub comments so imported Paperclip issues can reflect where the work actually is. When GitHub links an issue to a pull request in another repository, GitHub Sync now follows that pull request's actual repository for status checks, review state, and deep links instead of assuming the issue repository. When sync closes an imported issue as `done` or `cancelled`, it also clears any pending Paperclip review or approval execution policy/state so the host accepts the terminal transition cleanly and does not keep waking stale review participants.
|
|
65
65
|
|
|
66
|
+
Sync-driven transitions use a phase-aware durable action journal keyed by a fixed-length hash of the Paperclip issue, effective remote action, comment watermarks, and target state. A retry reuses an already completed explanatory comment or issue mutation instead of repeating it. If the worker can see an intent but cannot prove whether the corresponding side effect completed, it fails closed for operator reconciliation rather than risking a duplicate comment or status write.
|
|
67
|
+
|
|
66
68
|
### Company KPI dashboard
|
|
67
69
|
|
|
68
70
|
GitHub Sync exposes a dedicated KPI dashboard widget alongside the operational sync widget. During full company syncs, the worker snapshots the current open GitHub backlog and records when already-imported GitHub issues move from open to closed. The KPI widget turns that worker-owned state into backlog, issue-closure, and Paperclip PR-creation cards with recent history and comparisons against older periods.
|
package/dist/manifest.js
CHANGED
|
@@ -675,7 +675,7 @@ var COMPANY_METRIC_API_ROUTE_URL_PATH = `/api/plugins/${GITHUB_SYNC_PLUGIN_ID}/a
|
|
|
675
675
|
var require2 = createRequire(import.meta.url);
|
|
676
676
|
var packageJson = require2("../package.json");
|
|
677
677
|
var SCHEDULE_TICK_CRON = "* * * * *";
|
|
678
|
-
var MANIFEST_VERSION = "0.15.
|
|
678
|
+
var MANIFEST_VERSION = "0.15.3"?.trim() || typeof packageJson.version === "string" && packageJson.version.trim() || process.env.npm_package_version?.trim() || "0.0.0-dev";
|
|
679
679
|
var manifest = {
|
|
680
680
|
id: GITHUB_SYNC_PLUGIN_ID,
|
|
681
681
|
apiVersion: 1,
|
package/dist/worker.js
CHANGED
|
@@ -1163,7 +1163,7 @@ function buildIssueInteractionSummary(input) {
|
|
|
1163
1163
|
const timestamp = Date.parse(entry.occurredAt);
|
|
1164
1164
|
return timestamp >= fromMs && timestamp < toMs;
|
|
1165
1165
|
}).sort((left, right) => left.occurredAt.localeCompare(right.occurredAt) || left.dedupeKey.localeCompare(right.dedupeKey));
|
|
1166
|
-
const resultDedupeBases = new Set(events.filter((entry) => entry.dedupeKey
|
|
1166
|
+
const resultDedupeBases = new Set(events.filter((entry) => /:result(?::(?:changed|noop|failed))?$/.test(entry.dedupeKey)).map((entry) => entry.dedupeKey.replace(/:result(?::(?:changed|noop|failed))?$/, "")));
|
|
1167
1167
|
const uncertainAttempts = events.filter((entry) => entry.outcome === "observed" && entry.dedupeKey.endsWith(":intent") && !resultDedupeBases.has(entry.dedupeKey.slice(0, -":intent".length)));
|
|
1168
1168
|
const runIds = new Set(events.map((entry) => entry.actor?.runId).filter((value) => Boolean(value)));
|
|
1169
1169
|
const actionCounts = /* @__PURE__ */ new Map();
|
|
@@ -1474,6 +1474,11 @@ var SyncCancellationError = class extends Error {
|
|
|
1474
1474
|
this.requestedAt = requestedAt;
|
|
1475
1475
|
}
|
|
1476
1476
|
};
|
|
1477
|
+
function canonicalizeGitHubPullRequestCommentCounts(records) {
|
|
1478
|
+
return [...records].sort(
|
|
1479
|
+
(left, right) => left.repositoryUrl.localeCompare(right.repositoryUrl) || left.number - right.number
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1477
1482
|
var SUCCESSFUL_CHECK_RUN_CONCLUSIONS = /* @__PURE__ */ new Set(["SUCCESS", "NEUTRAL", "SKIPPED"]);
|
|
1478
1483
|
var FAILED_CHECK_RUN_CONCLUSIONS = /* @__PURE__ */ new Set([
|
|
1479
1484
|
"ACTION_REQUIRED",
|
|
@@ -9657,12 +9662,14 @@ async function updatePaperclipIssueState(ctx, params) {
|
|
|
9657
9662
|
clearExecutionPolicy,
|
|
9658
9663
|
transitionComment,
|
|
9659
9664
|
transitionCommentAnnotation,
|
|
9665
|
+
actionFingerprint,
|
|
9660
9666
|
paperclipApiBaseUrl
|
|
9661
9667
|
} = params;
|
|
9662
9668
|
const trimmedTransitionComment = transitionComment.trim();
|
|
9663
|
-
|
|
9669
|
+
let interactionOccurredAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
9664
9670
|
const statusWillChange = currentStatus !== nextStatus;
|
|
9665
9671
|
let createdTransitionComment = null;
|
|
9672
|
+
let transitionCommentComplete = false;
|
|
9666
9673
|
let issueUpdated = false;
|
|
9667
9674
|
const syncExecutionStatePatch = buildSyncFallbackExecutionStatePatch({
|
|
9668
9675
|
currentStatus,
|
|
@@ -9694,7 +9701,27 @@ async function updatePaperclipIssueState(ctx, params) {
|
|
|
9694
9701
|
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.");
|
|
9695
9702
|
}
|
|
9696
9703
|
const reasonCode = classifyIssueInteractionReason(transitionCommentAnnotation?.reason ?? trimmedTransitionComment);
|
|
9697
|
-
const interactionDedupeBase = `sync:${
|
|
9704
|
+
const interactionDedupeBase = actionFingerprint ? `sync:${createHash("sha256").update(JSON.stringify({
|
|
9705
|
+
companyId,
|
|
9706
|
+
issueId,
|
|
9707
|
+
mutation: "status_transition",
|
|
9708
|
+
actionFingerprint,
|
|
9709
|
+
currentStatus,
|
|
9710
|
+
nextStatus
|
|
9711
|
+
})).digest("hex")}` : `sync:${issueId}:${interactionOccurredAt}:${currentStatus}:${nextStatus}`;
|
|
9712
|
+
let existingInteractionEvents = [];
|
|
9713
|
+
if (actionFingerprint) {
|
|
9714
|
+
const ledger = await listIssueInteractionEvents(ctx, companyId, issueId, {
|
|
9715
|
+
from: "1970-01-01T00:00:00.000Z",
|
|
9716
|
+
to: "9999-12-31T23:59:59.999Z"
|
|
9717
|
+
});
|
|
9718
|
+
if (ledger.integrity.malformedRows > 0 || ledger.integrity.conflictingKeys > 0 || ledger.integrity.scanTruncated) {
|
|
9719
|
+
throw new Error("GitHub Sync refused a status transition because its issue interaction ledger is incomplete or conflicting.");
|
|
9720
|
+
}
|
|
9721
|
+
existingInteractionEvents = ledger.events;
|
|
9722
|
+
const existingIntent = existingInteractionEvents.find((event) => event.dedupeKey === `${interactionDedupeBase}:intent`);
|
|
9723
|
+
if (existingIntent) interactionOccurredAt = existingIntent.occurredAt;
|
|
9724
|
+
}
|
|
9698
9725
|
await persistIssueInteractionEvent(ctx, {
|
|
9699
9726
|
schemaVersion: 1,
|
|
9700
9727
|
companyId,
|
|
@@ -9733,104 +9760,185 @@ async function updatePaperclipIssueState(ctx, params) {
|
|
|
9733
9760
|
} : {},
|
|
9734
9761
|
transition: { from: currentStatus, to: nextStatus, reasonCode },
|
|
9735
9762
|
outcome,
|
|
9736
|
-
dedupeKey: `${interactionDedupeBase}:result`
|
|
9763
|
+
dedupeKey: `${interactionDedupeBase}:result:${outcome}`
|
|
9764
|
+
});
|
|
9765
|
+
const persistMutationPhase = (outcome) => persistIssueInteractionEvent(ctx, {
|
|
9766
|
+
schemaVersion: 1,
|
|
9767
|
+
companyId,
|
|
9768
|
+
paperclipIssueId: issueId,
|
|
9769
|
+
occurredAt: interactionOccurredAt,
|
|
9770
|
+
category: "sync",
|
|
9771
|
+
action: "update_issue",
|
|
9772
|
+
source: "sync",
|
|
9773
|
+
...transitionCommentAnnotation ? {
|
|
9774
|
+
remote: {
|
|
9775
|
+
repositoryUrl: transitionCommentAnnotation.repositoryUrl,
|
|
9776
|
+
kind: "issue",
|
|
9777
|
+
number: transitionCommentAnnotation.githubIssueNumber,
|
|
9778
|
+
url: transitionCommentAnnotation.githubIssueUrl
|
|
9779
|
+
}
|
|
9780
|
+
} : {},
|
|
9781
|
+
outcome,
|
|
9782
|
+
dedupeKey: `${interactionDedupeBase}:mutation:${outcome === "observed" ? "intent" : `result:${outcome}`}`
|
|
9737
9783
|
});
|
|
9784
|
+
const priorMutationIntent = existingInteractionEvents.find((event) => event.dedupeKey === `${interactionDedupeBase}:mutation:intent`);
|
|
9785
|
+
const priorMutationChanged = existingInteractionEvents.find((event) => event.dedupeKey === `${interactionDedupeBase}:mutation:result:changed`);
|
|
9786
|
+
const priorMutationFailed = existingInteractionEvents.find((event) => event.dedupeKey === `${interactionDedupeBase}:mutation:result:failed`);
|
|
9787
|
+
let mutationAttemptStarted = false;
|
|
9788
|
+
let mutationReturned = false;
|
|
9789
|
+
let mutationComplete = Boolean(priorMutationChanged);
|
|
9738
9790
|
try {
|
|
9739
9791
|
if (statusWillChange) {
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9792
|
+
const commentIntentKey = `${interactionDedupeBase}:comment:intent`;
|
|
9793
|
+
const commentChangedKey = `${interactionDedupeBase}:comment:result:changed`;
|
|
9794
|
+
const priorCommentIntent = existingInteractionEvents.find((event) => event.dedupeKey === commentIntentKey);
|
|
9795
|
+
const priorCommentChanged = existingInteractionEvents.find((event) => event.dedupeKey === commentChangedKey);
|
|
9796
|
+
if (priorCommentChanged) {
|
|
9797
|
+
transitionCommentComplete = true;
|
|
9798
|
+
} else if (priorCommentIntent) {
|
|
9799
|
+
throw new Error("GitHub Sync refused to repeat an uncertain transition comment; reconcile the durable interaction intent before retrying.");
|
|
9800
|
+
} else {
|
|
9801
|
+
const commentEventBase = {
|
|
9802
|
+
schemaVersion: 1,
|
|
9803
|
+
companyId,
|
|
9804
|
+
paperclipIssueId: issueId,
|
|
9805
|
+
occurredAt: interactionOccurredAt,
|
|
9806
|
+
category: "comment",
|
|
9807
|
+
action: "add_issue_comment",
|
|
9808
|
+
source: "sync",
|
|
9809
|
+
...transitionCommentAnnotation ? {
|
|
9810
|
+
remote: {
|
|
9811
|
+
repositoryUrl: transitionCommentAnnotation.repositoryUrl,
|
|
9812
|
+
kind: "issue",
|
|
9813
|
+
number: transitionCommentAnnotation.githubIssueNumber,
|
|
9814
|
+
url: transitionCommentAnnotation.githubIssueUrl
|
|
9815
|
+
}
|
|
9816
|
+
} : {}
|
|
9817
|
+
};
|
|
9818
|
+
await persistIssueInteractionEvent(ctx, {
|
|
9819
|
+
...commentEventBase,
|
|
9820
|
+
outcome: "observed",
|
|
9821
|
+
dedupeKey: commentIntentKey
|
|
9761
9822
|
});
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
if (
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
);
|
|
9771
|
-
} catch (error) {
|
|
9772
|
-
issueUpdated = false;
|
|
9773
|
-
ctx.logger.warn("GitHub sync could not clear Paperclip issue execution state after the local API update. Falling back to direct issue mutation.", {
|
|
9823
|
+
try {
|
|
9824
|
+
createdTransitionComment = await ctx.issues.createComment(issueId, trimmedTransitionComment, companyId);
|
|
9825
|
+
if (transitionCommentAnnotation) {
|
|
9826
|
+
await upsertStatusTransitionCommentAnnotation(ctx, {
|
|
9827
|
+
issueId,
|
|
9828
|
+
commentId: createdTransitionComment.id,
|
|
9829
|
+
annotation: {
|
|
9830
|
+
...transitionCommentAnnotation,
|
|
9774
9831
|
companyId,
|
|
9775
|
-
issueId
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
error: getErrorMessage(error)
|
|
9779
|
-
});
|
|
9780
|
-
}
|
|
9832
|
+
paperclipIssueId: issueId
|
|
9833
|
+
}
|
|
9834
|
+
});
|
|
9781
9835
|
}
|
|
9836
|
+
await persistIssueInteractionEvent(ctx, {
|
|
9837
|
+
...commentEventBase,
|
|
9838
|
+
outcome: "changed",
|
|
9839
|
+
dedupeKey: commentChangedKey
|
|
9840
|
+
});
|
|
9841
|
+
transitionCommentComplete = true;
|
|
9842
|
+
} catch (error) {
|
|
9843
|
+
await persistIssueInteractionEvent(ctx, {
|
|
9844
|
+
...commentEventBase,
|
|
9845
|
+
outcome: "failed",
|
|
9846
|
+
dedupeKey: `${interactionDedupeBase}:comment:result:failed`
|
|
9847
|
+
});
|
|
9848
|
+
throw error;
|
|
9782
9849
|
}
|
|
9783
|
-
|
|
9850
|
+
}
|
|
9851
|
+
}
|
|
9852
|
+
if (!mutationComplete) {
|
|
9853
|
+
if (priorMutationIntent && !priorMutationFailed) {
|
|
9854
|
+
throw new Error("GitHub Sync refused to repeat an uncertain issue mutation; reconcile the durable mutation intent before retrying.");
|
|
9855
|
+
}
|
|
9856
|
+
await persistMutationPhase("observed");
|
|
9857
|
+
mutationAttemptStarted = true;
|
|
9858
|
+
if (paperclipApiBaseUrl) {
|
|
9859
|
+
try {
|
|
9860
|
+
const response = await fetchPaperclipApi(
|
|
9861
|
+
getPaperclipIssueEndpoint(paperclipApiBaseUrl, issueId),
|
|
9862
|
+
{
|
|
9863
|
+
method: "PATCH",
|
|
9864
|
+
headers: {
|
|
9865
|
+
accept: "application/json",
|
|
9866
|
+
"content-type": "application/json"
|
|
9867
|
+
},
|
|
9868
|
+
body: JSON.stringify(issuePatch)
|
|
9869
|
+
},
|
|
9870
|
+
{
|
|
9871
|
+
companyId
|
|
9872
|
+
}
|
|
9873
|
+
);
|
|
9874
|
+
const payloadResult = await readPaperclipApiJsonResponse(response, {
|
|
9875
|
+
operationLabel: "issue update",
|
|
9876
|
+
bodyRequired: false
|
|
9877
|
+
});
|
|
9878
|
+
if (!payloadResult.failure) {
|
|
9879
|
+
issueUpdated = true;
|
|
9880
|
+
if (issuePatch.executionState === null && ctx.issues && typeof ctx.issues.update === "function") {
|
|
9881
|
+
try {
|
|
9882
|
+
await ctx.issues.update(
|
|
9883
|
+
issueId,
|
|
9884
|
+
{ executionState: null },
|
|
9885
|
+
companyId
|
|
9886
|
+
);
|
|
9887
|
+
} catch (error) {
|
|
9888
|
+
issueUpdated = false;
|
|
9889
|
+
ctx.logger.warn("GitHub sync could not clear Paperclip issue execution state after the local API update. Falling back to direct issue mutation.", {
|
|
9890
|
+
companyId,
|
|
9891
|
+
issueId,
|
|
9892
|
+
paperclipApiBaseUrl,
|
|
9893
|
+
nextStatus,
|
|
9894
|
+
error: getErrorMessage(error)
|
|
9895
|
+
});
|
|
9896
|
+
}
|
|
9897
|
+
}
|
|
9898
|
+
}
|
|
9899
|
+
if (payloadResult.failure && (payloadResult.failure.status ?? response.status) !== 404 && (payloadResult.failure.status ?? response.status) !== 405) {
|
|
9900
|
+
logPaperclipIssueStatusUpdateFailure(ctx, {
|
|
9901
|
+
companyId,
|
|
9902
|
+
issueId,
|
|
9903
|
+
paperclipApiBaseUrl,
|
|
9904
|
+
nextStatus,
|
|
9905
|
+
status: payloadResult.failure.status ?? response.status,
|
|
9906
|
+
errorMessage: payloadResult.failure.errorMessage
|
|
9907
|
+
});
|
|
9908
|
+
}
|
|
9909
|
+
} catch (error) {
|
|
9784
9910
|
logPaperclipIssueStatusUpdateFailure(ctx, {
|
|
9785
9911
|
companyId,
|
|
9786
9912
|
issueId,
|
|
9787
9913
|
paperclipApiBaseUrl,
|
|
9788
9914
|
nextStatus,
|
|
9789
|
-
|
|
9790
|
-
errorMessage: payloadResult.failure.errorMessage
|
|
9915
|
+
errorMessage: getErrorMessage(error)
|
|
9791
9916
|
});
|
|
9792
9917
|
}
|
|
9793
|
-
} catch (error) {
|
|
9794
|
-
logPaperclipIssueStatusUpdateFailure(ctx, {
|
|
9795
|
-
companyId,
|
|
9796
|
-
issueId,
|
|
9797
|
-
paperclipApiBaseUrl,
|
|
9798
|
-
nextStatus,
|
|
9799
|
-
errorMessage: getErrorMessage(error)
|
|
9800
|
-
});
|
|
9801
9918
|
}
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
ctx.logger.warn("GitHub sync could not reassign a Paperclip issue to a user without the local Paperclip API. Preserving the existing assignee.", {
|
|
9813
|
-
companyId,
|
|
9814
|
-
issueId,
|
|
9815
|
-
nextStatus,
|
|
9816
|
-
assigneeUserId: nextAssignee.id
|
|
9817
|
-
});
|
|
9818
|
-
}
|
|
9819
|
-
await ctx.issues.update(issueId, sdkIssuePatch, companyId);
|
|
9820
|
-
}
|
|
9821
|
-
if (createdTransitionComment) {
|
|
9822
|
-
if (transitionCommentAnnotation) {
|
|
9823
|
-
await upsertStatusTransitionCommentAnnotation(ctx, {
|
|
9824
|
-
issueId,
|
|
9825
|
-
commentId: createdTransitionComment.id,
|
|
9826
|
-
annotation: {
|
|
9827
|
-
...transitionCommentAnnotation,
|
|
9919
|
+
if (!issueUpdated) {
|
|
9920
|
+
const preserveExistingUserAssigneeWithoutLocalApi = nextAssignee?.kind === "user" && !paperclipApiBaseUrl;
|
|
9921
|
+
const sdkIssuePatch = {
|
|
9922
|
+
...issuePatch,
|
|
9923
|
+
...syncExecutionStatePatch !== void 0 ? { executionState: syncExecutionStatePatch } : {}
|
|
9924
|
+
};
|
|
9925
|
+
if (preserveExistingUserAssigneeWithoutLocalApi) {
|
|
9926
|
+
delete sdkIssuePatch.assigneeAgentId;
|
|
9927
|
+
delete sdkIssuePatch.assigneeUserId;
|
|
9928
|
+
ctx.logger.warn("GitHub sync could not reassign a Paperclip issue to a user without the local Paperclip API. Preserving the existing assignee.", {
|
|
9828
9929
|
companyId,
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9930
|
+
issueId,
|
|
9931
|
+
nextStatus,
|
|
9932
|
+
assigneeUserId: nextAssignee.id
|
|
9933
|
+
});
|
|
9934
|
+
}
|
|
9935
|
+
await ctx.issues.update(issueId, sdkIssuePatch, companyId);
|
|
9832
9936
|
}
|
|
9833
|
-
|
|
9937
|
+
mutationReturned = true;
|
|
9938
|
+
await persistMutationPhase("changed");
|
|
9939
|
+
mutationComplete = true;
|
|
9940
|
+
}
|
|
9941
|
+
if (!statusWillChange && trimmedTransitionComment && typeof ctx.issues.createComment === "function") {
|
|
9834
9942
|
const createdComment = await ctx.issues.createComment(issueId, trimmedTransitionComment, companyId);
|
|
9835
9943
|
if (transitionCommentAnnotation) {
|
|
9836
9944
|
await upsertStatusTransitionCommentAnnotation(ctx, {
|
|
@@ -9844,7 +9952,17 @@ async function updatePaperclipIssueState(ctx, params) {
|
|
|
9844
9952
|
});
|
|
9845
9953
|
}
|
|
9846
9954
|
}
|
|
9955
|
+
if (statusWillChange && !transitionCommentComplete) {
|
|
9956
|
+
throw new Error("GitHub Sync refused to complete a status transition without a durable transition comment result.");
|
|
9957
|
+
}
|
|
9847
9958
|
} catch (error) {
|
|
9959
|
+
if (mutationAttemptStarted && !mutationReturned) {
|
|
9960
|
+
try {
|
|
9961
|
+
await persistMutationPhase("failed");
|
|
9962
|
+
} catch (mutationLedgerError) {
|
|
9963
|
+
throw new AggregateError([error, mutationLedgerError], "GitHub Sync issue mutation failed and its mutation result could not be persisted.");
|
|
9964
|
+
}
|
|
9965
|
+
}
|
|
9848
9966
|
try {
|
|
9849
9967
|
await persistSyncResult("failed");
|
|
9850
9968
|
} catch (ledgerError) {
|
|
@@ -10301,6 +10419,7 @@ async function cancelUnmappedTransferredGitHubIssue(ctx, params) {
|
|
|
10301
10419
|
nextStatus,
|
|
10302
10420
|
transferredRepository: params.transferredRepository
|
|
10303
10421
|
}),
|
|
10422
|
+
actionFingerprint: `transferred-unmapped:${params.transferredRepository.url}`,
|
|
10304
10423
|
paperclipApiBaseUrl: params.paperclipApiBaseUrl
|
|
10305
10424
|
});
|
|
10306
10425
|
return {
|
|
@@ -10561,6 +10680,13 @@ async function synchronizePaperclipIssueStatuses(ctx, octokit, repository, mappi
|
|
|
10561
10680
|
});
|
|
10562
10681
|
const hasTrustedNewComment = hasTrustedNewIssueComment || hasTrustedNewLinkedPullRequestComment;
|
|
10563
10682
|
const remoteActionFingerprint = buildRemoteActionFingerprint(snapshot);
|
|
10683
|
+
const actionJournalFingerprint = createHash("sha256").update(JSON.stringify({
|
|
10684
|
+
remoteActionFingerprint,
|
|
10685
|
+
issueCommentCount: snapshot.commentCount,
|
|
10686
|
+
linkedPullRequestCommentCounts: canonicalizeGitHubPullRequestCommentCounts(
|
|
10687
|
+
currentLinkedPullRequestCommentCounts
|
|
10688
|
+
)
|
|
10689
|
+
})).digest("hex");
|
|
10564
10690
|
if (importedIssue.pendingRemoteActionWake) {
|
|
10565
10691
|
const pendingWake2 = importedIssue.pendingRemoteActionWake;
|
|
10566
10692
|
await wakePaperclipIssueAssignee(ctx, {
|
|
@@ -10654,6 +10780,7 @@ async function synchronizePaperclipIssueStatuses(ctx, octokit, repository, mappi
|
|
|
10654
10780
|
...shouldClearTransitionAssignee ? { clearAssignee: true } : {},
|
|
10655
10781
|
...shouldPreserveMaintainerWaitRouting || shouldClearCompletedExecutionPolicy ? { clearExecutionPolicy: true } : {},
|
|
10656
10782
|
transitionComment: "",
|
|
10783
|
+
actionFingerprint: actionJournalFingerprint,
|
|
10657
10784
|
paperclipApiBaseUrl
|
|
10658
10785
|
});
|
|
10659
10786
|
}
|
|
@@ -10709,6 +10836,7 @@ async function synchronizePaperclipIssueStatuses(ctx, octokit, repository, mappi
|
|
|
10709
10836
|
...shouldPreserveMaintainerWaitRouting || shouldClearCompletedExecutionPolicy ? { clearExecutionPolicy: true } : {},
|
|
10710
10837
|
transitionComment: transitionComment.body,
|
|
10711
10838
|
transitionCommentAnnotation: transitionComment.annotation,
|
|
10839
|
+
actionFingerprint: actionJournalFingerprint,
|
|
10712
10840
|
paperclipApiBaseUrl
|
|
10713
10841
|
});
|
|
10714
10842
|
const pendingWake = shouldWakeImportedAssignee && paperclipIssueSyncContext.assignee?.kind === "agent" ? {
|
|
@@ -10952,6 +11080,10 @@ async function synchronizePaperclipPullRequestIssueStatuses(ctx, octokit, mappin
|
|
|
10952
11080
|
}
|
|
10953
11081
|
}
|
|
10954
11082
|
const remoteActionFingerprint = buildDirectPullRequestActionFingerprint(pullRequestSnapshots);
|
|
11083
|
+
const actionJournalFingerprint = createHash("sha256").update(JSON.stringify({
|
|
11084
|
+
remoteActionFingerprint,
|
|
11085
|
+
commentCounts: canonicalizeGitHubPullRequestCommentCounts(currentCommentCounts)
|
|
11086
|
+
})).digest("hex");
|
|
10955
11087
|
const paperclipIssueSyncContext = getPaperclipIssueSyncContext(paperclipIssue);
|
|
10956
11088
|
const executorTransitionAssignee = resolvePaperclipIssueExecutorAssignee(
|
|
10957
11089
|
paperclipIssueSyncContext,
|
|
@@ -11003,6 +11135,7 @@ async function synchronizePaperclipPullRequestIssueStatuses(ctx, octokit, mappin
|
|
|
11003
11135
|
...shouldClearTransitionAssignee ? { clearAssignee: true } : {},
|
|
11004
11136
|
...shouldPreserveMaintainerWaitRouting || shouldClearCompletedExecutionPolicy ? { clearExecutionPolicy: true } : {},
|
|
11005
11137
|
transitionComment: "",
|
|
11138
|
+
actionFingerprint: actionJournalFingerprint,
|
|
11006
11139
|
paperclipApiBaseUrl
|
|
11007
11140
|
});
|
|
11008
11141
|
}
|
|
@@ -11036,6 +11169,7 @@ async function synchronizePaperclipPullRequestIssueStatuses(ctx, octokit, mappin
|
|
|
11036
11169
|
...shouldClearTransitionAssignee ? { clearAssignee: true } : {},
|
|
11037
11170
|
...shouldPreserveMaintainerWaitRouting || shouldClearCompletedExecutionPolicy ? { clearExecutionPolicy: true } : {},
|
|
11038
11171
|
transitionComment,
|
|
11172
|
+
actionFingerprint: actionJournalFingerprint,
|
|
11039
11173
|
paperclipApiBaseUrl
|
|
11040
11174
|
});
|
|
11041
11175
|
const pendingWake = shouldWakeTransitionAssignee && nextTransitionAssignee?.principal.kind === "agent" ? {
|
|
@@ -17040,6 +17174,7 @@ function shouldStartWorkerHost(moduleUrl, entry = process.argv[1]) {
|
|
|
17040
17174
|
var __testing = {
|
|
17041
17175
|
buildDirectPullRequestActionFingerprint,
|
|
17042
17176
|
buildRemoteActionFingerprint,
|
|
17177
|
+
canonicalizeGitHubPullRequestCommentCounts,
|
|
17043
17178
|
buildSyncFallbackExecutionStatePatch,
|
|
17044
17179
|
createGitHubToolOctokit,
|
|
17045
17180
|
formatPaperclipApiFetchErrorMessage,
|