dsh-subagent-default-model 2.1.13 → 2.1.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.14 (2026-11-05)
4
+
5
+ ### Fixed
6
+
7
+ **`agent.model.select()` 被拒时仍记账**(自查发现,2.1.13 的 npm 构建早于该修复)。
8
+
9
+ 原实现先 `pending.set(...)` 再调 `agent.model.select()`。一旦 `select()` 抛出,会记录一次**并未发生**的切换:`count` 被计满、该 step 被标记为「已处理」,于是那个池内候选被白白消耗,同一步也不再尝试它。
10
+
11
+ 改为 `select()` 成功后才记账,并补回归用例(`select` 先拒后成功,断言同一步仍能选到该候选)。
12
+
13
+ > **2.1.13 与 2.1.14 的关系**:2.1.13 的 npm 包在等待 2FA 授权**之前**就已打包,本修复是在那段等待期间提交的,因此没有进入 2.1.13。npm 上的 2.1.13 内容等于提交 `57891f0`,而修复在 `63956a1`。npm 版本不可覆盖,故发 2.1.14 承载修复。**请使用 2.1.14。** 该缺陷只在宿主拒绝 `select()` 的罕见路径下触发,其余 0.2.2 适配 2.1.13 已具备。
14
+
15
+ ### Docs
16
+
17
+ `RELEASING.md` 新增两条纪律:按下 `npm publish` 后不再改动任何要发布的文件;发布后必须下载真实 tarball 与 git tag 逐字节比对(「版本号对」不等于「内容对」)。
18
+
3
19
  ## 2.1.13 (2026-11-05)
4
20
 
5
21
  适配宿主 **0.2.2-rc.1**。这次不是行号位移,而是**一条契约收紧了语义**。
@@ -50,7 +66,7 @@
50
66
 
51
67
  ### Tests
52
68
 
53
- `172/172`(164 → 172),`skip 0`。新增 8 个用例覆盖新宿主路径:
69
+ `173/173`(164 → 173),`skip 0`。`integration.mjs` 16/16、`prove.mjs` 1/1。新增 9 个用例覆盖新宿主路径:
54
70
 
55
71
  - 下游重试成功时**不得**换路(否则重试成功后仍会留下一次无辜切换)
56
72
  - 无人重试时选中下一条池内路由,并**放行原始错误**(而非宿主 guard 错误)
@@ -58,10 +74,11 @@
58
74
  - 同一 step 最多选一次;下一个 step 可再选
59
75
  - 池耗尽不再选新候选、不再伪造 retry
60
76
  - `select()` 被拒时打 warn 且不吞原始错误
77
+ - `select()` 被拒时**不得**记账:候选不能被白白消耗,同一步仍须能再选它
61
78
  - AUTH 仍切换,且仍打「密钥可能无效」告警
62
79
  - 主代理循环仍不受影响
63
80
 
64
- 变异验证 4/4 命中:①新宿主仍走旧的 `agent/request` 覆盖路径 → 5 个用例失败;②`agent/request` 不提前 return → 原样返回用例失败;③忽略下游 retry → 不换路用例失败;④去掉「每 step 一次」限制 → 该用例失败。
81
+ 变异验证 5/5 命中:①新宿主仍走旧的 `agent/request` 覆盖路径 → 5 个用例失败;②`agent/request` 不提前 return → 原样返回用例失败;③忽略下游 retry → 不换路用例失败;④去掉「每 step 一次」限制 → 该用例失败;⑤把记账移回 `select()` 之前 → 候选被消耗用例失败。
65
82
 
66
83
  > 夹具也被修了:原来它只驱动 `agent/request` 并断言返回值变了,模拟的是**旧宿主契约**,所以在会抛错的新宿主上依然全绿。当宿主给契约加硬校验时,夹具必须把校验也加进去,否则它只是在自证清白。
67
84
 
package/lib/index.js CHANGED
@@ -444,12 +444,6 @@ async function switchForNextStep(ctx, state, pending, payload, next) {
444
444
  if (target === void 0) return downstream;
445
445
  const tried = new Set(current?.tried ?? []);
446
446
  tried.add(index);
447
- pending.set(agent.id, {
448
- index,
449
- tried,
450
- count: (current?.count ?? 0) + 1,
451
- step
452
- });
453
447
  try {
454
448
  agent.model.select({
455
449
  provider: target.provider,
@@ -469,6 +463,15 @@ async function switchForNextStep(ctx, state, pending, payload, next) {
469
463
  );
470
464
  return downstream;
471
465
  }
466
+ // Record ONLY a selection that actually landed: an incremented `count` for a
467
+ // switch the host refused would retire a pool entry that was never used and
468
+ // stop the next step from retrying it.
469
+ pending.set(agent.id, {
470
+ index,
471
+ tried,
472
+ count: (current?.count ?? 0) + 1,
473
+ step
474
+ });
472
475
  ctx.logger.warn(
473
476
  `[dsh-subagent-default-model] subagent %s failed with %s on turn %d step %d; %s/%s is selected for its NEXT step (this host fixes the route of the failed step, so the current turn cannot continue on it)`,
474
477
  agent.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-subagent-default-model",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "description": "为 DeepSeek Harness 子代理配置默认模型:多模型顺序/随机分配、跨供应商连接失败故障转移,并在轨迹/对话视图显示当前供应商与模型,同时以一行真实提示词把当前路由注入子代理上下文。",
5
5
  "keywords": [
6
6
  "deepseek-harness",