@mrrlin-dev/mcp 0.4.130 → 0.4.131
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/dist/bin.cjs +66 -27
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -63639,7 +63639,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
63639
63639
|
}
|
|
63640
63640
|
|
|
63641
63641
|
// src/_generated/version.ts
|
|
63642
|
-
var PKG_VERSION = "0.4.
|
|
63642
|
+
var PKG_VERSION = "0.4.131";
|
|
63643
63643
|
|
|
63644
63644
|
// src/bridge-allowed-origins.ts
|
|
63645
63645
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
@@ -68594,7 +68594,9 @@ Continue executing task ${task.id}. Make the next concrete increment of progress
|
|
|
68594
68594
|
if (delivery.settled || !merge2?.mergeSha) throw error51;
|
|
68595
68595
|
const message = error51 instanceof Error ? error51.message : String(error51);
|
|
68596
68596
|
const acted = await failRun(deps, projectSlug, deliveryTask, runId, leaseId, `local_delivery_failed: ${message}`);
|
|
68597
|
-
|
|
68597
|
+
const state = await readSettlementState(deps, projectSlug, deliveryTask.id, runId, 1);
|
|
68598
|
+
const settledElsewhere = !state || state.runDone || state.taskTerminal;
|
|
68599
|
+
if ((!acted || /lease/i.test(message)) && !settledElsewhere) {
|
|
68598
68600
|
try {
|
|
68599
68601
|
restoreRunBranch({
|
|
68600
68602
|
worktreePath: deliveryWorktree,
|
|
@@ -69499,33 +69501,42 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
69499
69501
|
}
|
|
69500
69502
|
async function deliverLocalRun(deps, input) {
|
|
69501
69503
|
const { projectSlug, task, runId, leaseId } = input;
|
|
69502
|
-
const restoreForLostLease = () => {
|
|
69503
|
-
if (input.integration?.mergeSha)
|
|
69504
|
-
|
|
69505
|
-
|
|
69506
|
-
|
|
69507
|
-
|
|
69508
|
-
|
|
69509
|
-
|
|
69510
|
-
|
|
69511
|
-
|
|
69512
|
-
|
|
69513
|
-
|
|
69514
|
-
|
|
69515
|
-
|
|
69516
|
-
|
|
69517
|
-
|
|
69518
|
-
|
|
69519
|
-
|
|
69520
|
-
|
|
69504
|
+
const restoreForLostLease = async () => {
|
|
69505
|
+
if (!input.integration?.mergeSha) return;
|
|
69506
|
+
const settledNow = await readSettlementState(deps, projectSlug, task.id, runId, 1);
|
|
69507
|
+
if (!settledNow || settledNow.runDone || settledNow.taskTerminal) {
|
|
69508
|
+
console.warn(JSON.stringify({
|
|
69509
|
+
event: "local_integration_restore_skipped",
|
|
69510
|
+
projectSlug,
|
|
69511
|
+
runId,
|
|
69512
|
+
reason: settledNow ? "run_settled" : "state_unreadable"
|
|
69513
|
+
}));
|
|
69514
|
+
return;
|
|
69515
|
+
}
|
|
69516
|
+
try {
|
|
69517
|
+
restoreRunBranch({
|
|
69518
|
+
worktreePath: input.worktreePath,
|
|
69519
|
+
runId,
|
|
69520
|
+
preMergeHead: input.integration.preMergeHead,
|
|
69521
|
+
expectedCurrent: input.integration.mergeSha,
|
|
69522
|
+
// deliverLocalRun runs inside driveRun's delivery lock, keyed by this same checkout.
|
|
69523
|
+
deliveryLock: { locksDir: deps.locksDir ?? "/tmp/mrrlin-locks", key: deliveryLockKey(input.checkoutRealPath) }
|
|
69524
|
+
});
|
|
69525
|
+
} catch (error51) {
|
|
69526
|
+
console.warn(JSON.stringify({
|
|
69527
|
+
event: "local_integration_restore_failed",
|
|
69528
|
+
projectSlug,
|
|
69529
|
+
runId,
|
|
69530
|
+
error: error51 instanceof Error ? error51.message : String(error51)
|
|
69531
|
+
}));
|
|
69521
69532
|
}
|
|
69522
69533
|
};
|
|
69523
69534
|
const handOff = async (reason) => {
|
|
69524
69535
|
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
69525
|
-
restoreForLostLease();
|
|
69536
|
+
await restoreForLostLease();
|
|
69526
69537
|
return;
|
|
69527
69538
|
}
|
|
69528
|
-
if (!await failRun(deps, projectSlug, task, runId, leaseId, reason)) restoreForLostLease();
|
|
69539
|
+
if (!await failRun(deps, projectSlug, task, runId, leaseId, reason)) await restoreForLostLease();
|
|
69529
69540
|
};
|
|
69530
69541
|
if (!input.baseSha) {
|
|
69531
69542
|
await handOff(`local_delivery_failed: run ${runId} has no recorded base commit.`);
|
|
@@ -69561,7 +69572,7 @@ async function deliverLocalRun(deps, input) {
|
|
|
69561
69572
|
return;
|
|
69562
69573
|
}
|
|
69563
69574
|
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
69564
|
-
restoreForLostLease();
|
|
69575
|
+
await restoreForLostLease();
|
|
69565
69576
|
return;
|
|
69566
69577
|
}
|
|
69567
69578
|
await deps.client.updateExecutionRun(projectSlug, runId, {
|
|
@@ -69601,7 +69612,7 @@ async function deliverLocalRun(deps, input) {
|
|
|
69601
69612
|
const stored = artifact?.payload ?? {};
|
|
69602
69613
|
const contentHash = String(stored.contentHash ?? stored.content_hash ?? stored.hash ?? "");
|
|
69603
69614
|
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
69604
|
-
restoreForLostLease();
|
|
69615
|
+
await restoreForLostLease();
|
|
69605
69616
|
return;
|
|
69606
69617
|
}
|
|
69607
69618
|
try {
|
|
@@ -69621,8 +69632,19 @@ async function deliverLocalRun(deps, input) {
|
|
|
69621
69632
|
}
|
|
69622
69633
|
);
|
|
69623
69634
|
} catch (error51) {
|
|
69624
|
-
|
|
69625
|
-
|
|
69635
|
+
const message = error51 instanceof Error ? error51.message : String(error51);
|
|
69636
|
+
const outcome2 = await readSettlementState(deps, projectSlug, task.id, runId, SETTLEMENT_READBACK_ATTEMPTS);
|
|
69637
|
+
if (!outcome2 || outcome2.taskStatus !== "closed_done" || !outcome2.runDone) {
|
|
69638
|
+
await handOff(`local_delivery_settlement_failed: ${message}`);
|
|
69639
|
+
return;
|
|
69640
|
+
}
|
|
69641
|
+
console.warn(JSON.stringify({
|
|
69642
|
+
event: "settlement_outcome_recovered",
|
|
69643
|
+
projectSlug,
|
|
69644
|
+
runId,
|
|
69645
|
+
taskId: task.id,
|
|
69646
|
+
error: message
|
|
69647
|
+
}));
|
|
69626
69648
|
}
|
|
69627
69649
|
if (input.delivery) input.delivery.settled = true;
|
|
69628
69650
|
const locksDir = deps.locksDir ?? "/tmp/mrrlin-locks";
|
|
@@ -69697,6 +69719,23 @@ async function deliverLocalRun(deps, input) {
|
|
|
69697
69719
|
}).catch(() => {
|
|
69698
69720
|
});
|
|
69699
69721
|
}
|
|
69722
|
+
var SETTLEMENT_READBACK_ATTEMPTS = 3;
|
|
69723
|
+
async function readSettlementState(deps, projectSlug, taskId, runId, attempts) {
|
|
69724
|
+
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
69725
|
+
try {
|
|
69726
|
+
const current2 = await deps.client.getTask(projectSlug, taskId);
|
|
69727
|
+
const run3 = await deps.client.getExecutionRun(projectSlug, runId);
|
|
69728
|
+
return {
|
|
69729
|
+
taskStatus: current2.status,
|
|
69730
|
+
taskTerminal: mrrlinTerminalTaskStatuses.includes(current2.status),
|
|
69731
|
+
runDone: run3.status === "done"
|
|
69732
|
+
};
|
|
69733
|
+
} catch {
|
|
69734
|
+
if (attempt < attempts) await delayMs(LANDING_RUN_READ_BACKOFF_MS * attempt);
|
|
69735
|
+
}
|
|
69736
|
+
}
|
|
69737
|
+
return null;
|
|
69738
|
+
}
|
|
69700
69739
|
var LANDING_RUN_READ_ATTEMPTS = 3;
|
|
69701
69740
|
var LANDING_RUN_READ_BACKOFF_MS = 250;
|
|
69702
69741
|
async function failRun(deps, projectSlug, task, runId, leaseId, reason, reasonCode) {
|