@mrrlin-dev/mcp 0.4.192 → 0.4.196
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 +52 -12
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -99206,7 +99206,7 @@ Do NOT derail the current task - if the operator has an in-flight question, answ
|
|
|
99206
99206
|
}
|
|
99207
99207
|
|
|
99208
99208
|
// src/_generated/version.ts
|
|
99209
|
-
var PKG_VERSION = "0.4.
|
|
99209
|
+
var PKG_VERSION = "0.4.196";
|
|
99210
99210
|
|
|
99211
99211
|
// src/bridge-allowed-origins.ts
|
|
99212
99212
|
var DEFAULT_DIRECTOR_BRIDGE_ALLOWED_ORIGINS = [
|
|
@@ -104388,6 +104388,8 @@ async function runHasLease(deps, projectSlug, runId, leaseId) {
|
|
|
104388
104388
|
}
|
|
104389
104389
|
var MIXED_CODE_APPROVAL_POLL_MS = 2e3;
|
|
104390
104390
|
var MIXED_CODE_APPROVAL_REQUEST_MS = 3e3;
|
|
104391
|
+
var ReservedLocalDeliveryFailure = class extends Error {
|
|
104392
|
+
};
|
|
104391
104393
|
var MixedCodeApprovalError = class extends Error {
|
|
104392
104394
|
constructor(code, message) {
|
|
104393
104395
|
super(`${code}: ${message}`);
|
|
@@ -105239,7 +105241,6 @@ ${renderTaskStateSection(taskState)}`;
|
|
|
105239
105241
|
let resolvedDefaultBranch = null;
|
|
105240
105242
|
let useExecutor = false;
|
|
105241
105243
|
let coldWorkReserved = false;
|
|
105242
|
-
let freshThreadPublished = false;
|
|
105243
105244
|
let skipRunWrites = false;
|
|
105244
105245
|
const parkUnconfirmedWork = async (stopExecutor = deps.activeLease !== void 0) => {
|
|
105245
105246
|
if (stopExecutor) disposeRunAgent();
|
|
@@ -105817,7 +105818,6 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
105817
105818
|
if (useExecutor) await noteDeliverySkipped(deps, projectSlug, task.id, runId);
|
|
105818
105819
|
return;
|
|
105819
105820
|
}
|
|
105820
|
-
freshThreadPublished = true;
|
|
105821
105821
|
}
|
|
105822
105822
|
if (isNearContextLimit(outcome.telemetry.usage, outcome.telemetry.contextWindow)) {
|
|
105823
105823
|
console.warn(
|
|
@@ -105967,6 +105967,7 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
105967
105967
|
}
|
|
105968
105968
|
if (f67BackgroundGateEnabled && !await backgroundTransitionAllowed("delivery")) return;
|
|
105969
105969
|
if (localGitMode) {
|
|
105970
|
+
const holdOnFailure = coldWorkReserved;
|
|
105970
105971
|
const deliveryWorktree = worktreePath;
|
|
105971
105972
|
const deliveryTask = readiness.task;
|
|
105972
105973
|
const deliveryKey = deliveryLockKey(localCheckoutRealPath ?? checkout?.path ?? deliveryWorktree);
|
|
@@ -105982,11 +105983,13 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
105982
105983
|
deliveryKey,
|
|
105983
105984
|
async () => {
|
|
105984
105985
|
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
105986
|
+
if (holdOnFailure) throw new WorkLeaseUnavailableError();
|
|
105985
105987
|
await noteDeliverySkipped(deps, projectSlug, task.id, runId);
|
|
105986
105988
|
return;
|
|
105987
105989
|
}
|
|
105988
105990
|
await guard?.check();
|
|
105989
105991
|
const integrated = await integrateBeforeReceipt(deps, {
|
|
105992
|
+
holdOnFailure,
|
|
105990
105993
|
projectSlug,
|
|
105991
105994
|
task: deliveryTask,
|
|
105992
105995
|
runId,
|
|
@@ -106006,6 +106009,7 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
106006
106009
|
const delivery = { settled: false };
|
|
106007
106010
|
try {
|
|
106008
106011
|
await deliverLocalRun(deps, {
|
|
106012
|
+
holdOnFailure,
|
|
106009
106013
|
projectSlug,
|
|
106010
106014
|
task: deliveryTask,
|
|
106011
106015
|
runId,
|
|
@@ -106020,9 +106024,15 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
106020
106024
|
});
|
|
106021
106025
|
} catch (error51) {
|
|
106022
106026
|
const merge2 = integrated.integration;
|
|
106023
|
-
if (delivery.settled ||
|
|
106027
|
+
if (delivery.settled || error51 instanceof WorkLeaseUnavailableError) throw error51;
|
|
106028
|
+
if (holdOnFailure) {
|
|
106029
|
+
if (error51 instanceof MixedCodeApprovalError) throw error51;
|
|
106030
|
+
throw new ReservedLocalDeliveryFailure("local_delivery_failed");
|
|
106031
|
+
}
|
|
106032
|
+
if (!merge2?.mergeSha) throw error51;
|
|
106024
106033
|
const message = error51 instanceof Error ? error51.message : String(error51);
|
|
106025
|
-
const approvalFailure = error51 instanceof MixedCodeApprovalError;
|
|
106034
|
+
const approvalFailure = guard?.signal.reason instanceof MixedCodeApprovalError ? guard.signal.reason : error51 instanceof MixedCodeApprovalError ? error51 : void 0;
|
|
106035
|
+
if (approvalFailure && coldWorkReserved) throw approvalFailure;
|
|
106026
106036
|
const acted = !approvalFailure && await failRun(deps, projectSlug, deliveryTask, runId, leaseId, `local_delivery_failed: ${message}`);
|
|
106027
106037
|
const state = await readSettlementState(deps, projectSlug, deliveryTask.id, runId, 1);
|
|
106028
106038
|
const settledElsewhere = !state || state.runDone || state.taskTerminal;
|
|
@@ -106266,10 +106276,21 @@ ${coldClosureInstruction}` : workInstruction;
|
|
|
106266
106276
|
skipRunWrites = true;
|
|
106267
106277
|
return;
|
|
106268
106278
|
}
|
|
106269
|
-
const approvalError = guard?.signal.reason
|
|
106270
|
-
if (approvalError
|
|
106271
|
-
|
|
106272
|
-
|
|
106279
|
+
const approvalError = guard?.signal.reason instanceof MixedCodeApprovalError ? guard.signal.reason : error51 instanceof MixedCodeApprovalError ? error51 : void 0;
|
|
106280
|
+
if (approvalError) {
|
|
106281
|
+
if (coldWorkReserved) {
|
|
106282
|
+
skipRunWrites = true;
|
|
106283
|
+
console.warn(JSON.stringify({ event: "executor_cold_work_approval_lost", projectSlug, runId, code: approvalError.code }));
|
|
106284
|
+
await parkUnconfirmedWork(true);
|
|
106285
|
+
} else {
|
|
106286
|
+
disposeRunAgent();
|
|
106287
|
+
await reportMixedApprovalFailure(approvalError);
|
|
106288
|
+
}
|
|
106289
|
+
return;
|
|
106290
|
+
}
|
|
106291
|
+
if (error51 instanceof ReservedLocalDeliveryFailure) {
|
|
106292
|
+
skipRunWrites = true;
|
|
106293
|
+
await parkUnconfirmedWork(true);
|
|
106273
106294
|
return;
|
|
106274
106295
|
}
|
|
106275
106296
|
if (coldWorkReserved) {
|
|
@@ -106871,7 +106892,7 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
106871
106892
|
let branchSeen = null;
|
|
106872
106893
|
const readRunTip = async () => gitOutput(worktreePath, ["rev-parse", "--verify", "-q", `refs/heads/${worktreeBranch(runId)}`]).catch(() => null);
|
|
106873
106894
|
const restore2 = () => {
|
|
106874
|
-
if (!preMergeHead || !branchSeen) return;
|
|
106895
|
+
if (ctx.holdOnFailure || !preMergeHead || !branchSeen) return;
|
|
106875
106896
|
const restored = restoreRunBranch({
|
|
106876
106897
|
worktreePath,
|
|
106877
106898
|
runId,
|
|
@@ -106886,6 +106907,7 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
106886
106907
|
try {
|
|
106887
106908
|
const onBranch = await gitOutput(worktreePath, ["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
106888
106909
|
if (onBranch !== worktreeBranch(runId)) {
|
|
106910
|
+
if (ctx.holdOnFailure) throw new ReservedLocalDeliveryFailure("local_integration_failed");
|
|
106889
106911
|
await failRun(
|
|
106890
106912
|
deps,
|
|
106891
106913
|
projectSlug,
|
|
@@ -106896,11 +106918,17 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
106896
106918
|
);
|
|
106897
106919
|
return { proceed: false };
|
|
106898
106920
|
}
|
|
106899
|
-
if (!await runHasLease(deps, projectSlug, runId, leaseId))
|
|
106921
|
+
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
106922
|
+
if (ctx.holdOnFailure) throw new WorkLeaseUnavailableError();
|
|
106923
|
+
return { proceed: false };
|
|
106924
|
+
}
|
|
106900
106925
|
await ctx.guard?.check();
|
|
106901
106926
|
commitUncommittedWork({ worktreePath, runId });
|
|
106902
106927
|
if (countOwnCommits({ worktreePath, baseSha: ctx.baseSha }) === 0) return { proceed: true };
|
|
106903
|
-
if (!await runHasLease(deps, projectSlug, runId, leaseId))
|
|
106928
|
+
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
106929
|
+
if (ctx.holdOnFailure) throw new WorkLeaseUnavailableError();
|
|
106930
|
+
return { proceed: false };
|
|
106931
|
+
}
|
|
106904
106932
|
await ctx.guard?.check();
|
|
106905
106933
|
const hooksDir = prepareDisabledGitHooksDir(deps.locksDir ?? "/tmp/mrrlin-locks", runId);
|
|
106906
106934
|
const result = integrateDefaultBranch({ worktreePath, defaultBranch, runId, hooksDir });
|
|
@@ -106922,6 +106950,7 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
106922
106950
|
const noBudget = `local_integration_conflict: ${defaultBranch} and ${runId} conflict in ${files}; no turn budget was left to resolve them. ${options}`;
|
|
106923
106951
|
const budget = Math.min(completionTurnBudgetMs(), ctx.remainingTurnBudgetMs());
|
|
106924
106952
|
if (isCompletionTurnDisabled() || budget < completionTurnMinBudgetMs()) {
|
|
106953
|
+
if (ctx.holdOnFailure) throw new ReservedLocalDeliveryFailure("local_integration_failed");
|
|
106925
106954
|
restore2();
|
|
106926
106955
|
await failRun(deps, projectSlug, task, runId, leaseId, noBudget);
|
|
106927
106956
|
return { proceed: false };
|
|
@@ -106941,12 +106970,14 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
106941
106970
|
);
|
|
106942
106971
|
branchSeen = await readRunTip();
|
|
106943
106972
|
if (!turn.ok) {
|
|
106973
|
+
if (ctx.holdOnFailure) throw new ReservedLocalDeliveryFailure("local_integration_failed");
|
|
106944
106974
|
await resetWedgedThread(deps, projectSlug, task.id, turn.interruptFailed);
|
|
106945
106975
|
restore2();
|
|
106946
106976
|
await failRun(deps, projectSlug, task, runId, leaseId, `${noBudget} Turn error: ${turn.error}`);
|
|
106947
106977
|
return { proceed: false };
|
|
106948
106978
|
}
|
|
106949
106979
|
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
106980
|
+
if (ctx.holdOnFailure) throw new WorkLeaseUnavailableError();
|
|
106950
106981
|
restore2();
|
|
106951
106982
|
return { proceed: false };
|
|
106952
106983
|
}
|
|
@@ -106964,6 +106995,7 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
106964
106995
|
});
|
|
106965
106996
|
branchSeen = await readRunTip();
|
|
106966
106997
|
if (!verdict.ok) {
|
|
106998
|
+
if (ctx.holdOnFailure) throw new ReservedLocalDeliveryFailure("local_integration_failed");
|
|
106967
106999
|
restore2();
|
|
106968
107000
|
await failRun(
|
|
106969
107001
|
deps,
|
|
@@ -106986,6 +107018,10 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
106986
107018
|
await recordIntegration(record2);
|
|
106987
107019
|
return { proceed: true, integration: record2 };
|
|
106988
107020
|
} catch (error51) {
|
|
107021
|
+
if (ctx.holdOnFailure) {
|
|
107022
|
+
if (error51 instanceof MixedCodeApprovalError || error51 instanceof WorkLeaseUnavailableError) throw error51;
|
|
107023
|
+
throw new ReservedLocalDeliveryFailure("local_integration_failed");
|
|
107024
|
+
}
|
|
106989
107025
|
try {
|
|
106990
107026
|
if (preMergeHead) restore2();
|
|
106991
107027
|
else abortIntegration({ worktreePath });
|
|
@@ -107007,6 +107043,7 @@ async function integrateBeforeReceipt(deps, ctx) {
|
|
|
107007
107043
|
async function deliverLocalRun(deps, input) {
|
|
107008
107044
|
const { projectSlug, task, runId, leaseId } = input;
|
|
107009
107045
|
const restoreForLostLease = async () => {
|
|
107046
|
+
if (input.holdOnFailure) throw new WorkLeaseUnavailableError();
|
|
107010
107047
|
if (!input.integration?.mergeSha) return;
|
|
107011
107048
|
const settledNow = await readSettlementState(deps, projectSlug, task.id, runId, 1);
|
|
107012
107049
|
if (!settledNow || settledNow.runDone || settledNow.taskTerminal) {
|
|
@@ -107037,6 +107074,8 @@ async function deliverLocalRun(deps, input) {
|
|
|
107037
107074
|
}
|
|
107038
107075
|
};
|
|
107039
107076
|
const handOff = async (reason) => {
|
|
107077
|
+
if (input.guard?.signal.reason instanceof MixedCodeApprovalError) throw input.guard.signal.reason;
|
|
107078
|
+
if (input.holdOnFailure) throw new ReservedLocalDeliveryFailure("local_delivery_failed");
|
|
107040
107079
|
if (!await runHasLease(deps, projectSlug, runId, leaseId)) {
|
|
107041
107080
|
await restoreForLostLease();
|
|
107042
107081
|
return;
|
|
@@ -107074,6 +107113,7 @@ async function deliverLocalRun(deps, input) {
|
|
|
107074
107113
|
}
|
|
107075
107114
|
deps.activeLease?.watch.assertActive();
|
|
107076
107115
|
if (!outcome.ok) {
|
|
107116
|
+
if (input.holdOnFailure) throw new ReservedLocalDeliveryFailure("local_delivery_failed");
|
|
107077
107117
|
if (outcome.evidence) {
|
|
107078
107118
|
await deps.client.updateExecutionRun(projectSlug, runId, { headSha: outcome.evidence.headSha }).catch(() => {
|
|
107079
107119
|
});
|