feat(inject): .hung-disabled 启用方案2 — assemble 按 user turn 去重 + retry 例外

- shouldInjectAssembly(context, home): 开关存在时,只在 last message role===user
  或 __dshPurgeRetryPending 为真时放行,tool-call 回环返原 assembled
- rewriteFn(installAssembleGuard 路径) + system-prompt/assemble 回调两条路径同判断
- installHungPromptGlobal: hung 永久返空,把 patch #81 的 "system 不含 inject 时
  补塞" 补救逻辑废掉,让 inject 完全由 cordis 层决策,避免绕过规则
- continue-retry.js: tracker.takeRetry 成功后设 __dshPurgeRetryPending=true,
  下次 assemble 消费后清零 — 救场链路保留
This commit is contained in:
叫我小杨同学 committed 2026-10-09 21:20:01 +08:00
1 parent d35d8152cb
commit 9b07384038
2 files changed
+46 -5

No files matched your search

+4
View File
@@ -323,6 +323,10 @@ export function installContinueRetry(ctx, options = {}) {
const id = sessionIdOf(payload?.agent);
const key = `${payload?.turn || 0}:${payload?.step || 0}:${payload?.failure?.code || ""}`;
if (!tracker.takeRetry(id, key, cfg.retryMax)) return downstream;
// [方案2] 标记 retry pending,让下次 system-prompt/assemble 强制塞 inject
// (消费一次后由 shouldInjectAssembly 清掉)。user 发消息自然塞,不需要;
// retry 不是 user 触发,messages 结构没变,必须靠这个 flag 让 assemble 吃到。
globalThis.__dshPurgeRetryPending = true;
return { kind: "retry" };
});