decision-rules-hook: 注入补「两个停止点」+「技术方案排序轴」

起因(2026-10-06 用户问):能自决的问题为什么还要问。
复盘发现注入的判据里**缺动作**:
- 缺「十步」的两个停止点 → ① 判类型(方案请求 vs 直接执行)② 判方向(扩大/收窄/中性);
- 缺「自主裁决顺序」的排序轴 → 更小改动 → 更少新增形态 → **不扩大可见面**。
⇒ 前者导致「会扩大可见面」时不停手;后者导致排完仍把已定项混进待拍板清单(=变相征询)。
本次只补这两条动作骨架(1459 → 1906 字符),⛔ 不塞十步全文(避免稀释)。
This commit is contained in:
admin committed 2026-10-06 22:39:51 +08:00
1 parent 64dd82073b
commit 433d43af54
8 files changed
+195 -273

No files matched your search

+56 -18
View File
@@ -6606,25 +6606,63 @@ def t_keeper_legacy_ps1_form_gone():
④ `CREATE_NO_WINDOW` 在位;
⑤ `_find_keeper_tpl` 死代码已清。
"""
src = (HERE / "collabd.py").read_text(encoding="utf-8")
# 🔴🔴 2026-10-05 **必须剔注释 _和 docstring_ 再判**(同一课第 N 遍,这次真栽了):
# 考古记录**不止在 `#` 注释里** —— 还大量写在 **docstring**(`"""…"""`)里。
# 第一版只剔 `#` 行 ⇒ 744 行那句(在 `_escalate_to_keeper` 的 docstring 里)
# **照样命中** ⇒ 误红。⚠️ 「剔注释」≠「剔 docstring」,两者是**两件事**。
# ✅ 正解=用 `tokenize` 剔掉 COMMENT + STRING(最稳,不怕多行字符串/嵌套引号)。
_code = _strip_comments_and_docs(src)
# 🔴🔴 2026-10-06 **扩到三个文件**(本轮实测抓到的探照灯打偏):
# 原版只扫 `collabd.py` ⇒ 而**同族的 `init_workspace.py` 整份没被扫到**,
# 它揣着 `start-supervise.ps1.tpl` 路径拼接 + `-File start-supervise.ps1` 动作
# 活到今天(`_register_keeper_task` 又写了一份建任务代码 = 第二套起法)。
# ⚠️ 教训:**判据只扫"我以为哪个文件"就等于没扫** —— 凡是"这一族文件都不许有 X",
# 必须**枚举整族**,⛔ 不许只挑一个代表。
_FAMILY = ["collabd.py", "init_workspace.py", "collabctl.py"]
res = []
res.append(("⛔ 已无「读 `start-supervise.ps1.tpl`」的路径拼接(形态废弃 ⇒ 不该有人再找它)",
"start-supervise.ps1.tpl" not in _code))
res.append(("🔴 任务动作=`pythonw.exe` + 启动器 `supervise-launch.py`",
"New-ScheduledTaskAction" in _code and "supervise-launch.py" in _code
and "with_name" in _code and "pythonw.exe" in src))
res.append(("🔴 动作里**不再有** `-File start-supervise.ps1`(⛔ 壳脚本当看守=闪黑窗)",
"-File start-supervise.ps1" not in _code))
res.append(("🔴 `CREATE_NO_WINDOW`(0x08000000)在位(⛔ 缺了每次登记都闪一下)",
"0x08000000" in _code))
res.append(("`_find_keeper_tpl` 死代码已清(⛔ 留着会再招一批过期判据)",
"def _find_keeper_tpl(" not in _code))
_codes = {}
for _n in _FAMILY:
_p = HERE / _n
if not _p.is_file():
res.append((f"⛔ `{_n}` 存在(同族文件缺了 ⇒ 判据无从施加)", False))
continue
_s = _p.read_text(encoding="utf-8")
_codes[_n] = (_s, _strip_comments_and_docs(_s))
# ① 整族:⛔ 谁也不许再去找那份废模板
_bad = [n for n, (_, c) in _codes.items() if "start-supervise.ps1.tpl" in c]
res.append(("⛔ 全族已无「读 `start-supervise.ps1.tpl`」的路径拼接(形态废弃 ⇒ 不该有人再找它)",
not _bad))
# ② 整族:⛔ 谁也不许把壳脚本当看守
_bad = [n for n, (_, c) in _codes.items() if "-File start-supervise.ps1" in c]
res.append(("⛔ 全族动作里**不再有** `-File start-supervise.ps1`(⛔ 壳脚本当看守=闪黑窗)",
not _bad))
# ③ 建任务者:动作必须是 pythonw + 启动器
_mk = {n: c for n, (_, c) in _codes.items() if "New-ScheduledTaskAction" in c}
_ok = bool(_mk)
_ok = _ok and all("supervise-launch.py" in c for c in _mk.values())
_ok = _ok and all("pythonw.exe" in _codes[n][0] for n in _mk)
res.append(("🔴 建任务者(%s)动作=`pythonw.exe` + 启动器 `supervise-launch.py`"
% "/".join(sorted(_mk)), bool(_ok)))
# ④ 建任务者:`CREATE_NO_WINDOW` 在位
_bad = [n for n, c in _mk.items() if "0x08000000" not in c]
res.append(("🔴 建任务者 `CREATE_NO_WINDOW`(0x08000000)在位(⛔ 缺了每次登记都闪一下)",
not _bad))
# ⑤ ⭐⭐ **任务名口径必须唯一**(本轮抓到的病:`collabd.py` 建 `collabd-supervise-*`,
# 而 `collabctl.py` 建 `collabd-keepalive-*` ⇒ 前者在 `SCHED_TASKS` 禁用名单里
# ⇒ **自愈起的常驻会被下一次 `off` 当旧形态干掉**)
_names = set()
for n, c in _mk.items():
# ⚠️ **先剥掉「禁用名单」块再扫** —— `SCHED_TASKS` 里是**故意**列着旧名去**禁用它**的,
# 不剥就会把"它自己的否定句"当成违规。
# 🔴 这是本项目**第三次**踩同一个坑(前两次:查"PRD 有没有视觉词"命中免责声明、
# 查"有没有六份旧产出"命中 PRD 里的禁令文本)⇒ 判据凡扫文本,先问"这句是不是它的否定句"。
c2 = re.sub(r"SCHED_TASKS\s*=\s*\[[^\]]*\]", "", c)
_names |= set(re.findall(r'"collabd-(?:supervise|keepalive)-', c2))
res.append(("⭐⭐ 任务名口径唯一(建任务者只许用 `collabd-keepalive-`;"
"⛔ 出现 `collabd-supervise-` 会被 `off` 当旧形态禁掉)|实测命中:%s"
% (sorted(_names) or "无"),
_names == {"\"collabd-keepalive-"}))
# ⑥ init_workspace 侧:死代码已清
_iw = _codes.get("init_workspace.py", ("", ""))[1]
_dead = [d for d in ("def _register_keeper_task(", "def _keeper_task_state(",
"def _ps_check(", "def _find_keeper_tpl(") if d in _iw]
res.append(("`init_workspace.py` 旧形态死代码已清(⛔ 留着会再招一批过期判据)|实测残留:%s"
% (_dead or "无"), not _dead))
return res