dsh-session-superagent 0.9.172 → 0.9.173
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 +27 -0
- package/README.md +2 -2
- package/client.js +1 -1
- package/lib/index.js +15 -4
- package/lib/watch.js +23 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## [0.9.173] - 2026-11-04 —— 重启后的「会话已不在」误报:给 10 分钟宽限期
|
|
6
|
+
|
|
7
|
+
### 现场(重启后你看到的那条红字)
|
|
8
|
+
```
|
|
9
|
+
lastError: 会话已不在:请删除或重建这条主理鱼
|
|
10
|
+
```
|
|
11
|
+
而那个会话**当时正开着**(就是当前对话)。宿主刚启动时 `agents.get()` 会短暂返回 `undefined`,
|
|
12
|
+
三分钟后再轮询,错误自己消失了。
|
|
13
|
+
|
|
14
|
+
### 为什么这条特别糟
|
|
15
|
+
1. 建议是**不可逆**的 —— 客户照做会删掉一条好好工作的守(水位 / 历史 / 隔离区全没);
|
|
16
|
+
2. 退避是冤枉的:这不是失败,是启动时序;
|
|
17
|
+
3. 它**本来会自己好**,但客户已经删了。
|
|
18
|
+
|
|
19
|
+
### 改法
|
|
20
|
+
`sessionMissingVerdict()`(`lib/watch.js`):
|
|
21
|
+
- 第一次查不到 → 记下起点,进入 10 分钟宽限期;
|
|
22
|
+
- 期内只写 `lastDeferred`(「会话尚未就绪,约 N 分钟后仍找不到才报错」),**不记失败、不退避**;
|
|
23
|
+
- 超过宽限期才判死,文案带上等待时长:`会话已不在(连续 N 分钟找不到):确认该会话是否已被删除,再决定是否重建`;
|
|
24
|
+
- 一旦找得到,立刻清掉计时。
|
|
25
|
+
|
|
26
|
+
### 证据
|
|
27
|
+
```
|
|
28
|
+
node --test → 271/271(新增 2 条:宽限期内不判死 / 超期判死 / 时间戳坏掉不卡死)
|
|
29
|
+
真机:重启后那次 poll 已清除错误(fails 0),文案从「会话已不在」变回「会话正忙,下一轮重试」
|
|
30
|
+
```
|
|
31
|
+
|
|
5
32
|
## [0.9.172] - 2026-11-04 —— 真机第一轮唤醒就炸:`iso is not defined`
|
|
6
33
|
|
|
7
34
|
### 现场(你截图的那条红色「异常」)
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<img src="assets/icon-180.png" width="88" height="88" alt="">
|
|
4
4
|
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](https://github.com/MYCF711/dsh-session-superagent/releases)
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-session-superagent)
|
|
8
8
|
[](https://github.com/topics/dsh-plugin)
|
|
9
9
|
|
|
@@ -123,7 +123,7 @@ dsh plugin install /path/to/dsh-session-superagent
|
|
|
123
123
|
## 开发
|
|
124
124
|
|
|
125
125
|
```sh
|
|
126
|
-
node --test #
|
|
126
|
+
node --test # 271 项单测
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### 工具输出:文本给人和 agent,JSON 给程序
|
package/client.js
CHANGED
|
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
const { useCallback, useEffect, useRef, useState } = React
|
|
15
15
|
|
|
16
16
|
// 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
|
|
17
|
-
const CLIENT_VERSION = '0.9.
|
|
17
|
+
const CLIENT_VERSION = '0.9.173'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
package/lib/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { redact } from './redact.js'
|
|
|
25
25
|
import { decodeBody } from './body.js'
|
|
26
26
|
import {
|
|
27
27
|
advanceSeen, applyWatcherAction, batchFresh, decideWake, DEFAULT_ACK_LABEL, formatWatchText,
|
|
28
|
-
TRIAGE_SIGNALS, accessNote, wakeCriteria, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, formatGhCall, diagnoseEmptyBody, diagnoseBadBody, isAuthBroken, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, enterActiveHoursDefer, recordOtherError, permanentBackoffMs, RETRY_BUDGET_ATTEMPTS, RETRY_SLOW_CAP_MINUTES, pushAbsorbed, pushFiltered, normalizeFilters, partitionItems, passesFilters,
|
|
28
|
+
TRIAGE_SIGNALS, accessNote, wakeCriteria, sessionMissingVerdict, buildCommentBatchQuery, classifyGhError, commentSummaryLine, parseCommentBatch, pickSuggestion, repoStructureNote, countReasons, filterReason, formatGhCall, diagnoseEmptyBody, diagnoseBadBody, isAuthBroken, hasAckLabel, jitterMs, parseGhInclude, retryAfterMs, throttleDelayMs, inActiveHours, newestUpdatedAt, nextDelayMs, enterActiveHoursDefer, recordOtherError, permanentBackoffMs, RETRY_BUDGET_ATTEMPTS, RETRY_SLOW_CAP_MINUTES, pushAbsorbed, pushFiltered, normalizeFilters, partitionItems, passesFilters,
|
|
29
29
|
shouldRunCleanup,
|
|
30
30
|
bumpDailyWakes,
|
|
31
31
|
busierThanUsual,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
|
|
41
41
|
export const name = 'dsh-session-superagent'
|
|
42
42
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
43
|
-
export const SERVER_VERSION = '0.9.
|
|
43
|
+
export const SERVER_VERSION = '0.9.173'
|
|
44
44
|
export const inject = ['tools', 'agents', 'webServer']
|
|
45
45
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
46
46
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -1133,12 +1133,23 @@ async function pollOnce(ctx, entry, baseMs) {
|
|
|
1133
1133
|
const liveAgents = agentsService(ctx)
|
|
1134
1134
|
const liveAgent = liveAgents && typeof liveAgents.get === 'function' ? liveAgents.get(entry.sessionId) : undefined
|
|
1135
1135
|
if (!liveAgent) {
|
|
1136
|
-
//
|
|
1136
|
+
// 「找不到会话」有两种:宿主刚启动还没加载(临时),或真被删了(永久)。
|
|
1137
|
+
// 2026-11-04 真机:重启后第一轮就报「会话已不在:请删除或重建」,可那个会话明明开着。
|
|
1138
|
+
// 所以先给宽限期:期内只写 lastDeferred(不记失败、不退避),过了才认定真的没了。
|
|
1139
|
+
const verdict = sessionMissingVerdict({ missingSince: entry.sessionMissingSince })
|
|
1140
|
+
if (verdict.justNow) entry.sessionMissingSince = verdict.startedAt
|
|
1141
|
+
if (verdict.grace) {
|
|
1142
|
+
entry.lastDeferred = '会话尚未就绪(宿主可能刚启动):约 ' + verdict.waitMin + ' 分钟后仍找不到才报错'
|
|
1143
|
+
return
|
|
1144
|
+
}
|
|
1145
|
+
// 超过宽限期仍找不到:别开隔离区,也别假装在盯。
|
|
1137
1146
|
// 必须走 bumpFailure —— 否则这条会每 intervalSec 打一次 GitHub,永不退避(第四轮审核指出)。
|
|
1138
|
-
setEntryError(entry, '
|
|
1147
|
+
setEntryError(entry, '会话已不在(连续 ' + verdict.waitedMin + ' 分钟找不到):确认该会话是否已被删除,再决定是否重建这条主理鱼')
|
|
1139
1148
|
bumpFailure(entry, baseMs)
|
|
1140
1149
|
return
|
|
1141
1150
|
}
|
|
1151
|
+
// 找得到就清掉「缺失计时」,下次重启不会带着旧时间戳
|
|
1152
|
+
entry.sessionMissingSince = null
|
|
1142
1153
|
const gate = decideWake(liveAgent && liveAgent.status)
|
|
1143
1154
|
if (!gate.ok) {
|
|
1144
1155
|
entry.lastDeferred = '会话正忙,下一轮重试'
|
package/lib/watch.js
CHANGED
|
@@ -1020,3 +1020,26 @@ export function statusView(entries, options = {}) {
|
|
|
1020
1020
|
})),
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* 「找不到会话」到底是**被删了**,还是**宿主刚启动还没加载**?
|
|
1026
|
+
*
|
|
1027
|
+
* 真机现场(2026-11-04 重启后第一轮轮询):
|
|
1028
|
+
* lastError: 会话已不在:请删除或重建这条主理鱼
|
|
1029
|
+
* 而那个会话明明还开着 —— 宿主刚启动时 agents.get() 会短暂返回 undefined。
|
|
1030
|
+
* 让客户看到"请删除或重建"这种不可逆建议,比什么都不说更糟。
|
|
1031
|
+
*
|
|
1032
|
+
* 判据:先给一段宽限期(默认 10 分钟,约 5 个轮询周期)。
|
|
1033
|
+
* 宽限期内只写 lastDeferred(不记失败、不退避);过了宽限期才认定真的没了。
|
|
1034
|
+
*/
|
|
1035
|
+
export const SESSION_MISSING_GRACE_MS = 10 * 60 * 1000
|
|
1036
|
+
|
|
1037
|
+
export function sessionMissingVerdict({ missingSince, now = Date.now(), graceMs = SESSION_MISSING_GRACE_MS } = {}) {
|
|
1038
|
+
const since = Date.parse(String(missingSince || ''))
|
|
1039
|
+
if (!Number.isFinite(since)) {
|
|
1040
|
+
return { grace: true, startedAt: new Date(now).toISOString(), waitMin: Math.ceil(graceMs / 60000), justNow: true }
|
|
1041
|
+
}
|
|
1042
|
+
const left = graceMs - (now - since)
|
|
1043
|
+
if (left > 0) return { grace: true, startedAt: new Date(since).toISOString(), waitMin: Math.max(1, Math.ceil(left / 60000)) }
|
|
1044
|
+
return { grace: false, waitedMin: Math.max(1, Math.round((now - since) / 60000)) }
|
|
1045
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.173",
|
|
4
4
|
"description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|