Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

fix(models): 删除分组的确认框只在写成功之后收起,被拒的分组回到页面上(条目 7.12)

lmliheng7b469efb9131
diff --git a/changelog/unreleased/2026-10-20-models-delete-group.md b/changelog/unreleased/2026-10-20-models-delete-group.md
new file mode 100644
index 00000000..bb6acd17
--- /dev/null
+++ b/changelog/unreleased/2026-10-20-models-delete-group.md
@@ -0,0 +1,34 @@
+# Delete group: the confirmation closes only after the delete lands
+
+- **Date:** 2026-10-20
+- **Type:** fix
+- **Scope:** `web`
+- **Breaking:** no
+
+[中文版](2026-10-20-models-delete-group.zh.md)
+
+A user-defined group's "Delete group" asks first, naming the group and how many models — and
+their API keys — go with it. It used to dismiss that confirmation as soon as the request left,
+**whether the delete had succeeded or not**, while `persist` keeps the attempted rows so a field
+edit the user is still holding is not lost. A refused delete therefore left the page *without*
+the group while the server still held it — and the group's header carried the only entry point
+to this action, so it went with the group: nothing was left to retry from, and the error toast
+was the only trace of the refusal.
+
+Now the delete is written before the confirmation is dismissed, and a refused one puts the group
+back on the page.
+
+## Details
+
+- The confirmation stays open until the table write lands; on a refusal the sentence and its
+ count stay verbatim, the error toast shows the server's own words, and the retry is that same
+ confirmation.
+- A refused write restores the table from before the delete, so the group and its "Delete group"
+ action are still there — and the count in the sentence still matches what the retry would
+ remove.
+- The confirmation is marked busy while the request is in flight: its buttons are disabled, so a
+ second click cannot start a second write.
+
+## Compatibility
+
+- No API, wire-format or dependency change: this is only the order of writing and dismissing.
diff --git a/changelog/unreleased/2026-10-20-models-delete-group.zh.md b/changelog/unreleased/2026-10-20-models-delete-group.zh.md
new file mode 100644
index 00000000..fc3b9e82
--- /dev/null
+++ b/changelog/unreleased/2026-10-20-models-delete-group.zh.md
@@ -0,0 +1,27 @@
+# 删除分组:写成功才收起确认框,被拒的分组回到页面上
+
+- **Date:** 2026-10-20
+- **Type:** fix
+- **Scope:** `web`
+- **Breaking:** no
+
+[English](2026-10-20-models-delete-group.md)
+
+用户自定义分组的「删除分组」会先问一句,说明要删的是哪个分组、组内几个模型连同它们的 API key 一起
+移除。而它此前在请求发出时就关闭确认框,**不管删没删成**;同时 `persist` 会保留尝试中的表(那是为了
+让正在填写的字段编辑不丢)。于是被拒的那次删除让页面**没了这个分组**,服务器却仍然留着它 —— 更难受的
+是「删除分组」这个入口就长在分组表头上,它与分组一起消失了:没有地方可以重试,只剩一句错误提示。
+
+现在删除把写入做完之后才收起确认框,被拒时把分组放回页面。
+
+## 细节
+
+- 确认框一直开到表写入有结果为止;被拒时句子与它写的条数原样留着,错误提示照旧显示服务端那句话,
+ 重试就是同一张确认框。
+- 写入被拒时用删除前的表恢复页面,因此分组与它的「删除分组」按钮都还在,句子里的条数也仍然与重试
+ 将要删掉的一致。
+- 请求在飞的时候确认框标为 busy(按钮禁用),连点不会发出第二次写入。
+
+## 兼容性
+
+- 没有接口、传输格式或依赖变化;只改了页面里写入与收起的先后。
diff --git a/docs/FORK-PROGRESS.md b/docs/FORK-PROGRESS.md
index b97759ad..e1429439 100644
--- a/docs/FORK-PROGRESS.md
+++ b/docs/FORK-PROGRESS.md
@@ -1165,6 +1165,17 @@ mock 路由导入序、`chat-page.tsx` 的旧探针体),自带 4 份用例
3.6 模型 key、4.1–4.3 明令不动、5.6 / 5.10 拍板 / 新依赖),而这一条是一处**用户会撞上的真缺陷**,
不是补测试。细节、两态实测与反证见该节。
+- [x] **7.12 模型库「删除分组」的确认框只在写成功之后收起**(**2026-10-20 第八十九轮**落地,
+ 提交见该节;`models-page.tsx` 一处真修复 + 1 个新文件 `packages/web/e2e/models-delete-group.spec.mjs`
+ (两条用例)+ changelog 一对,**无新依赖、不碰接口、不改文档**):第八十八轮末尾记下的那件,也是
+ 「先写成功再收起」这条线索的第四种形态。**量出来的缺陷**:用户自定义分组的「删除分组」确认框
+ 在请求发出时就关闭,而 `persist` 为「用户还握着的字段编辑」保留了尝试中的表 —— 于是被拒的那次
+ 删除让**分组从页面上消失**、服务器却仍然留着它;更难受的是「删除分组」这个入口就长在分组表头上,
+ 它与分组一起没了(实测:`dialog 0`、页面上 `probegroup` 出现 **0** 次、服务器仍是 **2** 行、
+ 「删除分组 probegroup」按钮不见了),只有刷新才能脱身。**现在**:删除写成功之后才关框;被拒时
+ 先把表退回删除前,句子与条数原样留着,重试就是同一张确认框;确认框在请求在飞时标为 `busy`。
+ 细节、两态实测与反证见该节。
+
## 发布 v0.2.0(2026-10-05)
用户要求「先发布最新版本到 GitHub,说明是基于 penguin harness 做的」。这一版是**源码版**:
@@ -1774,6 +1785,7 @@ v0.2.2」——它只加台账里 v0.2.2 那一节与两行表格,**跟本轮
| 2026-10-19 | 7.9 | **成本中心「清空错误」的确认与写入顺序**(不是移植:一处真修复 + 本仓自己的测试设施;源码 4 个 -- 服务端仓储/服务/路由各一处加 `until`、web 的 `endpoints.ts` 与 `errors-panel.tsx`,另有 `server-api` 中英文档、changelog 一对、1 个新 e2e 文件与 1 条服务端用例):量出来的缺陷是**确认框写的条数比删掉的少** —— 句子的数字取自仪表盘快照,而加载成本中心自己会记一条错误(成员界面读机器列表得到 403 `admin_required`,算预期内),所以「将删除……1 条」后面跟着 `{deleted: 2}`。现在点「清空」先按屏幕上的过滤条件重读一页(`limit: 1`),用它的 `total` 写句子、用这一页最新记录的 `ts` 作 `until` 发给 `DELETE /usage/errors`(新可选参数,只删 `ts <= until` 的行),两次请求之间到达的记录因此被留下。「清空」按钮在读取期间置灰;范围为空的竞态下不弹框、直接刷新;删除失败时框与句子都留着 | 六包 `typecheck` **`EXIT=0`**(core / server / web / ui / cli / hmr 六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`(192 接口 / 587 类型)**,本笔不动契约字段)· `npx oxlint` **0 警告 0 错误**(2219 文件)· 改动文件 `prettier --check` 干净(新 spec 首跑一条,`--write` 后复检)· `git diff --check` 干净 · 逐包 test **`EXIT=0`、0 失败**:core **1399 / 6 跳过**(68 文件)· ui **1043**(129)· cli **561**(38)· web **260 文件 / 3202 通过 / 2 跳过** · server **201 文件 / 2947 通过 / 4 跳过**(+1 正是本笔新用例)· **真服务 + 真浏览器整套 e2e**(`SKIP_BUILD=1 pnpm -C packages/web test:e2e`,自带 `mktemp` 数据根、mock 在 8931、服务端在 8930):**91 passed(7.1m)、0 failed**(原 89 条 + 本笔 2 条;本笔单跑 7.2s,另在一个被前几次试跑弄脏的数据根上反复跑通)· **反证一(面板换回 `HEAD` 那一版:快照计数、不发 `until`,重建 web)**:用例①**红** —— 打开确认框后 15 s 内没有任何计数读取(`page.waitForResponse` 超时),恢复后 **2 passed** · **反证二(`ErrorsRepo.conds` 里拿掉 `until` 条件)**:新服务端用例红在 `deleted` 为 3(应为 2,晚到的那条一起被删),恢复后 `errors.test.ts` **64 passed** · **改前的一次性探针带出的实情**:`dashboard errors.total at load 1`、随后 API 读到 `expected/admin_required×1 + unexpected/llm_fatal×1`、句子「近 7 天内的 1 条错误记录」、`{deleted: 2}` · 端口只用 8960 / 8961(探针与迭代)与 8930 / 8931(整套,跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;数据只落在 `/root/adelie-fork-data/r86{,-look}`,一个字节没往 `~/.penguin` / `~/.adelie` 里写(`packages/*/dist` 与 `test-results/` 都是产物,未 `git add`)· 没有切版本号、没发 npm、没发安装包、没发发布汇总 | `6f1b9c11` |
| 2026-10-19 | 7.10 | **公司竖栏(公司模式侧栏折起来的 48 px 竖栏)的频道提示有了真浏览器用例**(不是移植,是补本仓自己的测试设施;1 个新文件 `packages/web/e2e/company-rail-hints.spec.mjs`、两条用例,changelog 一对,**无源码改动、无新依赖**):第八十五轮钉的是开发模式竖栏与右侧停靠面板,公司模式那根条一直只有 `packages/ui` 的单测 —— 它的行把未读数(或「@我」数)折进同一句提示、排在页面入口之下、当前频道那行带 `aria-current`。用例①:创造组织 → 切公司模式 → 打开全员频道 → 折成竖栏(等宽度动画落定)→ 悬停「全员频道」,面板由 `left` 定位在行的右边缘 + 8、整块在竖栏之外、竖直居中(±1.5 px)、整块在窗口内、`maxWidth` 的 `room` = 视口宽 − left − 8,指针移开即消失;用例②:另一位成员在本读者离开频道后写一条,重载后行名与提示都是「全员频道 · N 条未读」(N 取自服务端频道列表,不写死),徽标 `aria-hidden` 所以提示与可访问名必须说同一整句、面板不重复 | 六包 `typecheck` **`EXIT=0`**(core / server / web / ui / cli / hmr 六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`(192 接口 / 587 类型)**)· `npx oxlint` 对新文件 **0 警告 0 错误** · 新文件 `prettier --check` 干净(首跑一条,`--write` 后复检)、`git diff --check` 干净 · 逐包 test **`EXIT=0`、0 失败**:core **1399 / 6 跳过**(68 文件)· ui **1043**(129)· cli **561**(38)· web **260 文件 / 3202 通过 / 2 跳过** · server **201 文件 / 2947 通过 / 4 跳过** · **真服务 + 真浏览器整套 e2e**(`SKIP_BUILD=1 pnpm -C packages/web test:e2e`,自带 `mktemp` 数据根、mock 在 8931、服务端在 8930):**93 passed(7.2m)、0 failed**(原 91 条 + 本笔 2 条;本笔单跑 7.5 s,另在 8960 上自起服务反复跑通)· **反证一(拿掉行上的 `data-tooltip-placement="right"`,重建 web)**:两条都**红**在「面板从行的右侧间隙开始」(面板改由下方展开,`left` 落在 8),恢复后 **2 passed** · **反证二(`badgeNote` 返回 `null`,重建 web)**:第二条红在「按那句完整名字找不到这一行」,第一条照旧绿,恢复后 **2 passed** · 端口只用 8960 / 8961(探针与迭代)与 8930 / 8931(整套,跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;数据只落在 `/root/adelie-fork-data/r87`,一个字节没往 `~/.penguin` / `~/.adelie` 里写(`packages/*/dist`、`test-results/` 都是产物,未 `git add`)· 没有切版本号、没发 npm、没发安装包、没发发布汇总 | `23498a13` |
| 2026-10-19 | 7.11 | **模型库「同步预置」的写入顺序**(不是移植:`packages/web/src/features/models/models-page.tsx` 一处真修复(+25 −8)+ 1 个新文件 `packages/web/e2e/models-sync-order.spec.mjs`(两条用例)+ changelog 一对,**无新依赖、不碰接口、不改文档**):提醒上的「现在升级」开的确认框会列出这次同步将写入的每一条,而它此前在请求返回时就关闭 —— **写没写成功都关**;更难受的是 `persist` 为「用户还握着的字段编辑」保留了尝试中的表,被拒的那次合并仍留在页面上,重试从一张「看起来已经同步过」的表算出空差量,回一句「预置模型已是最新」、**一个 PUT 都不发**,服务器仍是旧表、上方提醒还列着缺的每一条,只有刷新才出得来。现在 `syncPresets` 返回「这张表现在是否已是目录的样子」,被拒时先把表恢复成写入前、再重读提醒探针;确认框只在回真时关闭,句子与它列的 refs 原样留着,错误提示照旧显示服务端那句话,重试用同一张确认框;工具栏 / 模型卡 / 配置对话框里的同一动作也跟着回退表 | 六包 `typecheck` **`EXIT=0`**(core / server / web / ui / cli / hmr 六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`(192 接口 / 587 类型)**)· `npx oxlint` **0 警告 0 错误**(2221 文件)· 改动文件 `prettier --check` 干净 · `git diff --check` 干净 · 逐包 test **`EXIT=0`、0 失败**:core **1399 / 6 跳过**(68 文件)· ui **1043**(129)· cli **561**(38)· web **260 文件 / 3202 通过 / 2 跳过** · server **201 文件 / 2947 通过 / 4 跳过** · **真服务 + 真浏览器整套 e2e**(`SKIP_BUILD=1 pnpm -C packages/web test:e2e`,自带 `mktemp` 数据根、mock 在 8931、服务端在 8930):**95 passed(7.1m)、0 failed**(原 93 条 + 本笔 2 条;本笔单跑 1.8 s,在同一数据根上连跑两次都绿)· **反证(`models-page.tsx` 换回 `HEAD` 那一版并重建 web)**:两条用例都**红**在「被拒之后确认框还在」(`dialog` 找不到),恢复源码、重建后 **2 passed** · **改前探针量到的实情**:拒绝后 `dialog 0`、重试的 PUT 计数停在 1(即重试**没有发请求**)、toast「预置模型已是最新」、服务器仍是 **189** 条、提醒仍写「185 个预置模型可同步」;改后拒绝时 `dialog 1`、句子与列表逐字不变、表已回退(按 `z-ai/glm-5.3-flash` 搜索得「没有匹配的模型」)、重试后服务器 **190** 条、toast「预置模型已同步:新增 1、更新 184」、提醒消失;console 只有按设计的 `GET …/machines` **403** 与刻意造的那一次 **500** · 端口只用 8970(探针)与 8930 / 8931(整套,跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;数据只落在 `/root/adelie-fork-data/r88a`,一个字节没往 `~/.penguin` / `~/.adelie` 里写(`packages/*/dist`、`test-results/` 都是产物,未 `git add`)· 没有切版本号、没发 npm、没发安装包、没发发布汇总 | `24570540` |
+| 2026-10-20 | 7.12 | **模型库「删除分组」的确认框只在写成功之后收起**(不是移植:`packages/web/src/features/models/models-page.tsx` 一处真修复(+19 −4)+ 1 个新文件 `packages/web/e2e/models-delete-group.spec.mjs`(两条用例)+ changelog 一对,**无新依赖、不碰接口、不改文档**):用户自定义分组的「删除分组」确认框此前在请求发出时就关闭,而 `persist` 保留尝试中的表(那是给字段编辑的),于是**被拒的删除让分组从页面上消失、服务器却仍留着它** —— 更难受的是这个入口就长在分组表头上,它与分组一起没了(实测:`dialog 0`、`probegroup` 在页面上 0 次、服务器仍 2 行、「删除分组 probegroup」按钮不见),只有刷新才能脱身。**现在**:删除写成功之后才关框;被拒时 `setRows(before)` 把表退回删除前,句子与条数原样留着、分组与它的按钮都回来,重试就是同一张确认框;请求在飞时确认框标 `busy`(按钮禁用)。**为什么是它**:待办里能一轮做完的条目至此仍然没有(2.2c 桌面壳 / 部署单元、3.5 拍板、3.6 模型 key、4.1–4.3 明令不动、5.6 / 5.10 拍板 / 新依赖),而这一条是一处用户会撞上的真缺陷 | 六包 `typecheck` **`EXIT=0`**(六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`(192 接口 / 587 类型)** —— 本笔不动服务契约)· `npx oxlint` **0 警告 0 错误**(2222 文件)· 改动四个文件 `prettier --check` 干净 · `git diff --check` 干净 · 逐包 test **`EXIT=0`、0 失败**:core **1399** / 6 跳过(68 文件)· ui **1043**(129)· cli **561**(38)· web **260 文件 / 3202 通过 / 2 跳过** · server **201 文件 / 2947 通过 / 4 跳过** · **真服务 + 真浏览器整套 e2e**(`SKIP_BUILD=1 pnpm -C packages/web test:e2e`,脚本自己的 `mktemp` 数据根、mock 8931 / 服务端 8930):**97 passed(7.1m)、0 failed**(原 95 条 + 本笔 2 条)· **反证**:`models-page.tsx` 退回 `HEAD` 那一版并重建 web → 两条用例都红,都死在「被拒之后确认框还在」(element(s) not found,16.6 s / 16.5 s);恢复后 2 passed,连同 7.11 那两条一起跑 4 passed · **两态实测**(一次性数据根 `/root/adelie-fork-data/r89`、`localhost:8985`、用户 `r89refuse` / `r89retry`,一个 `probegroup` 自定义分组两条手加行):**改前**被拒后 `dialog 0`、页面上分组名 0 次、服务器 2 行、重试按钮不可见;**改后**被拒后确认框仍在且句子逐字不变、分组与「删除分组」按钮都在、搜索 `probe-a` 找得到那一行、服务器仍 2 行;放行重试 → 框关、PUT 1→2、toast「已删除分组(2 个模型)」、页面与服务器都 0 行;两态 console 只有按设计的 `GET …/machines` 403 与刻意造的 500,无其它 error / ≥400;截图 `r89/shots/{refused,deleted}.png`、探针与两态 JSON 在 scratchpad · 端口只用 8985 / 8930 / 8931(跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;数据只落在 `/root/adelie-fork-data/r89`,一个字节没往 `~/.penguin` / `~/.adelie` 里写(`packages/*/dist`、`test-results/` 都是产物,未 `git add`)· 没有切版本号、没发 npm、没发安装包、没发发布汇总 | 见本行提交 |
> **2026-10-11 与另一条线的交汇(第三十七轮)**:定时任务触发时(07:00)`git status --short` **不干净**
> —— 另一条线(会话 `session-2026-10-05-20-32-50-2ee69aba`)正在做**用户点单**的「回复能复制成纯文本」
@@ -11537,3 +11549,99 @@ Escape 再来一次,四次的预算。连跑三次稳定。
仪表盘仍是加载时那个数);再往后可以看**模型库「删除分组」的确认框**(代码里同样先关框再写,
没有任何用例钉住它)。
- 卡点原地:**2.2c**、**3.5**、**3.6**、**4.2** / **4.3**、**5.6** / **5.10**。
+
+## 第八十九轮:删除分组的确认框只在写成功之后收起(2026-10-20,条目 7.12)
+
+### 开工自检与选活理由
+
+- 同步:开工时 `git status --short` 干净,`main` 停在 `92ca0803`(第八十八轮的台账笔),
+ `git fetch origin && git merge --ff-only origin/main` = Already up to date(没切分支、没碰
+ `legacy/main`、没推 upstream)。
+- 上游:`/root/penguin-harness` 仍不在;`refs/adelie-tmp/upstream-main-r87` = **`e32ca1ea`**,
+ 这一轮没有再拉一次(第八十七轮刚拉过,尖端没动)。
+- 待办里最靠前的未勾选条目仍是 **2.2c**(剩下的活全在桌面壳一侧与既有部署单元里,本轮纪律不许碰
+ desktop),其后 **3.5**(要拍板)、**3.6**(模型 key)、**4.1–4.3**(明令不动)、**5.6** / **5.10**
+ (要拍板 / 新依赖)同样不可动;7.1–7.11 已勾掉。于是照第八十八轮末尾的建议做
+ **7.12**:模型库「删除分组」的写入顺序 —— 同一串「先写成功再收起」线索的第四种形态,量出来是
+ 一处真缺陷。
+
+### 先量清楚(真服务 + 真浏览器,不是推测)
+
+一次性数据根 `/root/adelie-fork-data/r89`,服务端起在 `localhost:8985`
+(`ADELIE_PROFILE=dev`、`ADELIE_SEED_ADMIN_PASSWORD=penguin-2026`),普通用户 `r89refuse`、
+视口 1280×900。夹具经 API 走真表 PUT:往该 Project 的模型表里加一个**用户自定义分组**
+`probegroup`(两条手加行 `probe-a` / `probe-b`,`clientType: openai-chat`)—— 用户自定义分组
+是唯一带「删除分组」这个动作的一类(内置分组是目录身份,行只能逐条删)。改前(`HEAD` 那一版产物)
+实量出:
+
+- **写被拒,确认框照样关闭**:`page.route` 把 `PUT …/models` 拒成 500(`models_store_closed`)后
+ `role=dialog` 计数 **0**,页面上只剩 toast「models store is closed」。
+- **分组从页面上消失,服务器仍留着它**:`probegroup` 在页面上出现 **0** 次,服务器那张表仍是
+ **2** 行(`persist` 保留尝试中的表,那是给字段编辑的)。
+- **没有地方可以重试**:「删除分组 probegroup」这个按钮长在分组表头上,它随分组一起消失
+ (`isVisible()` = false),只有刷新页面才能把它弄回来。
+
+### 改了什么(1 个源码文件、1 个新 spec、changelog 一对)
+
+- `packages/web/src/features/models/models-page.tsx`(`+19 −4`):删除分组的确认框
+ - `busy={busy}` —— 请求在飞时两个按钮都禁用(`ConfirmModal` 的既有语义),连点不会发出第二次写。
+ - `onConfirm` 不再先 `setDeleteGroupFor(null)`;写入之后按结果决定:成功才关框,被拒时
+ `setRows(before)` 把表退回删除前(分组与它的表头、它的「删除分组」按钮都回来,句子里的条数也
+ 仍与重试将要删掉的一致)。写法沿用隔壁「同步预置」那张确认框的 `void persist(...).then(...)`。
+ - 理由写在注释里:那条线索在页面上只有这一个入口,被拒就丢分组等于把人锁在外面。
+- `packages/web/e2e/models-delete-group.spec.mjs`:新增,两条用例(见下)。
+- `changelog/unreleased/2026-10-20-models-delete-group.{md,zh.md}`:中英一对。
+- **没有新依赖、没有接口 / 传输格式变化**;`gen:ifaces` 报 `unchanged`。
+
+### 写进套件的两条用例(`packages/web/e2e/models-delete-group.spec.mjs`)
+
+两条用例各用一个用户(`r89refuse` / `r89retry`),夹具幂等:经 API 读表,分组不在(或行数不对)就
+整表 PUT 把它补回来 —— 第一条跑完分组还在(被拒),第二条跑完分组已被删掉,所以在同一数据根上再跑
+一次也成立(实测连跑两次都 2 passed)。断言里的数字全部来自页面自己收到的响应与重新读回的 Project 表。
+
+1. **「被拒的删除留着确认框、句子和分组」** —— 打开 `/models`、展开分组、点「删除分组」→ 记下句子;
+ `page.route` 拒掉 PUT:服务端那句话出现、PUT 恰好一次、**确认框仍在且正文逐字不变**;
+ 「删除分组 probegroup」按钮**仍在**(改前它随分组一起消失);在页内搜索 `probe-a` 找得到那一行
+ (被拒的删除确实退回去了,而不是只关了个框);重新读表 —— 条数与写之前相同、分组仍是 2 行;
+ 点「取消」后按钮还在。
+2. **「重试真的写、只有写成功才关闭确认框」** —— 同样的拒绝之后**同一张确认框**再点一次(放行):
+ 确认框消失、PUT 计数从 1 变 2、toast 写「已删除分组(2 个模型)」、分组与它的按钮都不在页面上,
+ 重新读表分组 0 行。
+
+### 验证
+
+- 六包 `typecheck`:**`EXIT=0`**,core / server / web / ui / cli / hmr 六个 `Done`;
+ `gen:ifaces` 报 **`src/ifaces.json unchanged`(192 接口 / 587 类型)**。
+- `npx oxlint`:**0 警告 0 错误**(2222 文件);改动的四个文件 `prettier --check` 干净;
+ `git diff --check` 干净。
+- 逐包 test:全部 `EXIT=0`、**0 失败** —— core **1399 通过 / 6 跳过**(68 文件)· ui **1043**(129)·
+ cli **561**(38)· web **260 文件 / 3202 通过 / 2 跳过** · server **201 文件 / 2947 通过 / 4 跳过**。
+- **真服务 + 真浏览器整套 e2e**(`SKIP_BUILD=1 pnpm -C packages/web test:e2e`:脚本自己的 `mktemp`
+ 数据根、mock 在 8931、服务端在 8930):**97 passed(7.1m)、0 failed**(原 95 条 + 本笔 2 条)。
+- **反证(`models-page.tsx` 换回 `HEAD` 那一版,重建 web)**:两条用例都**红**,都死在
+ 「被拒之后确认框还在」(`expect(dialog).toBeVisible()`:element(s) not found,16.6 s / 16.5 s);
+ 恢复源码、重建后 **2 passed**。同一轮里把 7.11 那两条(`models-sync-order.spec.mjs`)一起跑过,
+ 4 passed。
+- **真看一眼**(`r89retry`、1280×900,探针 `r89/probe-after.mjs`):被拒时确认框写着
+ 「确定删除分组「probegroup」?组内 2 个模型及其 API key 配置将一并移除。」、顶部 toast
+ 「models store is closed」,背后列表里 `probegroup 2` 与它的「删除分组」都还在;放行重试之后
+ toast「已删除分组(2 个模型)」、分组消失、侧栏「模型库」红点消失。console 只有一条**按设计**的
+ `GET …/machines` **403**(普通用户拿不到管理员端点)与刻意造的那一次 **500**,
+ **无其它 error、无其它 ≥400**。截图 `r89/shots/{refused,deleted}.png`、改前探针
+ `r89/probe-before.mjs`(它打出的那份 JSON 就是上面「先量清楚」的三个数)都在 scratchpad。
+- 端口只用 8985(探针)与 8930 / 8931(整套,跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;
+ 数据只落在 `/root/adelie-fork-data/r89`,一个字节没往 `~/.penguin` / `~/.adelie` 里写
+ (`packages/*/dist` 与 `test-results/` 都是产物,未 `git add`)。
+- 没有切版本号、没发 npm、没发安装包、没发发布汇总。
+
+### 下一轮从这里接
+
+- **待办里仍没有可做的一轮内条目**:2.2c(桌面壳 / 部署单元)、3.5(拍板)、3.6(模型 key)、
+ 4.1–4.3(明令不动)、5.6 / 5.10(拍板 / 新依赖);7.12 本轮勾掉。
+- 若还从「本仓自己的验证设施」里挑,下一件建议是 **成本中心确认框打开时顺手刷新仪表盘**
+ (第八十六轮记的可选后续:开框时重读的只有确认框需要的那一页,面板背后的仪表盘仍是加载时那个数)。
+ 再往后可以看**单条模型的「删除模型」**(`ModelDialog` 的 `action === "remove"`:对话框自己先关、
+ 再 `void persist(...)`,失败时同样留着尝试中的表)—— 与这一条同源,但要不要也改成「写成功才关」
+ 要看它关框之后是否还有入口能重试(分组表头没了是死路,单条模型的那一行没了也同理)。
+- **上游**:先看 `/root/penguin-harness` 在不在;不在就按 URL 路子拉一次,尖端仍是 `e32ca1ea` 的话没有新小件。
+- 卡点原地:**2.2c**、**3.5**、**3.6**、**4.2** / **4.3**、**5.6** / **5.10**。
diff --git a/packages/web/e2e/models-delete-group.spec.mjs b/packages/web/e2e/models-delete-group.spec.mjs
new file mode 100644
index 00000000..b138911c
--- /dev/null
+++ b/packages/web/e2e/models-delete-group.spec.mjs
@@ -0,0 +1,195 @@
+/**
+ * Regression: "Delete group" dismisses its confirmation only after the write landed, and a
+ * refused write puts the group back on the page.
+ *
+ * The confirmation names the group and how many models go with it. It used to close on the way
+ * out of the request, success or not, and `persist` keeps the attempted rows for a field edit
+ * the user is still holding — so a refused delete left the page *without* that group while the
+ * server still held it. Worse, the group's own header carries the only entry point to this
+ * action: it went with the group, so there was nothing left to retry from and no trace of the
+ * refusal beyond the toast. (Measured on the pre-fix build: dialog gone, zero matches for the
+ * group's name anywhere on the page, both rows still on the server, and the delete button — the
+ * only way back — absent.)
+ *
+ * Both tests work on a user-defined group seeded through the API: such a group exists only
+ * through its rows, which is why it is the one kind that carries the group-delete action at all.
+ * The seed is idempotent — the second test's user starts from the group already deleted by the
+ * first run of the file, and gets it back.
+ */
+import { test, expect } from "@playwright/test";
+import { provisionAndLogin } from "./auth.mjs";
+
+const BASE = process.env.BASE_URL;
+const P = "password123";
+
+/** The user-defined group both tests delete; unique enough that its name appears nowhere else. */
+const GROUP = "probegroup";
+
+/** The two rows the group is made of: hand-added models, which a user-defined group takes. */
+const ROWS = [
+ { provider: GROUP, modelId: "probe-a", displayName: "Probe A" },
+ { provider: GROUP, modelId: "probe-b", displayName: "Probe B" },
+];
+
+/** The table entry a `ModelInfo` came from: every field the response reports, sent back as-is. */
+function toEntry(m) {
+ const entry = { provider: m.provider, modelId: m.modelId };
+ for (const key of [
+ "displayName",
+ "contextWindow",
+ "clientType",
+ "vision",
+ "maxTokens",
+ "fastMode",
+ "pricing",
+ ]) {
+ if (m[key] !== undefined) entry[key] = m[key];
+ }
+ if (m.credential?.baseUrl !== undefined) entry.baseUrl = m.credential.baseUrl;
+ return entry;
+}
+
+/**
+ * Provision the user and make sure their Project holds the group (the second run on the same
+ * data root finds it already deleted or already seeded and leaves the table as it is).
+ */
+async function projectWithGroup(page, userId) {
+ await provisionAndLogin(page.request, userId, P);
+ const { projects } = await (await page.request.get(`${BASE}/api/projects`)).json();
+ const projectId = projects[0].projectId;
+ const read = async () =>
+ (await page.request.get(`${BASE}/api/projects/${projectId}/models`)).json();
+ const rowsOf = (table) => table.models.filter((m) => m.provider === GROUP);
+
+ let table = await read();
+ if (rowsOf(table).length !== ROWS.length) {
+ const put = await page.request.put(`${BASE}/api/projects/${projectId}/models`, {
+ data: {
+ defaultModel: table.defaultModel,
+ models: [
+ ...table.models.filter((m) => m.provider !== GROUP).map(toEntry),
+ ...ROWS.map((row) => ({
+ ...row,
+ contextWindow: 32000,
+ clientType: "openai-chat",
+ baseUrl: "http://127.0.0.1:9/v1",
+ maxTokens: 4096,
+ })),
+ ],
+ },
+ });
+ expect(put.ok(), "seed the user-defined group through the table PUT").toBeTruthy();
+ table = await read();
+ }
+ expect(rowsOf(table).length, "the Project holds the group").toBe(ROWS.length);
+ return { projectId, read, rowsOf };
+}
+
+/** Refuse every table write with a code the app has no local copy for, so the server's words show. */
+async function refuseWrites(page, seen) {
+ await page.route("**/api/projects/*/models", async (route) => {
+ if (route.request().method() !== "PUT") return route.fallback();
+ seen.push(route.request().url());
+ await route.fulfill({
+ status: 500,
+ contentType: "application/json",
+ body: JSON.stringify({
+ error: { code: "models_store_closed", message: "models store is closed" },
+ }),
+ });
+ });
+}
+
+/** Open the group's "Delete group" confirmation, expanding the group first when it starts folded. */
+async function openDeleteDialog(page) {
+ const button = page.getByRole("button", { name: `删除分组 ${GROUP}` });
+ if (!(await button.isVisible().catch(() => false))) {
+ await page.getByText(GROUP, { exact: false }).first().click();
+ }
+ await expect(button).toBeVisible();
+ await button.click();
+ const dialog = page.getByRole("dialog");
+ await expect(dialog).toBeVisible();
+ return dialog;
+}
+
+test("a refused group delete keeps its dialog, its sentence and the group the server has", async ({
+ page,
+}) => {
+ const { read, rowsOf } = await projectWithGroup(page, "r89refuse");
+ const before = await read();
+
+ await page.goto("/models");
+ const dialog = await openDeleteDialog(page);
+ const sentence = await dialog.innerText();
+ expect(sentence).toContain(GROUP);
+ expect(sentence).toContain(`${ROWS.length} 个模型`);
+
+ const puts = [];
+ await refuseWrites(page, puts);
+ await dialog.getByRole("button", { name: "确认" }).click();
+
+ // The write was refused and the dialog stays exactly as it was — same group, same count.
+ await expect(page.getByText("models store is closed")).toBeVisible();
+ expect(puts).toHaveLength(1);
+ await expect(dialog).toBeVisible();
+ expect(await dialog.innerText()).toBe(sentence);
+
+ // The group is back on the page, and its header still offers the way to this action: before
+ // the fix the refused delete took both away while the server kept the rows.
+ const deleteButton = page.getByRole("button", { name: `删除分组 ${GROUP}` });
+ await expect(deleteButton).toBeVisible();
+ const search = page.getByPlaceholder(/搜索模型/);
+ await search.fill(ROWS[0].modelId);
+ await expect(page.getByText(ROWS[0].displayName, { exact: false })).toBeVisible();
+ await search.fill("");
+
+ // And the server still holds the untouched table.
+ const after = await read();
+ expect(after.models.length).toBe(before.models.length);
+ expect(rowsOf(after).length).toBe(ROWS.length);
+
+ // Closing the dialog decides nothing.
+ await dialog.getByRole("button", { name: "取消" }).click();
+ await expect(dialog).toHaveCount(0);
+ await expect(deleteButton).toBeVisible();
+});
+
+test("the retry after a refused group delete writes it, and only a written one closes the dialog", async ({
+ page,
+}) => {
+ const { read, rowsOf } = await projectWithGroup(page, "r89retry");
+
+ await page.goto("/models");
+ const puts = [];
+ let refuse = true;
+ await page.route("**/api/projects/*/models", async (route) => {
+ if (route.request().method() !== "PUT") return route.fallback();
+ puts.push(route.request().url());
+ if (!refuse) return route.fallback();
+ await route.fulfill({
+ status: 500,
+ contentType: "application/json",
+ body: JSON.stringify({
+ error: { code: "models_store_closed", message: "models store is closed" },
+ }),
+ });
+ });
+
+ const dialog = await openDeleteDialog(page);
+ await dialog.getByRole("button", { name: "确认" }).click();
+ await expect(page.getByText("models store is closed")).toBeVisible();
+ await expect(dialog).toBeVisible();
+ expect(puts).toHaveLength(1);
+
+ // The retry is the same confirmation against the restored group, and it really deletes.
+ refuse = false;
+ await dialog.getByRole("button", { name: "确认" }).click();
+ await expect(dialog).toHaveCount(0);
+ expect(puts).toHaveLength(2);
+ await expect(page.getByText(`已删除分组(${ROWS.length} 个模型)`)).toBeVisible();
+ await expect(page.getByRole("button", { name: `删除分组 ${GROUP}` })).toHaveCount(0);
+
+ const after = await read();
+ expect(rowsOf(after)).toHaveLength(0);
+});
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index 694a48cc..7e23ef51 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -1680,20 +1680,35 @@ export function ModelsPage() {
open
title={S.models.deleteGroupTitle}
tone="danger"
+ busy={busy}
onClose={() => setDeleteGroupFor(null)}
onConfirm={() => {
const target = deleteGroupFor;
- setDeleteGroupFor(null);
+ const before = rows;
const removed = rows.filter((r) => r.provider === target);
- if (removed.length === 0) return;
+ if (removed.length === 0) {
+ setDeleteGroupFor(null);
+ return;
+ }
// Same pointer rule as single-model delete: a default/vision reference into the
// deleted group is dropped, otherwise the server rejects the dangling pair.
+ // Only a written delete dismisses the dialog. A refused one has to put the group
+ // back on the page as well: `persist` keeps the attempted rows for a field edit the
+ // user is still holding, but a refused group delete would otherwise leave the page
+ // without that group while the server still holds it — and the group's own header,
+ // the only way back to this action, goes with it, so the retry needs a reload
+ // (measured on a refused write: dialog gone, no `probegroup` anywhere on the page,
+ // 2 rows still on the server). Keeping the confirmation means the retry is the same
+ // click, against the sentence whose count the restored rows still match.
void persist(
- rows.filter((r) => r.provider !== target),
+ before.filter((r) => r.provider !== target),
defaultModel?.provider === target ? undefined : defaultModel,
visionModel?.provider === target ? undefined : visionModel,
S.models.groupDeleted(removed.length),
- );
+ ).then((saved) => {
+ if (saved) setDeleteGroupFor(null);
+ else setRows(before);
+ });
}}
confirmLabel={S.common.confirm}
cancelLabel={S.common.cancel}