Skip to content

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

fix(schedules): a refused delete keeps its confirmation and the reason (7.20)

lmliheng59b8425c179a
diff --git a/changelog/unreleased/2026-10-21-schedule-delete-refusal.md b/changelog/unreleased/2026-10-21-schedule-delete-refusal.md
new file mode 100644
index 00000000..38b516eb
--- /dev/null
+++ b/changelog/unreleased/2026-10-21-schedule-delete-refusal.md
@@ -0,0 +1,35 @@
+# A refused schedule delete keeps its confirmation and the reason in it
+
+- **Date:** 2026-10-21
+- **Type:** fix
+- **Scope:** `web`
+- **Breaking:** no
+
+[中文版](2026-10-21-schedule-delete-refusal.zh.md)
+
+Deleting a scheduled task asks first, and the three surfaces that list tasks — the Project's schedule page,
+the chat dock's scheduled-tasks panel, the Agent settings tab — used to close that card from a `finally`:
+success or refusal alike. A refused delete therefore left the row where it was (nothing was deleted) but
+took the reason with it, and that reason arrived as a toast that dismissed itself after six seconds and
+floated over the card instead of in it.
+
+The card now closes only once the delete landed. When the server refuses one, the card stays with its
+sentence — the task's name, unchanged — and the server's own words drawn under it, so the retry is the same
+button rather than a hunt through a list whose row is still there.
+
+## Details
+
+- The rule is the previous round's (`ConfirmModal`'s `refusal` slot, landed for the model library): the
+ reason is drawn inside the card that asked for the write, and an attempt clears the previous one first —
+ that sentence was about the previous attempt.
+- All three surfaces follow it: `features/schedules/schedules-page.tsx`, `features/schedules/schedule-panel.tsx`
+ and `features/agents/schedules-tab.tsx`. They list the same rows and share the confirmation, so a surface
+ left out would read differently from its neighbours.
+- The enable switch is untouched: it has no card, so its refusal stays a toast.
+- New browser spec `e2e/schedule-delete-refusal.spec.mjs` (four tests, one per surface plus the retry): a
+ refused delete keeps the card, its sentence and the row, and raises no toast; the retry writes it and only
+ a written one closes the card.
+
+## Compatibility
+
+- No API, wire-format or dependency change: this is only when the card closes and where its refusal is drawn.
diff --git a/changelog/unreleased/2026-10-21-schedule-delete-refusal.zh.md b/changelog/unreleased/2026-10-21-schedule-delete-refusal.zh.md
new file mode 100644
index 00000000..eadabf05
--- /dev/null
+++ b/changelog/unreleased/2026-10-21-schedule-delete-refusal.zh.md
@@ -0,0 +1,30 @@
+# 删除定时任务被拒时,确认框留着,原因也留在框里
+
+- **Date:** 2026-10-21
+- **Type:** fix
+- **Scope:** `web`
+- **Breaking:** no
+
+[English](2026-10-21-schedule-delete-refusal.md)
+
+删除定时任务要先确认,而列出任务的三个界面 —— 项目的定时任务页、对话侧栏的定时任务面板、Agent 设置页
+的定时任务表 —— 过去都在 `finally` 里关掉那张卡片:成功与失败一样关。于是被拒的删除虽然什么都没删
+(那一行仍在),原因却跟着框一起没了;那句话只出现在一条六秒后自己消失、且浮在框上方的 toast 里。
+
+现在只有删除真的落地,卡片才关。服务端拒绝时,卡片留着它的句子 —— 任务名一字未改 —— 服务端的原话画在
+句子下面,于是重试就是同一个按钮,而不是去一个「那一行明明还在」的列表里翻找。
+
+## 细节
+
+- 规则是上一轮留下的(`ConfirmModal` 的 `refusal` 槽,先在模型库落地):原因画在发起写入的那张卡片里,
+ 而且一次尝试先撤掉上一次的原因 —— 那句话说的事是上一次。
+- 三个界面都照做:`features/schedules/schedules-page.tsx`、`features/schedules/schedule-panel.tsx`、
+ `features/agents/schedules-tab.tsx`。它们列的是同一批行、共用同一张确认框,漏掉一个界面就会与旁边
+ 那个读起来不一样。
+- 启停开关不动:它没有框可留,被拒时仍用 toast。
+- 新增浏览器用例 `e2e/schedule-delete-refusal.spec.mjs`(四条:三个界面各一条,加一条重试):被拒的删除
+ 留着卡片、句子与那一行,且不弹 toast;重试真的写进去,而只有写成功的那一次才关框。
+
+## 兼容性
+
+- 没有接口、传输格式或依赖变化;只改了卡片什么时候关、拒绝提示画在哪。
diff --git a/docs/FORK-PROGRESS.md b/docs/FORK-PROGRESS.md
index 50c2c7ed..0d9ee197 100644
--- a/docs/FORK-PROGRESS.md
+++ b/docs/FORK-PROGRESS.md
@@ -1258,6 +1258,18 @@ mock 路由导入序、`chat-page.tsx` 的旧探针体),自带 4 份用例
「写成功才收起」的用例可延长),余下的页面同一条规则、只差逐页接 `refusal` 与各自的用例。
细节、反证与截图见该节。
+- [x] **7.20 删除定时任务被拒时,确认框留着,原因也留在框里**(**2026-10-21 第九十九轮**落地,
+ 提交见该节;三个界面各一处真修复(`features/schedules/schedules-page.tsx` /
+ `features/schedules/schedule-panel.tsx` / `features/agents/schedules-tab.tsx`)+ 1 个新文件
+ `packages/web/e2e/schedule-delete-refusal.spec.mjs`(4 条用例)+ changelog 一对,
+ **无新依赖、不碰接口**):7.19 末尾点的「这一族还有十几个页面」的第一个 —— 定时任务的那三个
+ 界面(项目页、对话停靠面板、Agent 设置页的表)列的是同一批行、共用同一张确认框,而三处的
+ `confirmRemove` 都在 `finally` 里关框:**被拒的删除什么都没删**(那一行仍在、服务器仍持有它),
+ 却把**原因**带走了,那句话只出现在一条六秒后自己消失、且浮在框上方的 toast 里。**现在**:只有
+ 删除真的落地才 `setDeleting(null)`;被拒时把服务端原话交给 `ConfirmModal` 的 `refusal` 槽(7.19
+ 给 `ui` 加的那个),画在句子下面、重试按钮正上方,重试就是同一个按钮。启停开关不动(没有框可留,
+ 被拒仍用 toast)。细节、两态读数与反证见该节。
+
## 发布 v0.2.0(2026-10-05)
用户要求「先发布最新版本到 GitHub,说明是基于 penguin harness 做的」。这一版是**源码版**:
@@ -1875,6 +1887,7 @@ v0.2.2」——它只加台账里 v0.2.2 那一节与两行表格,**跟本轮
| 2026-10-20 | 7.17 | **停靠栏的取样等它落定:`dock.spec` 的 24 px 松口子与三处猜时长的 `waitForTimeout(200)`**(不是移植:1 个新文件 `packages/web/e2e/settle.mjs`(`settledBox()` —— 逐帧读 `getBoundingClientRect()`,连续两帧在 0.5 px 内一致才返回;元素离场、或 10 s 还没停稳,直接报错而不是返回一个还在动的数)+ `dock.spec.mjs` 三处(恢复那条 `|h − after| < 24` → 等停稳后 `≤ 2`;拖拽前的 `before` 由一次性读改成停稳后读;全屏那段手写的「两帧宽度相等」轮询 → `settledBox(composer)`)+ `layout.spec.mjs` 三处(`waitForTimeout(200)` 的弹入等待 → `settledBox(panel|picker|finder)`),无新依赖、不碰产品代码):逐帧量到的实情 —— 右停靠栏宽度 1 → 8.88 → 43.78 → … → 510 → 512(~293 ms,旁边的会话列跟着缩:composer 746 → 428)、底栏高度 1 → 6.03 → 29.75 → 82.33 → 159.27 → … → 333.92 → 346.66 → 348(~289 ms)、刷新后的恢复 29.61 → 82.3 → … → 348、全屏的 `data-fullscreen` 要到 ~278 ms 才从 `entering` 转 `full`(而 header 一上来就是 992 宽、只抖 ±1 px,所以量到它的那几条本来就对,不必再改)、抽屉 `.anim-drawer-left` 240 ms 但**没有任何用例打开它**、菜单弹入 `.anim-pop` 170 ms(三处 200 ms 的余量只剩 30 ms)。老等待的松口子在放慢 7× 的过渡下停在 324.88(停稳 346.22,差 21.34 px) | 六包 `typecheck` **`EXIT=0`**(六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`(193 接口 / 589 类型)**,本笔不碰源码)· 逐包 test **`EXIT=0`、0 失败**:core **1399 通过 / 6 跳过**(68 文件)· ui **1043**(129 文件)· cli **561**(38 文件)· server **202 文件 / 2955 通过 / 4 跳过** · web **261 文件 / 3212 通过 / 2 跳过** · 改到的两份 spec 加 `mobile-dock` 同服务连跑 **17 passed(1.1m)** · **整套 e2e**(`pnpm -C packages/web test:e2e`:重建 core/server/web、脚本自己的 `mktemp` 数据根、mock 8931 / 服务端 8930)**105 passed(7.6m)、0 failed** · **反证(真浏览器、同一份恢复动画,老等待与新等待并排量)**:老等待真速下停在 346.66(离 348 差 1.34 px),放慢到 1.4 s 后停在 324.88(差 21.34 px,即 `|h − after| < 24` 会放行一个离停稳位置还差五分之一的盒子);`settledBox` 真速读到 348.00、放慢 1.4 s 读到 346.22(离目标 1.78 px,这就是断言留 2 px 而非严格相等的原因)· 真看一眼:`r95/shots/docks-1280.png`(右侧记忆 + 底部轨迹两个停靠栏)与 `r95/shots/drawer-390.png`(390 宽手机抽屉),console 只有按设计的 `GET …/machines` 403,无其它 error / ≥400 · 端口只用 8940(一次性探针服务,已停)与 e2e 自己的 8930 / 8931(跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;数据只落在一次性 `/tmp/r95data.*` 与 e2e 自己的 `mktemp` 根,一个字节没往 `~/.penguin` / `~/.adelie` 里写 | `40620042` |
| 2026-10-21 | 7.18 | **缩放视口后的取样等过渡落定:`chat.spec` 那两处 `waitForTimeout(200)` 恰好等于侧栏宽度过渡的 200 ms**(不是移植:`packages/web/e2e/settle.mjs` 加一个 `settledTransitions()`(先让一帧落地,再等 `document.getAnimations()` 里每个正在跑的 `CSSTransition` 各自 `finished`,循环到列表为空;超时带着「还剩哪几个过渡、落在谁身上」报错)+ `chat.spec.mjs` 两处 `waitForTimeout(200)` 改成它,**无新依赖、不碰产品代码、不写 changelog**):第九十五轮末尾点的「唯一没核过的一处」—— 那两条用例先 `setViewportSize`(1280×900 → 877×438)再量工具栏里两个 span 是否重叠。**逐帧量到的实情**:`aside` 是 `hidden md:block w-64 lg:w-72` 且带 `transition … width 0.2s`,877 正好跨过 `lg` 档,于是侧栏 288 → 256 滑了**整整 200 ms**(280.39 → 273.34 → … → 256.11 → 256),把工具栏左半边一起拖着走(标题 x 304 → 272、「运行中」chip 487.73 → 455.73),而右对齐的 Token chip 同一帧就跳到 785.39 —— 旧等待与过渡时长一字不差,实测停稳要 **210 / 219 ms**(两次缩放),余量为零。**为什么不用 `settledBox`**:过渡开头 50 ms 只挪 7.6 px,「连续两帧一致」会把缩放前的 288 认成停稳。至此「等动画落定再量」这一族收口(停靠栏 / 全屏 / 抽屉 / 竖栏 / 弹入 / 缩放) | 六包 `typecheck` **`EXIT=0`**(六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`(193 接口 / 589 类型)** —— 本笔不碰源码)· 两份改动文件 `prettier --check` 干净、`npx oxlint` **0 警告 0 错误**、`git diff --check` 干净 · 逐包 test **`EXIT=0`、0 失败**:core **67 文件 / 1399 通过 / 6 跳过** · ui **129 / 1043** · cli **38 / 561** · web **261 文件 / 3212 通过 / 2 跳过** · server **202 文件 / 2955 通过 / 4 跳过** · **整套 e2e**(一次性 `mktemp` 数据根、mock 8931 / 服务端 8930):**105 passed(7.6m)、0 failed**;改到的 `chat.spec` 先单跑 **1 passed(11.4s)** · **反证(同页同一条缩放,老等待与新等待并排量,侧栏过渡放慢到 1.4 s 让差别看得见)**:去 877 时老等待读到侧栏 **284.77** / chip x **484.5**(停稳 256 / 455.73,差 28.77 px),新等待 1413 ms 后读到 256 / 455.73;回 1280 时老等待读到 **257.88** / **457.61**(停稳 288 / 487.73),新等待读到 288 / 487.73;真速下两套读数一致(`settledTransitions` 花 210 / 219 ms)· **这条用例的断言(两 chip 不重叠)今天两态都过** —— 修的是「量的是停稳的布局」这个前提,台账不写成抓到了假绿 · **两处 `layout.spec` 的 390 缩放**本轮量过、不是同一类:390 下 `aside` 是 `display: none`(宽度过渡不参与),200 ms 后只剩一枚 `rotate@svg`,页宽 200 ms 与停稳后逐字相同(390 / 390),故未改 · **真看一眼**:`r96/shots/{look-877,look-toolbar-877,look-1280}.png`,877 下顶栏「运行中」与 Token `0` / 耗时 `0s` 并列不重叠,console 只有按设计的 `GET …/machines` **403**,无其它 error / ≥400;1280 下 `scrollWidth = clientWidth = 1280` · 探针 `r96/probe-{viewport,who-moves,settle-transitions,old-vs-new,resize-390}.mjs` 在 scratchpad · 端口只用 8940 / 8930 / 8931(跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;数据只落在一次性 `/tmp/r96data.*` 与 e2e 的 `mktemp` 根,一个字节没往 `~/.penguin` / `~/.adelie` 里写 · 没有切版本号、没发 npm、没发安装包、没发发布汇总 · **汇报邮件仍发不出去**(993 / 465 的 TCP 都建不起来,同时 github 200,与第九十五轮同一类) | `d3bde807` |
| 2026-10-21 | 7.19 | **写入被拒的原因留在那张确认框里**(不是移植:`packages/ui` 的 `ConfirmModal` 多一个 `refusal` 槽(有内容时在句子下画一条 `NoticeStrip tone="danger" role="alert"`,没有时槽不画),`packages/web` 新增 `features/models/write-outcome.ts`(`WriteOutcome` / `refusalOf`)把 `persist` 的返回从 `boolean` 换成「写成了 / 被拒了 + 服务端原话」,模型库六处写入选各自把这句话画在哪:配置框四个动作画进它的确认框、删除分组与同步预置画进各自的框、分组密钥与工具栏同步预置与导入分组没有框可留故保留 toast;`common.refused()` 两句文案 + 四份 spec 收紧断言(`cardText()` 助手、`通知` 区必须没有 toast)、changelog 一对):第九十四轮逐处摸过「点击即关、失败只弹 toast」那一族之后留下的那件 —— 框留住了(7.9、7.11–7.15),**原因**却只在一条 6 秒后自己消失、还浮在框上方的 toast 里(`ui` 的时长表 error = 6000 ms)| 六包 `typecheck` **`EXIT=0`**(`gen:ifaces` = `src/ifaces.json unchanged`,193 接口 / 589 类型)· 11 份改动文件 `prettier --check` 干净、`npx oxlint` **0 警告 0 错误**、`git diff --check` 干净 · 逐包 test **`EXIT=0`、0 失败**:core **67 文件 / 1399 通过 / 6 跳过** · ui **129 / 1044** · cli **38 / 561** · web **262 文件 / 3215 通过 / 2 跳过** · server **202 文件 / 2955 通过 / 4 跳过**(中间红过一次:`todo-notice.test.ts` 的守卫读 `onAction` 里第一个 setter,改成先开框再清原因后转绿,没动守卫)· **整套 e2e 105 passed(7.4m)、0 failed**,改到的四份 spec 先单跑 **9 passed(18.4s)** · **反证**:把 `models-page.tsx` 暂存回去重建产物后同一批 spec **5 failed**(红的就是新的两类断言),`stash pop` 重建后 9 passed · **真看一眼**:`r97/look-refusal-card.png` 里句子下面就是 danger 色的「操作被拒绝:models store is closed」,`look-refusal-after-6s.png` 证明 6.5 秒后仍在框里,`通知` 区按钮数 **0**,1280 下 `scrollWidth = clientWidth`,console 只有按设计的 `/machines` 403 与注入的 500 · 端口只用 8941 / 8931(跑完已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰,数据只落 `/tmp/r97data.*` · 没有切版本号、没发 npm、没发安装包 | `449c27fb` |
+| 2026-10-21 | 7.20 | **删除定时任务被拒时,确认框留着,原因也留在框里**(不是移植:三个界面各一处真修复(`packages/web/src/features/schedules/schedules-page.tsx`、`features/schedules/schedule-panel.tsx`、`features/agents/schedules-tab.tsx` —— `confirmRemove` 只有写成功后 `setDeleting(null)`,被拒时 `setDeleteRefusal(apiErrorText(e))` 交给 `ConfirmModal` 的 `refusal` 槽,打开框时先清掉上一次的原因)+ 1 个新文件 `packages/web/e2e/schedule-delete-refusal.spec.mjs`(4 条用例)+ changelog 一对,**无新依赖、不碰接口**):7.19 末尾点的「这一族还有十几个页面」的第一个 —— 定时任务的三个界面列的是同一批行(`ScheduleRow`)、共用同一张确认框,三处的删除都在 `finally` 里关框,于是**被拒的删除什么都没删**(那一行仍在、服务器仍持有它)却把原因带走了,那句话只在一条六秒后自己消失、且浮在框上方的 toast 里。**量出来的缺陷**(改前,真服务 + 真浏览器,`DELETE …/schedules/look_probe` 拒成 500 `schedule store is closed`):`dialogs 0`、`reasonInDialog 0`、`通知` 区 1 个按钮(文字正是服务端那句话)、`rows 1`、6.5 秒后 `reasonAfter6s 0`;**现在**:`dialogs 1`、`reasonInDialog 1`、`toasts 0`、`rows 1`、6.5 秒后那句话仍在框里。启停开关不动(没有框可留,被拒仍用 toast) | 六包 `typecheck` **`EXIT=0`**(六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`(193 接口 / 589 类型)** —— 本笔不动服务契约)· `npx oxlint` 全仓 **0 警告 0 错误**(2241 文件)· 改动的六个文件 `prettier --check` 干净 · `git diff --check` 干净 · 逐包 test **`EXIT=0`、0 失败**:ui **129 文件 / 1044** · web **262 文件 / 3215 通过 / 2 跳过** · core **67 文件 / 1399 通过 / 6 跳过** · cli **38 / 561** · server **202 文件 / 2955 通过 / 4 跳过**(web 与上轮同数:本笔没有新增纯逻辑,规则是界面状态,由 e2e 钉住)· **真服务 + 真浏览器整套 e2e**(`SKIP_BUILD=1 pnpm -C packages/web test:e2e`,脚本自己的 `mktemp` 数据根、mock 8931 / 服务端 8930):**110 passed(7.7m)、0 failed**(原 105 + 本笔 4 + 同一工作树另一条线的 `version-line` 1)· 新 spec 单跑 **4 passed(8.2s)**(项目页一条、重试一条、停靠面板一条、Agent 设置页一条)· **反证**:三处源码 `git stash` 回 `HEAD` 并重建 web → 同一份 spec **4 failed**(每条都死在 `dialog.getByText("schedule store is closed")` 找不到元素),`stash pop` 重建后 **4 passed** · 两态探针(一次性数据根 `/tmp/r98data.*`、`localhost:8990` + mock 8991、1280×900)读数见左栏;两态 console 都只有按设计的 `GET …/machines` **403** 与刻意造的 500,无其它 error / ≥400 · **真看一眼**:`r98/{before,after}-2-after-confirm.png`(改前那张框已经没了、顶上一条 toast;改后那张句子下面就是 danger 色的「操作被拒绝:schedule store is closed」)与 `r98/after-3-after-6s.png`,探针 `r98/probe.mjs` 在 scratchpad · 端口只用 8990 / 8991 与 e2e 自己的 8930 / 8931(跑完都已停),3003 / 3004 / 4000 / 7364 / 7369 一个没碰;数据只落在一次性 `/tmp/r98data.*` 与 e2e 的 `mktemp` 根,一个字节没往 `~/.penguin` / `~/.adelie` 里写(`packages/*/dist`、`test-results/` 都是产物,未 `git add`)· 没有切版本号、没发 npm、没发安装包、没发发布汇总 · **同一工作树里另有一轮(第九十八轮,条目 6.3)在跑**,两笔改动不相交 | 见本行提交 |
> **2026-10-11 与另一条线的交汇(第三十七轮)**:定时任务触发时(07:00)`git status --short` **不干净**
> —— 另一条线(会话 `session-2026-10-05-20-32-50-2ee69aba`)正在做**用户点单**的「回复能复制成纯文本」
@@ -12670,3 +12683,98 @@ Token 两枚 chip);探针在页面里用一个 rAF 采样器逐帧读盒子
(0.5.2 的安装包里确认带着它;0.5.1 及更早的配置解析里根本没有 `enabled` 这个概念,
所以旧版上手写 `enabled: false` 不生效,只能删条目);②若他还想要「在对话里那一行 MCP 连接上直接
停用这个 Server」,那是另一端改动,等他开口。
+
+## 第九十九轮:删除定时任务被拒时,确认框留着,原因也留在框里(2026-10-21,条目 7.20)
+
+### 开工自检、选活与同一工作树上的另一轮
+
+- 同步:开工时(11:00)`git status --short` **干净**,`main` 停在 `4f09a655`;`git fetch origin &&
+ git merge --ff-only origin/main` = Already up to date(没切分支、没碰 `legacy/main`、没推 upstream)。
+ 上游按 URL 现拉到 `refs/adelie-tmp/upstream-main-r98`,尖端仍是 **`8aa76123`**,
+ `git rev-list --count` = **0**,没有可移植的新提交。
+- **同一工作树里另有一轮在跑**:本轮读到一半代码时(11:15)`HEAD` 被推进到 `60c1e76c` —— 那是
+ **第九十八轮(条目 6.3,新对话页的版本行)**的两笔提交(`d0bb21b2` + 台账),它改的文件
+ (`draft-view.tsx` / 两份 strings / 两份 docs / 它自己的 spec 与 changelog)与本轮**不相交**。
+ 撞上之后的做法:本轮只 `git add` 自己这六个文件、绝不 `-A`;`git stash` 只带本轮那三个源码路径
+ (反证时用);提交在它的两笔之上,不复位、不改写它。它也在自己的台账里写明「同一工作树里另有一轮
+ 正在改 schedules 三个文件」,两边的测试都跑在整树上、都看见了对方的文件。
+- 选活:待办里最靠前的未勾选条目仍是 **2.2c**(剩下的全在桌面壳写侧、`adelie-app.service` 单元与
+ 发布动作那一侧)、3.5 / 3.6 / 4.1–4.3 / 5.6 / 5.10(要拍板、要 key、要新依赖或明令不动)。
+ 于是接过第九十七轮(7.19)末尾唯一点名的那件:把「原因随框留着」铺到余下的页面。本轮取**定时任务**
+ 那一族(三个界面),它们本来就有「删除要先确认」的现成路径,一页就是一行 prop 加一条断言。
+
+### 先量清楚(不是推测)
+
+- 读代码就够确定的一半:三个界面的 `confirmRemove` 都在 `finally { setBusy(false); setDeleting(null) }`
+ 里关框,`catch` 里唯一一句话是 `toastError(apiErrorText(e))`;`ui` 的 toast 时长表 error = **6000 ms**,
+ 且 toast 是 portal 到 `body`、浮在框上方的一条通知,不在框里也不随框留着。
+- 两态探针(真服务 + 真浏览器,一次性数据根 `/tmp/r98data.HtbLVV`、`localhost:8990` + mock 8991、
+ 1280×900、`DELETE …/agents/default_agent/schedules/look_probe` 被 `page.route` 拒成 500
+ `schedule store is closed`):
+ - **改前**:按下「确认」之后 `dialogs 0`(框照样关)、`reasonInDialog 0`、`通知` 区 **1** 个按钮
+ (文字正是 `schedule store is closed`)、那一行仍在(`rows 1`)、6.5 秒后 `reasonAfter6s 0`
+ —— 原因没了,而删除根本没发生。截图 `r98/before-2-after-confirm.png`。
+ - **改后**:`dialogs 1`、框里 **1** 处那句话(danger 色「操作被拒绝:schedule store is closed」)、
+ `toasts 0`、那一行仍在、6.5 秒后 `reasonAfter6s 1`。截图 `r98/after-2-after-confirm.png`、
+ `r98/after-3-after-6s.png`。
+ - 两态 console 都只有按设计的 `GET …/machines` **403**(成员读机器列表)与刻意注入的 500。
+
+### 改了什么(6 个文件 + 台账:三处源码、1 个新 spec、changelog 一对)
+
+- `packages/web/src/features/schedules/schedules-page.tsx` /
+ `features/schedules/schedule-panel.tsx` / `features/agents/schedules-tab.tsx`:各加一个
+ `deleteRefusal`;`confirmRemove` 里 `setDeleting(null)` 搬进**成功**那一条,`catch` 改成
+ `setDeleteRefusal(apiErrorText(e))`;确认框传
+ `refusal={deleteRefusal === null ? undefined : S.common.refused(deleteRefusal)}`;打开框时先
+ `setDeleting(...)` 再清原因(「让打开先落」,与 7.19 同一条写法)。**为什么三个界面一起改**:
+ 它们列的是同一批行(`ScheduleRow`)、共用同一张确认框,漏一个界面就会与旁边那个读起来不一样。
+ **为什么开关不动**:启停没有框可留,`toggle` 仍走 toast(同 7.19 里那层分工)。
+- `packages/web/e2e/schedule-delete-refusal.spec.mjs`(新,4 条用例):项目页被拒(框、句子、那一行
+ 都在,`通知` 区**没有** toast,整卡文字去掉拒绝那一行后与写入前逐字相同)、重试(放行后同一张框写进去、
+ 框关、行与文件都没了)、对话停靠面板被拒、Agent 设置页被拒。夹具幂等(同名任务先 DELETE;
+ `startAt` 放一天后,调度器不会碰它)。
+- changelog 一对 `changelog/unreleased/2026-10-21-schedule-delete-refusal{.zh,}.md`(用户可见的行为变化)。
+
+### 验证
+
+- 六包 `typecheck` **`EXIT=0`**(六个 `Done`;`gen:ifaces` 报 **`src/ifaces.json unchanged`**,
+ 193 接口 / 589 类型 —— 本笔不碰契约)。
+- 改动的六个文件 `prettier --check` 干净;`npx oxlint` **0 警告 0 错误**(2241 文件);
+ `git diff --check` 干净。
+- 逐包 test **`EXIT=0`、0 失败**:ui **129 文件 / 1044** · web **262 / 3215 通过 / 2 跳过** ·
+ core **67 / 1399 通过 / 6 跳过** · cli **38 / 561** · server **202 / 2955 通过 / 4 跳过**。
+ web 与上轮同数:本笔没有新增纯逻辑(规则是界面状态),由 e2e 钉住。
+- **整套浏览器 e2e**:`SKIP_BUILD=1 pnpm -C packages/web test:e2e`(脚本自己的 `mktemp` 数据根、
+ mock 8931 / 服务端 8930)→ **110 passed(7.7m)、0 failed**(原 105 + 本笔 4 + 另一条线的
+ `version-line` 1)。新 spec 单跑 **4 passed(8.2s)**。
+- **反证(真的把三处源码改回去再跑)**:`git stash push --` 那三个路径 + 重建 web 产物 + 同一数据根 →
+ 同一份 spec **4 failed**,每条都死在 `dialog.getByText("schedule store is closed")`(element(s)
+ not found,15 s 超时);`git stash pop` + 重建后 **4 passed**。
+- **真看一眼**:`r98/before-2-after-confirm.png`(框已经没了,只有顶上一条 toast 与那一行任务)与
+ `r98/after-2-after-confirm.png`(句子下面一条 danger 色「操作被拒绝:schedule store is closed」,
+ 取消 / 确认仍在,任务那一行也仍在);探针 `r98/probe.mjs` 在 scratchpad。
+- 端口:探针只用 8990 / 8991,e2e 是它自己的 8930 / 8931(跑完都已停);3003 / 3004 / 4000 / 7364 /
+ 7369 一个没碰;数据只落在一次性 `/tmp/r98data.*` 与 e2e 的 `mktemp` 根,一个字节没往 `~/.penguin` /
+ `~/.adelie` 里写。
+- 没有切版本号、没发 npm、没发安装包、没发发布汇总。
+
+### 没做 / 还差什么
+
+- 「原因随框留着」这一族**余下的页面**(`machines` / `company`(组织、频道、员工、工单)/ `plugins` /
+ `settings` / `benchmarks` 等):同一条规则、同样的改法(一个 `refusal` 状态 + 一行 prop + 一条断言),
+ 下一轮按页面一个个来。
+- 「点击即关」那半边第九十四轮已判没有一处留下假状态;本轮没回头再核。
+
+### 收尾:提交、推送与汇报
+
+- 提交只 add 本轮六个文件 + 本台账;`git push origin main` 见下(在第九十八轮的两笔之上)。
+- 汇报邮件:`mail.py check` 仍 **120 s 超时**(退出码 124,与第九十五–九十七、第九十八轮同一类网络卡点,
+ 不是凭据问题 —— `CSU_MAIL_ADDR` / `CSU_MAIL_AUTHCODE` 都在环境里)。按「一轮只试一次」的约定,
+ 失败即改走**飞书**(`/root/Adelie_develop/send-feishu.py`,第九十八轮已验证的通路),正文照正式汇报写。
+
+### 下一轮从这里接
+
+- 待办清单的卡点原地:**2.2c**(剩下的全在桌面壳 / 部署单元那一侧)、**3.5**、**3.6**、**4.1–4.3**、
+ **5.6** / **5.10**;7.1–7.20 已勾掉。
+- 上游尖端仍是 **`8aa76123`**(本轮重拉过,0 个新提交)。
+- 7.20 的下一半:把「原因随框留着」铺到余下那些页面(按页面一个个来,每页一条用例)。
diff --git a/packages/web/e2e/schedule-delete-refusal.spec.mjs b/packages/web/e2e/schedule-delete-refusal.spec.mjs
new file mode 100644
index 00000000..70bdff4f
--- /dev/null
+++ b/packages/web/e2e/schedule-delete-refusal.spec.mjs
@@ -0,0 +1,225 @@
+/**
+ * Regression: deleting a scheduled task asks first, and a refused delete keeps that question —
+ * with the server's words inside it — instead of closing on the way out of the request.
+ *
+ * The three surfaces that list tasks (the Project page, the chat dock's panel, the Agent
+ * settings tab) share the rows (`ScheduleRow`) and the confirmation, and all three used to
+ * close it from a `finally`: the row was still there — nothing was deleted — but the reason
+ * arrived as a toast that dismissed itself after six seconds and sat over the card rather than
+ * in it. The dialog now closes only once the write landed, and a refusal leaves the card open
+ * with the refusal drawn under its sentence (`ConfirmModal`'s `refusal` slot), so the retry is
+ * the same button.
+ *
+ * Both page tests work on a task seeded through the API (a `startAt` in the future, so the
+ * scheduler never touches it while the test runs). The seed drops a leftover file of the same
+ * name first: a rerun of this file alone shares one data root with earlier runs.
+ */
+import { test, expect } from "@playwright/test";
+import { provisionAndLogin } from "./auth.mjs";
+
+const BASE = process.env.BASE_URL;
+const MOCK = process.env.MOCK_URL;
+const P = "password123";
+const AGENT = "default_agent";
+
+/** The delete call both surfaces make; a 500 with its own words proves the reason came back. */
+const REFUSAL = { code: "schedule_store_closed", message: "schedule store is closed" };
+
+/** Provision the user, give the Project a model (the onboarding overlay covers the page without one), and seed one task. */
+async function projectWithTask(page, user, name, options = {}) {
+ await provisionAndLogin(page.request, user, P);
+ const projectId = (await (await page.request.get(`${BASE}/api/projects`)).json()).projects[0]
+ .projectId;
+ const put = await page.request.put(`${BASE}/api/projects/${projectId}/models`, {
+ data: {
+ defaultModel: { provider: "custom", modelId: "claude-4-8" },
+ models: [
+ {
+ provider: "custom",
+ modelId: "claude-4-8",
+ apiKey: "sk-mock",
+ baseUrl: MOCK,
+ contextWindow: 200000,
+ },
+ ],
+ },
+ });
+ expect(put.ok(), "put models").toBeTruthy();
+
+ // The panel only lists tasks bound to the conversation on screen, so that surface seeds a
+ // Session first and pins the task to it.
+ let sessionId;
+ if (options.bindSession === true) {
+ const created = await page.request.post(
+ `${BASE}/api/projects/${projectId}/agents/${AGENT}/sessions`,
+ { data: { provider: "custom", modelId: "claude-4-8", approvalMode: "allow-all" } },
+ );
+ expect(created.ok(), "create session").toBeTruthy();
+ sessionId = (await created.json()).session.sessionId;
+ }
+
+ const base = `${BASE}/api/projects/${projectId}/agents/${AGENT}/schedules`;
+ await page.request.delete(`${base}/${name}`);
+ const created = await page.request.post(base, {
+ data: {
+ name,
+ prompt: "delete refusal probe",
+ enabled: true,
+ startAt: new Date(Date.now() + 86_400_000).toISOString(),
+ ...(sessionId === undefined ? {} : { sessionId }),
+ },
+ });
+ expect(created.status(), "seed the task").toBe(201);
+
+ /** The Project's list as the server holds it: what the page and the panel both read. */
+ const listed = async () =>
+ (await (await page.request.get(`${BASE}/api/projects/${projectId}/schedules`)).json())
+ .schedules;
+ return { projectId, sessionId, listed };
+}
+
+/** Refuse every delete with a code the app has no local copy for, so the server's words show. */
+async function refuseDeletes(page, seen) {
+ await page.route("**/api/projects/*/agents/*/schedules/*", async (route) => {
+ if (route.request().method() !== "DELETE") return route.fallback();
+ seen.push(route.request().url());
+ await route.fulfill({
+ status: 500,
+ contentType: "application/json",
+ body: JSON.stringify({ error: REFUSAL }),
+ });
+ });
+}
+
+/** The row's overflow menu → 删除, on whichever surface lists it. */
+async function openDeleteDialog(scope) {
+ await scope.getByRole("button", { name: "更多操作" }).first().click();
+ await scope.page().getByRole("menuitem", { name: "删除", exact: true }).click();
+ const dialog = scope.page().getByRole("dialog");
+ await expect(dialog).toBeVisible();
+ return dialog;
+}
+
+/**
+ * The card's own text with the refusal line dropped: a refused write adds one line under the
+ * sentence ("操作被拒绝:…"), and that line is the only thing the refusal may change.
+ */
+async function cardText(card) {
+ return (await card.innerText()).replace(/\n操作被拒绝:[^\n]*/, "");
+}
+
+test("a refused delete on the schedules page keeps the card, its sentence and the row", async ({
+ page,
+}) => {
+ const { listed } = await projectWithTask(page, "r98page1", "refuse_probe");
+ const before = await listed();
+
+ await page.goto("/schedules");
+ const row = page.getByText("refuse_probe", { exact: true });
+ await expect(row).toBeVisible();
+ const dialog = await openDeleteDialog(page.locator("main"));
+ const sentence = await dialog.innerText();
+ expect(sentence).toContain("refuse_probe");
+
+ const deletes = [];
+ await refuseDeletes(page, deletes);
+ await dialog.getByRole("button", { name: "确认" }).click();
+
+ // The reason is in the card that asked, and it is not a toast: the notification region holds
+ // no dismissible button, and the card reads exactly as it did before the attempt plus the one
+ // refusal line.
+ await expect(dialog.getByText(REFUSAL.message)).toBeVisible();
+ await expect(page.getByRole("region", { name: "通知" }).getByRole("button")).toHaveCount(0);
+ expect(deletes).toHaveLength(1);
+ await expect(dialog).toBeVisible();
+ expect(await cardText(dialog)).toBe(sentence);
+
+ // Nothing was deleted anywhere: the row is still on the page and the file is still on the server.
+ await expect(row).toBeVisible();
+ expect((await listed()).length).toBe(before.length);
+
+ // Closing the card decides nothing.
+ await dialog.getByRole("button", { name: "取消" }).click();
+ await expect(dialog).toHaveCount(0);
+ await expect(row).toBeVisible();
+});
+
+test("the retry after a refused delete writes it, and only a written one closes the card", async ({
+ page,
+}) => {
+ const { listed } = await projectWithTask(page, "r98page2", "retry_probe");
+
+ const deletes = [];
+ let refuse = true;
+ await page.route("**/api/projects/*/agents/*/schedules/*", async (route) => {
+ if (route.request().method() !== "DELETE") return route.fallback();
+ deletes.push(route.request().url());
+ if (!refuse) return route.fallback();
+ await route.fulfill({
+ status: 500,
+ contentType: "application/json",
+ body: JSON.stringify({ error: REFUSAL }),
+ });
+ });
+
+ await page.goto("/schedules");
+ const row = page.getByText("retry_probe", { exact: true });
+ await expect(row).toBeVisible();
+ const dialog = await openDeleteDialog(page.locator("main"));
+ await dialog.getByRole("button", { name: "确认" }).click();
+ await expect(dialog.getByText(REFUSAL.message)).toBeVisible();
+ await expect(dialog).toBeVisible();
+ expect(deletes).toHaveLength(1);
+
+ // The retry is the same card, and this time the write lands: card gone, row gone, file gone.
+ refuse = false;
+ await dialog.getByRole("button", { name: "确认" }).click();
+ await expect(dialog).toHaveCount(0);
+ expect(deletes).toHaveLength(2);
+ await expect(row).toHaveCount(0);
+ expect((await listed()).some((s) => s.name === "retry_probe")).toBe(false);
+});
+
+test("a refused delete in the chat dock's panel keeps the card with the reason too", async ({
+ page,
+}) => {
+ const { sessionId } = await projectWithTask(page, "r98panel", "panel_probe", {
+ bindSession: true,
+ });
+
+ await page.goto(`/chat/${sessionId}`);
+ await page.getByTestId("dock-toggle-right").click();
+ const panel = page.locator('[data-testid="dock"][data-open="true"]');
+ await panel.getByTestId("dock-pick-schedules").click();
+ await expect(panel.getByText("panel_probe", { exact: true })).toBeVisible();
+
+ const dialog = await openDeleteDialog(panel);
+ const deletes = [];
+ await refuseDeletes(page, deletes);
+ await dialog.getByRole("button", { name: "确认" }).click();
+ await expect(dialog.getByText(REFUSAL.message)).toBeVisible();
+ await expect(dialog).toBeVisible();
+ await expect(panel.getByText("panel_probe", { exact: true })).toBeVisible();
+ await expect(page.getByRole("region", { name: "通知" }).getByRole("button")).toHaveCount(0);
+});
+
+test("a refused delete on the Agent settings tab keeps the card with the reason too", async ({
+ page,
+}) => {
+ const { listed } = await projectWithTask(page, "r98tab", "tab_probe");
+ await page.goto(`/agents/${AGENT}?tab=schedules`);
+
+ await expect(page.getByText("tab_probe", { exact: true })).toBeVisible();
+ await page.getByRole("button", { name: "删除", exact: true }).first().click();
+ const dialog = page.getByRole("dialog");
+ await expect(dialog).toBeVisible();
+
+ const deletes = [];
+ await refuseDeletes(page, deletes);
+ await dialog.getByRole("button", { name: "确认" }).click();
+ await expect(dialog.getByText(REFUSAL.message)).toBeVisible();
+ await expect(dialog).toBeVisible();
+ expect(deletes).toHaveLength(1);
+ await expect(page.getByText("tab_probe", { exact: true })).toBeVisible();
+ expect((await listed()).some((s) => s.name === "tab_probe")).toBe(true);
+});
diff --git a/packages/web/src/features/agents/schedules-tab.tsx b/packages/web/src/features/agents/schedules-tab.tsx
index 879b3f5e..2c914297 100644
--- a/packages/web/src/features/agents/schedules-tab.tsx
+++ b/packages/web/src/features/agents/schedules-tab.tsx
@@ -89,6 +89,9 @@ export function SchedulesTab({
const [ai, setAi] = useState<{ initial: string } | null>(null);
// Name of the task pending deletion confirmation (non-null shows the confirm modal).
const [deleting, setDeleting] = useState<string | null>(null);
+ // The server's words for a delete it refused, drawn inside that same confirmation: the toast
+ // that used to carry them dismissed itself while the retry was still the next thing to do.
+ const [deleteRefusal, setDeleteRefusal] = useState<string | null>(null);
const load = useCallback(async () => {
if (!projectId || !agentId) return;
@@ -132,7 +135,7 @@ export function SchedulesTab({
}
};
- /** Confirm modal's "Confirm": closes the modal after deletion; if the deleted task is currently being edited, close the form too. */
+ /** Confirm modal's "Confirm": closes the modal once the deletion landed; a refused one stays with the server's words. */
const confirmRemove = async () => {
if (!projectId || deleting === null) return;
setBusy(true);
@@ -140,11 +143,11 @@ export function SchedulesTab({
await api.deleteSchedule(projectId, agentId, deleting);
if (form?.editing?.name === deleting) setForm(null);
changed();
+ setDeleting(null);
} catch (e) {
- toastError(apiErrorText(e));
+ setDeleteRefusal(apiErrorText(e));
} finally {
setBusy(false);
- setDeleting(null);
}
};
@@ -267,7 +270,10 @@ export function SchedulesTab({
size="sm"
variant="ghost"
disabled={busy}
- onClick={() => setDeleting(item.name)}
+ onClick={() => {
+ setDeleting(item.name);
+ setDeleteRefusal(null);
+ }}
>
{S.common.delete}
</Button>
@@ -325,6 +331,7 @@ export function SchedulesTab({
onConfirm={() => void confirmRemove()}
confirmLabel={S.common.confirm}
cancelLabel={S.common.cancel}
+ refusal={deleteRefusal === null ? undefined : S.common.refused(deleteRefusal)}
>
<p className="text-sm text-gray-600 dark:text-gray-300">
{deleting !== null ? S.schedule.deleteConfirm(deleting) : ""}
diff --git a/packages/web/src/features/schedules/schedule-panel.tsx b/packages/web/src/features/schedules/schedule-panel.tsx
index a953a9fb..48e944d8 100644
--- a/packages/web/src/features/schedules/schedule-panel.tsx
+++ b/packages/web/src/features/schedules/schedule-panel.tsx
@@ -72,6 +72,9 @@ export function SchedulePanel({ session, active, onPrefillComposer }: SchedulePa
// The task pending deletion confirmation, named by its file: the agent whose directory holds it
// and the file name, which is what the delete call takes.
const [deleting, setDeleting] = useState<{ agentId: string; name: string } | null>(null);
+ // The server's words for a delete it refused, drawn inside that same confirmation — the
+ // panel's copy of the page's rule, since both list the same rows (`ScheduleRow`).
+ const [deleteRefusal, setDeleteRefusal] = useState<string | null>(null);
// AI dialog: non-null means open, seeded with a suggestion's prompt or nothing.
const [ai, setAi] = useState<{ initial: string } | null>(null);
@@ -122,11 +125,13 @@ export function SchedulePanel({ session, active, onPrefillComposer }: SchedulePa
const editing = form?.editing;
if (editing?.agentId === deleting.agentId && editing?.name === deleting.name) setForm(null);
changed();
+ // Only a written delete closes the question; a refused one keeps the card so the retry is
+ // the same button (the row is still in the list either way).
+ setDeleting(null);
} catch (e) {
- toastError(apiErrorText(e));
+ setDeleteRefusal(apiErrorText(e));
} finally {
setBusy(false);
- setDeleting(null);
}
};
@@ -196,7 +201,10 @@ export function SchedulePanel({ session, active, onPrefillComposer }: SchedulePa
busy={busy}
onToggle={() => void toggle(item)}
onEdit={() => setForm({ editing: item })}
- onDelete={() => setDeleting({ agentId: item.agentId, name: item.name })}
+ onDelete={() => {
+ setDeleting({ agentId: item.agentId, name: item.name });
+ setDeleteRefusal(null);
+ }}
/>
</li>
))}
@@ -234,6 +242,7 @@ export function SchedulePanel({ session, active, onPrefillComposer }: SchedulePa
onConfirm={() => void confirmRemove()}
confirmLabel={S.common.confirm}
cancelLabel={S.common.cancel}
+ refusal={deleteRefusal === null ? undefined : S.common.refused(deleteRefusal)}
>
<p className="text-sm text-gray-600 dark:text-gray-300">
{deleting !== null ? S.schedule.deleteConfirm(deleting.name) : ""}
diff --git a/packages/web/src/features/schedules/schedules-page.tsx b/packages/web/src/features/schedules/schedules-page.tsx
index 2eaa2dae..089b5d59 100644
--- a/packages/web/src/features/schedules/schedules-page.tsx
+++ b/packages/web/src/features/schedules/schedules-page.tsx
@@ -113,6 +113,9 @@ export function SchedulesPage() {
// The task pending deletion confirmation, named by its file: the Agent whose directory holds it
// and the file name, which is what the delete call takes.
const [deleting, setDeleting] = useState<{ agentId: string; name: string } | null>(null);
+ // The server's words for a delete it refused, drawn inside that same confirmation: the reason
+ // has to survive the six-second toast, because retrying is the next thing the user does.
+ const [deleteRefusal, setDeleteRefusal] = useState<string | null>(null);
// The "new task" button's Agent picker.
const [agentsOpen, setAgentsOpen] = useState(false);
@@ -183,11 +186,14 @@ export function SchedulesPage() {
const editing = form?.editing;
if (editing?.agentId === deleting.agentId && editing?.name === deleting.name) setForm(null);
changed();
+ // Only a written delete closes the question: a refused one keeps the card (and the
+ // server's words inside it) so the retry is the same button, not a search through a list
+ // whose row is still there.
+ setDeleting(null);
} catch (e) {
- toastError(apiErrorText(e));
+ setDeleteRefusal(apiErrorText(e));
} finally {
setBusy(false);
- setDeleting(null);
}
};
@@ -430,7 +436,12 @@ export function SchedulesPage() {
busy={busy}
onToggle={() => void toggle(item)}
onEdit={() => setForm({ agentId: item.agentId, editing: item })}
- onDelete={() => setDeleting({ agentId: item.agentId, name: item.name })}
+ onDelete={() => {
+ // Open first, then drop the previous refusal: that sentence belonged to
+ // the task the last attempt named.
+ setDeleting({ agentId: item.agentId, name: item.name });
+ setDeleteRefusal(null);
+ }}
/>
</li>
))}
@@ -473,6 +484,7 @@ export function SchedulesPage() {
onConfirm={() => void confirmRemove()}
confirmLabel={S.common.confirm}
cancelLabel={S.common.cancel}
+ refusal={deleteRefusal === null ? undefined : S.common.refused(deleteRefusal)}
>
<p className="text-sm text-gray-600 dark:text-gray-300">
{deleting !== null ? S.schedule.deleteConfirm(deleting.name) : ""}