fix(goose-v149): block unattended real LLM smokes by default

Prevent phase2/phase3/all reruns from burning DashScope tokens unless
GOOSE_V149_ALLOW_REAL_LLM=1 is explicitly set with human approval.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-09-09 22:08:39 +08:00
parent 9569d83e58
commit 67220a14ea
23 changed files with 184 additions and 8 deletions
+12 -8
View File
@@ -1,5 +1,7 @@
# Goose v1.49 本地 Canary 运行手册
> **2026-09-09 收口**:默认禁止真实 LLM 聚合 smoke`check-goosed-v149-all` / phase2 / phase3 等)。见 [goose-v149-real-llm-gate.md](./goose-v149-real-llm-gate.md)。仅 `GOOSE_V149_ALLOW_REAL_LLM=1` + 明确批准后可跑。
> 范围:仅本机 loopback`:18049` vs `:18006`),**禁止**连接 103/105 或修改生产 launchd。
> 决策表:[TKMIND_V1_49_MIGRATION.md](../TKMIND_V1_49_MIGRATION.md)
@@ -20,7 +22,8 @@ Memory 在 canary 期间保持 legacy ownerMySQL `h5_user_memory_items`),
```bash
bash scripts/build-goosed-v149-local.sh
bash scripts/ensure-goose-v149-local-db.sh
bash scripts/run-goosed-v149-local.sh # 另开终端,监听 :18049
# 默认已禁用;须明确批准:
GOOSE_V149_ALLOW_REAL_LLM=1 bash scripts/run-goosed-v149-local.sh # 另开终端,监听 :18049
curl -sk https://127.0.0.1:18049/status # → ok
```
@@ -64,14 +67,15 @@ pnpm dev
## 验证
```bash
# Phase 2 聚合(推荐日常)
node scripts/run-goosed-v149-phase2.mjs
# 以下默认 BLOCKED;须 GOOSE_V149_ALLOW_REAL_LLM=1 且有人值守,禁止 Agent 循环重跑:
# node scripts/run-goosed-v149-phase2.mjs
# node scripts/run-goosed-v149-phase3.mjs
# node scripts/check-goosed-v149-all.mjs
# Phase 3 收口(合并前)
node scripts/run-goosed-v149-phase3.mjs
# 单项 / 全量 smoke
node scripts/check-goosed-v149-all.mjs
# 无 LLM 的对照 / 单测(推荐日常):
node --test scripts/goose-v149-canary.test.mjs
node scripts/compare-goose-v149-message-sanitize.mjs
node scripts/compare-goose-v149-memory-manifest.mjs
node scripts/check-goosed-v149-memory-loop.mjs
node scripts/check-goosed-v149-portal-smoke.mjs # 主 Portal 重启后
node scripts/check-goosed-v149-canary-portal.mjs # 隔离 :8083
+2
View File
@@ -1,6 +1,8 @@
# Goose v1.49 Phase 3 收口清单
> **本阶段不授权 103/105 操作。** 仅整理证据、回滚路径与合并前闸门。
>
> **2026-09-09**:本机真实 LLM 聚合 smoke 已默认禁用,见 [goose-v149-real-llm-gate.md](./goose-v149-real-llm-gate.md)。`run-goosed-v149-phase3.mjs` 须 `GOOSE_V149_ALLOW_REAL_LLM=1` 且用户明确批准,禁止 Agent 循环重跑。
> 决策表:[TKMIND_V1_49_MIGRATION.md](../TKMIND_V1_49_MIGRATION.md) · Phase 2 台账:[goose-v149-phase2-evidence.md](./goose-v149-phase2-evidence.md)
## 聚合验证入口
+50
View File
@@ -0,0 +1,50 @@
# Goose v1.49 真实 LLM 测试闸门(2026-09-09 收口)
## 背景
本机 `:18049` v1.49 回归(`check-goosed-v149-all` / `run-goosed-v149-phase3` 等)在一天内可创建 **1000+** Goose session、消耗 **1 亿+** DashScope token,主要来自:
- Portal smoke / resume(完整 Agent 多轮 + 工具)
- Page E2E(苏州一日游等生页场景)
- Memory loop / chat
**默认禁止**再跑这类会调用真实模型的聚合 smoke;只允许显式 opt-in。
## 默认行为(收口后)
| 动作 | 无 opt-in | `GOOSE_V149_ALLOW_REAL_LLM=1` |
|------|-----------|--------------------------------|
| `bash scripts/run-goosed-v149-local.sh` | **拒绝启动** | 允许 |
| `node scripts/check-goosed-v149-all.mjs` | **立即退出 2** | 允许 |
| `node scripts/run-goosed-v149-phase2.mjs` | **立即退出 2** | 允许 |
| `node scripts/run-goosed-v149-phase3.mjs` | **立即退出 2** | 允许 |
| `node scripts/run-goosed-v149-missing-evidence.mjs` | **立即退出 2** | 允许 |
| 单测 / message sanitize / memory manifest 对照 | 仍允许 | 仍允许 |
Portal / page / resume smoke 在未 opt-in 时还会被强制 `*_SKIP=1`(即使单独跑子脚本)。
## 显式批准后再跑(一次性)
```bash
# 1. 仅在需要时启动 v1.49 goosed
GOOSE_V149_ALLOW_REAL_LLM=1 bash scripts/run-goosed-v149-local.sh
# 2. 另开终端,跑指定检查(勿循环 / 勿 CI 默认开启)
GOOSE_V149_ALLOW_REAL_LLM=1 node scripts/check-goosed-v149-reply-smoke.mjs
```
**禁止**Agent/Cursor 在未获用户明确批准时设置 `GOOSE_V149_ALLOW_REAL_LLM=1` 或循环重跑 phase2/phase3。
## 推荐替代
- 合并前优先:`node --test scripts/goose-v149-canary.test.mjs``compare-goose-v149-message-sanitize.mjs``compare-goose-v149-memory-manifest.mjs`
- 必须验证 Portal 集成时:单次、有人值守、先确认 DashScope 配额
## 回滚 Canary
若主 Portal 曾切到 `:18049`
```bash
bash scripts/switch-goose-v149-canary.sh rollback
# 重启 pnpm dev
```