@sellable/mcp 0.1.750 → 0.1.752
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/refill-run-loop.js +4 -0
- package/dist/tools/refill-sends.js +100 -7
- package/package.json +1 -1
package/dist/refill-run-loop.js
CHANGED
|
@@ -2105,6 +2105,10 @@ const INHERITED_ATTEMPT_LEDGER_KEYS = [
|
|
|
2105
2105
|
"drySourcePrepAttempts",
|
|
2106
2106
|
"approvalCohortAttempts",
|
|
2107
2107
|
"erroredCellRepairAttempts",
|
|
2108
|
+
// fix(112aw): mirrors WORKSPACE_ATTEMPT_LEDGER_KEYS — census fingerprints of
|
|
2109
|
+
// confirmed completeness-claim releases must survive the fence inherit or a
|
|
2110
|
+
// continuation would re-authorize the same release and reopen the livelock.
|
|
2111
|
+
"confirmedClaimReleaseAttempts",
|
|
2108
2112
|
];
|
|
2109
2113
|
function inheritAttemptLedgers(base, incoming) {
|
|
2110
2114
|
if (!incoming)
|
|
@@ -253,6 +253,10 @@ const WORKSPACE_ATTEMPT_LEDGER_KEYS = [
|
|
|
253
253
|
"drySourcePrepAttempts",
|
|
254
254
|
"approvalCohortAttempts",
|
|
255
255
|
"erroredCellRepairAttempts",
|
|
256
|
+
// fix(112aw): census fingerprints at which a CONFIRMED completeness claim was
|
|
257
|
+
// released. Stripping this would re-authorize a confirmed release on every
|
|
258
|
+
// coordinator call and reopen the 112as livelock.
|
|
259
|
+
"confirmedClaimReleaseAttempts",
|
|
256
260
|
];
|
|
257
261
|
// A fenced exact run records its bounded attempt receipts on ITS OWN
|
|
258
262
|
// runState; the workspace loop replans from workspaceRunState. Without this
|
|
@@ -1499,12 +1503,17 @@ async function selectWorkspaceExactTarget(input, workspacePlanOverride, options
|
|
|
1499
1503
|
// opening is barred for those targets (in the selection loop below).
|
|
1500
1504
|
const completeDeferredTargets = blockedExactTargets.filter((blocked) => blocked.blocker === "complete" ||
|
|
1501
1505
|
blocked.blocker === "capped_by_scheduler");
|
|
1502
|
-
const waiveCompleteClaims = options.waiveCompleteClaims === true
|
|
1506
|
+
const waiveCompleteClaims = options.waiveCompleteClaims === true ||
|
|
1507
|
+
options.waiveCompleteClaims === "include_confirmed";
|
|
1508
|
+
const waiveConfirmedClaims = options.waiveCompleteClaims === "include_confirmed";
|
|
1503
1509
|
const prefilterBlockedTargets = blockedExactTargets.filter((blocked) => blocked.blocker !== "complete" &&
|
|
1504
1510
|
blocked.blocker !== "capped_by_scheduler" &&
|
|
1505
1511
|
// fix(112as): on the bounded release pass, a self-issued
|
|
1506
1512
|
// exact_action_complete claim no longer bars its own edge.
|
|
1507
|
-
!(waiveCompleteClaims && blocked.blocker === "exact_action_complete")
|
|
1513
|
+
!(waiveCompleteClaims && blocked.blocker === "exact_action_complete") &&
|
|
1514
|
+
// fix(112aw): a census-authorized release also waives CONFIRMED claims.
|
|
1515
|
+
!(waiveConfirmedClaims &&
|
|
1516
|
+
blocked.blocker === EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER));
|
|
1508
1517
|
const seenTargetKeys = new Set();
|
|
1509
1518
|
// fix(112ak): every refusal is recorded so a non-empty-census terminal can
|
|
1510
1519
|
// name the concrete per-lane blocker instead of reporting a bare dead end.
|
|
@@ -1544,16 +1553,61 @@ async function selectWorkspaceExactTarget(input, workspacePlanOverride, options
|
|
|
1544
1553
|
return null;
|
|
1545
1554
|
if (coordinatorExcludedEdges.length === 0)
|
|
1546
1555
|
return null;
|
|
1547
|
-
if (!coordinatorExcludedEdges.every((edge) => edge.blocker ===
|
|
1556
|
+
if (!coordinatorExcludedEdges.every((edge) => edge.blocker === EXACT_ACTION_COMPLETE_BLOCKER ||
|
|
1557
|
+
edge.blocker === EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER)) {
|
|
1548
1558
|
return null;
|
|
1549
1559
|
}
|
|
1550
1560
|
const census = workspaceGapBearingActionableSupply(workspacePlan);
|
|
1551
1561
|
if (census.actionableRows <= 0 && !census.frontierHasMoreRows) {
|
|
1552
1562
|
return null;
|
|
1553
1563
|
}
|
|
1554
|
-
|
|
1564
|
+
// fix(112aw): a CONFIRMED claim is a bounded batch receipt, not proof the
|
|
1565
|
+
// edge is done — prepare/approve run in bounded cohorts, so a 50-send day
|
|
1566
|
+
// legitimately needs the SAME edge many times (Dotwork td7-28 run 1:
|
|
1567
|
+
// approve_messages + prepare_messages hardened to confirmed after two
|
|
1568
|
+
// productive batches, then refused the remaining 40-send fill against a
|
|
1569
|
+
// census of 6 approval candidates). Release confirmed claims too, but
|
|
1570
|
+
// only when the gap-bearing census MOVED since the last confirmed
|
|
1571
|
+
// release: a productive batch always changes the census (rows advance
|
|
1572
|
+
// stages), while a dispatch that moved nothing leaves it identical and
|
|
1573
|
+
// the claim stands. That keeps the 112as-b livelock kill, re-keyed on
|
|
1574
|
+
// progress instead of receipt count.
|
|
1575
|
+
const hasConfirmedClaims = coordinatorExcludedEdges.some((edge) => edge.blocker === EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER);
|
|
1576
|
+
let releaseInput = input;
|
|
1577
|
+
if (hasConfirmedClaims) {
|
|
1578
|
+
const fingerprint = [
|
|
1579
|
+
census.approvalFrontier,
|
|
1580
|
+
census.generateFrontier,
|
|
1581
|
+
census.enrichFrontier,
|
|
1582
|
+
census.rubricFrontier,
|
|
1583
|
+
census.frontierHasMoreRows ? 1 : 0,
|
|
1584
|
+
].join(":");
|
|
1585
|
+
const priorReleases = Array.isArray(workspaceRunState?.confirmedClaimReleaseAttempts)
|
|
1586
|
+
? workspaceRunState.confirmedClaimReleaseAttempts
|
|
1587
|
+
: [];
|
|
1588
|
+
if (priorReleases.some((entry) => stringValue(recordValue(entry)?.fingerprint) === fingerprint)) {
|
|
1589
|
+
return null;
|
|
1590
|
+
}
|
|
1591
|
+
releaseInput = {
|
|
1592
|
+
...input,
|
|
1593
|
+
workspaceRunState: {
|
|
1594
|
+
...(workspaceRunState ?? {
|
|
1595
|
+
version: 1,
|
|
1596
|
+
senderCursors: [],
|
|
1597
|
+
laneCooldowns: [],
|
|
1598
|
+
passRates: [],
|
|
1599
|
+
coordinatorBlockedExactTargets: [],
|
|
1600
|
+
}),
|
|
1601
|
+
confirmedClaimReleaseAttempts: [
|
|
1602
|
+
...priorReleases.filter((entry) => Boolean(recordValue(entry))),
|
|
1603
|
+
{ fingerprint, decidedAt: new Date().toISOString() },
|
|
1604
|
+
],
|
|
1605
|
+
},
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
const released = await selectWorkspaceExactTarget(releaseInput, workspacePlan, {
|
|
1555
1609
|
...options,
|
|
1556
|
-
waiveCompleteClaims: true,
|
|
1610
|
+
waiveCompleteClaims: hasConfirmedClaims ? "include_confirmed" : true,
|
|
1557
1611
|
seedExcludedEdges: [...coordinatorExcludedEdges],
|
|
1558
1612
|
});
|
|
1559
1613
|
// The release may only ADD a dispatch. If it fails to bind an edge, fall
|
|
@@ -1846,6 +1900,11 @@ async function selectWorkspaceExactTarget(input, workspacePlanOverride, options
|
|
|
1846
1900
|
blocked.blocker === "exact_action_complete") {
|
|
1847
1901
|
return false;
|
|
1848
1902
|
}
|
|
1903
|
+
// fix(112aw): mirror the confirmed-claim waiver after the exact rebind.
|
|
1904
|
+
if (waiveConfirmedClaims &&
|
|
1905
|
+
blocked.blocker === EXACT_ACTION_COMPLETE_CONFIRMED_BLOCKER) {
|
|
1906
|
+
return false;
|
|
1907
|
+
}
|
|
1849
1908
|
recordExcludedEdge(exactSelectedTarget, blocked, "post_rebind");
|
|
1850
1909
|
return true;
|
|
1851
1910
|
})) {
|
|
@@ -2025,6 +2084,35 @@ function laneFrontierIsRubricTerminal(frontier) {
|
|
|
2025
2084
|
const status = stringValue(diagnosis.status);
|
|
2026
2085
|
return status === "zero_yield" || status === "low_yield";
|
|
2027
2086
|
}
|
|
2087
|
+
// fix(112au): a lane can be receipt-proven spent WITHOUT the classifier having
|
|
2088
|
+
// labelled its stage `icp_or_rubric_rejection`. Dotwork's receipts carry
|
|
2089
|
+
// `retryable: false`, `status: "zero_yield"`, `activeCellCount: 0` and
|
|
2090
|
+
// `stage: "mixed_or_unknown"` (dominantReason legacy_progress_zero_yield), so
|
|
2091
|
+
// the lane stayed "convertible", kept its rows in the actionable census, and
|
|
2092
|
+
// the run terminaled `actionable_supply_not_queued` against supply it could
|
|
2093
|
+
// never convert — an owner-invariant breach caused by a MISSING stage label,
|
|
2094
|
+
// not by real actionable work.
|
|
2095
|
+
//
|
|
2096
|
+
// The substantive proof of exhaustion is: the preparation receipt is
|
|
2097
|
+
// NON-RETRYABLE, it yielded nothing, and there is no work still in flight.
|
|
2098
|
+
// The stage label is a classifier detail on top of that.
|
|
2099
|
+
//
|
|
2100
|
+
// activeCellCount === 0 is load-bearing: a lane with cells still processing is
|
|
2101
|
+
// mid-flight, not spent, and must keep its rows in the census so the
|
|
2102
|
+
// active-prep-job wait path wins instead of a false exhaustion terminal.
|
|
2103
|
+
function laneFrontierIsReceiptProvenSpent(frontier) {
|
|
2104
|
+
const frontierRecord = recordValue(frontier);
|
|
2105
|
+
const diagnosis = recordValue(frontierRecord?.failureDiagnosis);
|
|
2106
|
+
if (!diagnosis)
|
|
2107
|
+
return false;
|
|
2108
|
+
if (diagnosis.retryable !== false)
|
|
2109
|
+
return false;
|
|
2110
|
+
const status = stringValue(diagnosis.status);
|
|
2111
|
+
if (status !== "zero_yield" && status !== "low_yield")
|
|
2112
|
+
return false;
|
|
2113
|
+
const activeCells = numberValue(frontierRecord?.activeCellCount);
|
|
2114
|
+
return activeCells === 0;
|
|
2115
|
+
}
|
|
2028
2116
|
// One frontier receipt describes one campaign table's lane, however many senders
|
|
2029
2117
|
// share it. Fall back to sender identity only when the receipt did not name the
|
|
2030
2118
|
// table it measured, so independent lanes still sum.
|
|
@@ -2099,7 +2187,8 @@ function workspaceActionableSupplyCensus(plan) {
|
|
|
2099
2187
|
const stageCounts = recordValue(frontier?.stageCounts);
|
|
2100
2188
|
const lane = workspaceLaneFrontier(planRecord, receipt, frontier, stageCounts);
|
|
2101
2189
|
const laneKey = workspaceLaneFrontierKey(lane);
|
|
2102
|
-
if (laneFrontierIsRubricTerminal(frontier)
|
|
2190
|
+
if (laneFrontierIsRubricTerminal(frontier) ||
|
|
2191
|
+
laneFrontierIsReceiptProvenSpent(frontier)) {
|
|
2103
2192
|
mergeNonConvertibleLane(nonConvertibleByLane, laneKey, lane);
|
|
2104
2193
|
continue;
|
|
2105
2194
|
}
|
|
@@ -2185,7 +2274,11 @@ function workspaceGapBearingActionableSupply(plan) {
|
|
|
2185
2274
|
const frontier = recordValue(receipt?.existingRowFrontier);
|
|
2186
2275
|
const stageCounts = recordValue(frontier?.stageCounts);
|
|
2187
2276
|
const lane = workspaceLaneFrontier(rec, receipt, frontier, stageCounts);
|
|
2188
|
-
|
|
2277
|
+
// fix(112au): both convertibility splits must agree. This one feeds the
|
|
2278
|
+
// TERMINAL classifier, so a lane spent-by-receipt but unlabelled here would
|
|
2279
|
+
// still drive actionable_supply_not_queued.
|
|
2280
|
+
const rubricTerminal = laneFrontierIsRubricTerminal(frontier) ||
|
|
2281
|
+
laneFrontierIsReceiptProvenSpent(frontier);
|
|
2189
2282
|
const laneActionable = rubricTerminal
|
|
2190
2283
|
? 0
|
|
2191
2284
|
: lane.approval + lane.generate + lane.enrich + lane.rubric;
|