@lmzhen/dsh-evolution-review 0.62.2 → 0.62.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 +1 -1
- package/lib/index.js +55 -20
- package/lib/types/review-limiter.d.ts +5 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Subagent-origin, background-visibility, and review-child sessions are excluded.
|
|
|
21
21
|
|
|
22
22
|
## Events and limits
|
|
23
23
|
|
|
24
|
-
The package emits `evolution/review-scheduled`, `evolution/review-completed`, `evolution/review-error`, and an aux `evolution/plan-applied` ledger entry. `reviewTimeoutMs` bounds the aux loop (default 300s; raise it, lower `reviewMaxRounds`, or raise `reviewMaxToolCalls` for unusually long reviews); `reviewMaxRounds` (default 12) and `reviewMaxToolCalls` (default 50) bound model rounds and tool calls. Aux reviews run at most 8 at once per plugin instance (`AUX_REVIEW_CONCURRENCY`): that is a provider/CPU budget, while cross-review writes are serialized per resource by the review write locks and the mutation-authority lease. Reaching any bound records `partial`/`timeout` with `hitRoundLimit` and `partialReason`, never `completed`. Review cadence state is persisted when `evolution-state` is available; without it, cadence can reset between turns.
|
|
24
|
+
The package emits `evolution/review-scheduled`, `evolution/review-completed`, `evolution/review-error`, and an aux `evolution/plan-applied` ledger entry. `reviewTimeoutMs` bounds the aux loop (default 300s; raise it, lower `reviewMaxRounds`, or raise `reviewMaxToolCalls` for unusually long reviews); `reviewMaxRounds` (default 12) and `reviewMaxToolCalls` (default 50) bound model rounds and tool calls. Aux reviews run at most 8 at once per plugin instance (`AUX_REVIEW_CONCURRENCY`): that is a provider/CPU budget, while cross-review writes are serialized per resource by the review write locks and the mutation-authority lease. Capacity is acquired **before** the parent prefix is frozen, and a queued review has its own 30s admission budget (`AUX_REVIEW_QUEUE_TIMEOUT_MS`), so `reviewTimeoutMs` starts only after admission and never pays for queue time; a review that cannot be admitted keeps its debt for the next boundary. Reaching any bound records `partial`/`timeout` with `hitRoundLimit` and `partialReason`, never `completed`. Review cadence state is persisted when `evolution-state` is available; without it, cadence can reset between turns.
|
|
25
25
|
|
|
26
26
|
**Removed metadata:** `reviewProvider`, `reviewContextMessages`, `reviewMessageChars`, `reviewMaxDepth` and `reviewToolAllow` were declared but never read, so they are gone from the registry and the bundles. Provider/model come from the parent session header; native review sees the parent catalog but only the family allowlist executes, while PTC exposes only `run_code`.
|
|
27
27
|
`memoryInterval` and `skillInterval` were removed from the live row schema in 0.48 (G0/S0.3). They survive only in the family's old-document migration table and doctor's old-key report; a deployment config that still spells them must be rewritten to `reviewMemoryInterval` and `reviewSkillInterval`.
|
package/lib/index.js
CHANGED
|
@@ -197,6 +197,7 @@ async function runReview(input) {
|
|
|
197
197
|
const stream = streamReviewModel(llm, {
|
|
198
198
|
provider: header.config.provider,
|
|
199
199
|
model: header.config.model,
|
|
200
|
+
sessionId: parent.session.id,
|
|
200
201
|
...header.config.reasoningEffort === void 0 ? {} : { reasoningEffort: header.config.reasoningEffort },
|
|
201
202
|
...header.config.temperature === void 0 ? {} : { temperature: header.config.temperature },
|
|
202
203
|
...header.config.maxTokens === void 0 ? {} : { maxTokens: header.config.maxTokens },
|
|
@@ -753,6 +754,11 @@ var ReviewWriteLocks = class {
|
|
|
753
754
|
};
|
|
754
755
|
//#endregion
|
|
755
756
|
//#region lib/types/review-limiter.js
|
|
757
|
+
/** Maximum time a review may wait for a concurrency slot before the debt is
|
|
758
|
+
* deferred to the next boundary. Kept separate from reviewTimeoutMs: queue
|
|
759
|
+
* wait is not review execution time, and a prefix frozen through a long queue
|
|
760
|
+
* may already be cold when the first request starts. */
|
|
761
|
+
const AUX_REVIEW_QUEUE_TIMEOUT_MS = 3e4;
|
|
756
762
|
/** A tiny FIFO semaphore whose waiters can be aborted by unload/timeout. */
|
|
757
763
|
var ReviewLimiter = class {
|
|
758
764
|
limit;
|
|
@@ -1548,13 +1554,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1548
1554
|
ctx.logger.info("dsh-evolution-review: minimal preset has no family review surface");
|
|
1549
1555
|
return true;
|
|
1550
1556
|
}
|
|
1551
|
-
const
|
|
1552
|
-
const header = session.requestHeader();
|
|
1553
|
-
if (header === void 0) {
|
|
1554
|
-
releaseKind();
|
|
1555
|
-
ctx.logger.warn("dsh-evolution-review: aux review skipped — parent has no request header");
|
|
1556
|
-
return false;
|
|
1557
|
-
}
|
|
1557
|
+
const triggerSeq = session.seq;
|
|
1558
1558
|
const llm = llmPort(ctx)?.streamRaw;
|
|
1559
1559
|
const toolsService = toolsPort(ctx);
|
|
1560
1560
|
const tools = toolsService?.execute;
|
|
@@ -1563,27 +1563,64 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1563
1563
|
ctx.logger.warn("dsh-evolution-review: aux review skipped — llm/tools service is not mounted");
|
|
1564
1564
|
return false;
|
|
1565
1565
|
}
|
|
1566
|
+
const controller = new AbortController();
|
|
1567
|
+
inFlightControllers.add(controller);
|
|
1568
|
+
let queueTimedOut = false;
|
|
1569
|
+
const queueTimer = setTimeout(() => {
|
|
1570
|
+
queueTimedOut = true;
|
|
1571
|
+
controller.abort();
|
|
1572
|
+
}, AUX_REVIEW_QUEUE_TIMEOUT_MS);
|
|
1573
|
+
let limiterRelease;
|
|
1574
|
+
try {
|
|
1575
|
+
limiterRelease = await auxLimiter.acquire(controller.signal);
|
|
1576
|
+
} finally {
|
|
1577
|
+
clearTimeout(queueTimer);
|
|
1578
|
+
}
|
|
1579
|
+
if (limiterRelease === void 0 || controller.signal.aborted) {
|
|
1580
|
+
limiterRelease?.();
|
|
1581
|
+
releaseKind();
|
|
1582
|
+
inFlightControllers.delete(controller);
|
|
1583
|
+
ctx.logger.warn(queueTimedOut ? "dsh-evolution-review: aux review queue wait exceeded " + String(AUX_REVIEW_QUEUE_TIMEOUT_MS) + "ms — debt deferred to the next boundary" : "dsh-evolution-review: aux review queue aborted (plugin unloading) — debt deferred to the next boundary");
|
|
1584
|
+
return false;
|
|
1585
|
+
}
|
|
1586
|
+
let slotReleased = false;
|
|
1587
|
+
const releaseSlot = () => {
|
|
1588
|
+
if (slotReleased) return;
|
|
1589
|
+
slotReleased = true;
|
|
1590
|
+
limiterRelease?.();
|
|
1591
|
+
};
|
|
1592
|
+
if (session.seq !== triggerSeq) {
|
|
1593
|
+
releaseKind();
|
|
1594
|
+
inFlightControllers.delete(controller);
|
|
1595
|
+
releaseSlot();
|
|
1596
|
+
ctx.logger.warn("dsh-evolution-review: parent advanced before aux review admission — debt deferred");
|
|
1597
|
+
return false;
|
|
1598
|
+
}
|
|
1599
|
+
const reviewParent = snapshotReviewParent(agent);
|
|
1600
|
+
const header = session.requestHeader();
|
|
1601
|
+
if (header === void 0) {
|
|
1602
|
+
releaseKind();
|
|
1603
|
+
inFlightControllers.delete(controller);
|
|
1604
|
+
releaseSlot();
|
|
1605
|
+
ctx.logger.warn("dsh-evolution-review: aux review skipped — parent has no request header");
|
|
1606
|
+
return false;
|
|
1607
|
+
}
|
|
1566
1608
|
const liveAuthority = () => ctx.get("evolutionMutationAuthority");
|
|
1567
1609
|
const authority = liveAuthority();
|
|
1568
1610
|
let leaseToken;
|
|
1569
1611
|
if (authority?.lease !== void 0) {
|
|
1570
1612
|
const lease = await authority.lease.acquire("background_review", "review:" + session.id + ":" + kind, Math.max(config.reviewTimeoutMs + 3e4, 6e4)).catch(() => void 0);
|
|
1571
|
-
if (lease === void 0) {
|
|
1572
|
-
releaseKind();
|
|
1573
|
-
ctx.logger.warn("dsh-evolution-review: aux review skipped — lease acquire failed");
|
|
1574
|
-
return false;
|
|
1575
|
-
}
|
|
1576
|
-
if (!lease.ok) {
|
|
1613
|
+
if (lease === void 0 || !lease.ok) {
|
|
1577
1614
|
releaseKind();
|
|
1578
|
-
|
|
1615
|
+
inFlightControllers.delete(controller);
|
|
1616
|
+
releaseSlot();
|
|
1617
|
+
ctx.logger.warn(lease === void 0 ? "dsh-evolution-review: aux review skipped — lease acquire failed" : "dsh-evolution-review: aux review already leased (" + lease.reason + ")");
|
|
1579
1618
|
return false;
|
|
1580
1619
|
}
|
|
1581
1620
|
leaseToken = lease.token;
|
|
1582
1621
|
}
|
|
1583
1622
|
const reviewId = "aux-" + randomUUID();
|
|
1584
1623
|
const startedAt = Date.now();
|
|
1585
|
-
const controller = new AbortController();
|
|
1586
|
-
inFlightControllers.add(controller);
|
|
1587
1624
|
let timedOut = false;
|
|
1588
1625
|
const timer = setTimeout(() => {
|
|
1589
1626
|
timedOut = true;
|
|
@@ -1632,6 +1669,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1632
1669
|
clearTimeout(timer);
|
|
1633
1670
|
if (leaseRenewTimer !== void 0) clearInterval(leaseRenewTimer);
|
|
1634
1671
|
inFlightControllers.delete(controller);
|
|
1672
|
+
releaseSlot();
|
|
1635
1673
|
if (leaseToken !== void 0 && authority?.lease !== void 0) await authority.lease.release(leaseToken).catch(() => {});
|
|
1636
1674
|
ctx.logger.warn("dsh-evolution-review: aux review setup failed: " + (error instanceof Error ? error.message : String(error)));
|
|
1637
1675
|
return false;
|
|
@@ -1655,10 +1693,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1655
1693
|
let hitRoundLimit = false;
|
|
1656
1694
|
let report;
|
|
1657
1695
|
let error;
|
|
1658
|
-
let limiterRelease;
|
|
1659
1696
|
try {
|
|
1660
|
-
limiterRelease = await auxLimiter.acquire(controller.signal);
|
|
1661
|
-
if (limiterRelease === void 0) throw new Error("aux review queue aborted");
|
|
1662
1697
|
const prompt = reviewPrompt(kind, "aux") + "\n\nWhen all durable changes for this review are complete, call review_done as the only tool call in your final batch. Do not call it while more edits remain. A precise no-op is still a completed review: always finish with review_done and an unchanged report instead of stopping without it. If a write is locked, call review_wait once, then re-read the target and retry; never reapply a stale patch." + (channel.instruction === void 0 ? "" : "\n\n" + channel.instruction);
|
|
1663
1698
|
const result = await withReviewContext({
|
|
1664
1699
|
reviewId,
|
|
@@ -1708,7 +1743,7 @@ function apply(ctx, rawConfig = {}) {
|
|
|
1708
1743
|
status = timedOut ? "timeout" : controller.signal.aborted ? "aborted" : "failed";
|
|
1709
1744
|
ctx.logger.warn("dsh-evolution-review: aux review failed: " + error);
|
|
1710
1745
|
} finally {
|
|
1711
|
-
|
|
1746
|
+
releaseSlot();
|
|
1712
1747
|
clearTimeout(timer);
|
|
1713
1748
|
if (leaseRenewTimer !== void 0) clearInterval(leaseRenewTimer);
|
|
1714
1749
|
const finishedAt = Date.now();
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
/** Shipped default for concurrent aux reviews. */
|
|
18
18
|
export declare const AUX_REVIEW_CONCURRENCY = 8;
|
|
19
|
+
/** Maximum time a review may wait for a concurrency slot before the debt is
|
|
20
|
+
* deferred to the next boundary. Kept separate from reviewTimeoutMs: queue
|
|
21
|
+
* wait is not review execution time, and a prefix frozen through a long queue
|
|
22
|
+
* may already be cold when the first request starts. */
|
|
23
|
+
export declare const AUX_REVIEW_QUEUE_TIMEOUT_MS = 30000;
|
|
19
24
|
/** A tiny FIFO semaphore whose waiters can be aborted by unload/timeout. */
|
|
20
25
|
export declare class ReviewLimiter {
|
|
21
26
|
private readonly limit;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-review",
|
|
3
3
|
"description": "Background review orchestration (community build)",
|
|
4
|
-
"version": "0.62.
|
|
4
|
+
"version": "0.62.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
32
|
-
"@lmzhen/dsh-evolution-core": "0.62.
|
|
33
|
-
"@lmzhen/dsh-evolution-platform": "0.62.
|
|
32
|
+
"@lmzhen/dsh-evolution-core": "0.62.3",
|
|
33
|
+
"@lmzhen/dsh-evolution-platform": "0.62.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@deepseek-ai/dsh-agent": "0.2.2-rc.5",
|
|
43
43
|
"@deepseek-ai/dsh-llm": "0.2.2-rc.5",
|
|
44
44
|
"@deepseek-ai/dsh-session": "0.2.2-rc.5",
|
|
45
|
-
"@lmzhen/dsh-evolution-core": "^0.62.
|
|
45
|
+
"@lmzhen/dsh-evolution-core": "^0.62.3"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"dsh": "0.2.2-rc.5"
|