Skip to content

Commit 1efeeb1

Browse files
author
DeepCold review
committed
fix(decision-board): 「子任务提醒」改为默认关,只在打开时写盘
按合码标准 3.2(c),新增的主动提醒默认关: - steward.taskHints 只在打开时写 true,关着(含显式写 false)等于默认,不写盘; 只开了这一项也照样存下来,不当成「全是默认」。 - 默认关时不排提醒、看板不标「子任务已交付 / 等人处理 / 中断」,管家 guide 与改动前逐字相同; 关联群的状态照常显示。打开位置:Dashboard → Bot 配置 → 管家 bot → 管家 → 子任务提醒。 - 设置页、字段说明、设计文档的默认值同步改成默认关。 验证:tsc、build 通过;决策看板 / 管家 / bot 配置 / 会话状态相关 32 个测试文件 913 条全绿; 6 处变异(开关判断、服务端与前端的写盘条件和「全是默认」判断、表单默认值)均被测试抓到。
1 parent a31ddcd commit 1efeeb1

9 files changed

Lines changed: 63 additions & 42 deletions

‎docs/design/2026-11-08-session-task-status.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,6 @@ daemon 重启前开始的轮没有。
127127
巡检标提示、owner 提交决定都不动它。
128128
- 一轮核对出的所有条目合成一条,经现有 `deliverHintNotice` 送进管家会话;送不出去撤销「已提醒」并稍后重试,
129129
沿用现有的投递次数上限。
130-
- 管家设置里单独一个开关「子任务提醒」,管家开着时默认开,只在关掉时写盘;与「自动发现可以关的项」互不影响。
130+
- 管家设置里单独一个开关「子任务提醒」,默认关(新增的主动提醒,按合码标准 3.2(c)),只在打开时写盘;
131+
与「自动发现可以关的项」互不影响。
131132
开着时 `botmux board guide` 多一小节,说明收到这种提醒怎么处理。

‎src/core/decision-board/model.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ export interface StewardConfig {
445445
closeHints?: boolean;
446446
/**
447447
* 事项关联的群里有一轮结束、举手或中断时,在这一项上标「子任务已交付 / 等人处理 / 中断」,
448-
* 并给管家会话发一条合并的短通知。只提示,不改状态。默认开,只在关掉时写 `false`。
448+
* 并给管家会话发一条合并的短通知。只提示,不改状态。默认关,只在打开时写 `true`。
449449
*/
450450
taskHints?: boolean;
451451
}
@@ -512,11 +512,11 @@ export function normalizeStewardConfig(raw: unknown):
512512
...(r.autoJoinSoloGroups === true ? { autoJoinSoloGroups: true } : {}),
513513
...(r.decisionCards === false ? { decisionCards: false } : {}),
514514
...(r.closeHints === true ? { closeHints: true } : {}),
515-
...(r.taskHints === false ? { taskHints: false } : {}),
515+
...(r.taskHints === true ? { taskHints: true } : {}),
516516
};
517517
if (!value.enabled && !value.chatId && !value.guideMode && !value.guideText
518518
&& value.autoJoinNewGroups !== false && value.autoJoinSoloGroups !== true && value.closeHints !== true
519-
&& value.decisionCards !== false && value.taskHints !== false) {
519+
&& value.decisionCards !== false && value.taskHints !== true) {
520520
return { ok: true, value: null };
521521
}
522522
return { ok: true, value };
@@ -546,9 +546,9 @@ export function stewardCloseHintsOn(cfg: StewardConfig | undefined): boolean {
546546
return stewardReady(cfg) && cfg.closeHints === true;
547547
}
548548

549-
/** 子任务提醒开着:管家可用(开关开 + 选了管家群)且没关 taskHints。 */
549+
/** 子任务提醒开着:管家可用(开关开 + 选了管家群)且打开了 taskHints。 */
550550
export function stewardTaskHintsOn(cfg: StewardConfig | undefined): cfg is StewardConfig & { chatId: string } {
551-
return stewardReady(cfg) && cfg.taskHints !== false;
551+
return stewardReady(cfg) && cfg.taskHints === true;
552552
}
553553

554554
/**

‎src/dashboard/web/decision-board-model.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ export interface StewardForm {
630630
decisionCards: boolean;
631631
/** 后台巡检找出可以关 / 可以推进 / 该看一眼的事项;默认关。 */
632632
closeHints: boolean;
633-
/** 关联群里一轮交付 / 举手 / 中断时提醒管家;默认开。 */
633+
/** 关联群里一轮交付 / 举手 / 中断时提醒管家;默认关。 */
634634
taskHints: boolean;
635635
}
636636

@@ -644,7 +644,7 @@ export function stewardFormFrom(cfg: StewardConfig | null | undefined): StewardF
644644
autoJoinSoloGroups: cfg?.autoJoinSoloGroups === true,
645645
decisionCards: cfg?.decisionCards !== false,
646646
closeHints: cfg?.closeHints === true,
647-
taskHints: cfg?.taskHints !== false,
647+
taskHints: cfg?.taskHints === true,
648648
};
649649
}
650650

@@ -665,11 +665,11 @@ export function stewardPayload(form: StewardForm): StewardConfig | null {
665665
...(form.autoJoinSoloGroups ? { autoJoinSoloGroups: true } : {}),
666666
...(form.decisionCards ? {} : { decisionCards: false }),
667667
...(form.closeHints ? { closeHints: true } : {}),
668-
...(form.taskHints === false ? { taskHints: false } : {}),
668+
...(form.taskHints ? { taskHints: true } : {}),
669669
};
670670
if (!value.enabled && !value.chatId && !value.guideMode && !value.guideText
671671
&& value.autoJoinNewGroups !== false && value.autoJoinSoloGroups !== true && value.closeHints !== true
672-
&& value.decisionCards !== false && value.taskHints !== false) return null;
672+
&& value.decisionCards !== false && value.taskHints !== true) return null;
673673
return value;
674674
}
675675

‎src/dashboard/web/i18n.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,7 +2967,7 @@ const zh = {
29672967
'botDefaults.stewardCloseHints': '自动发现可以关的项',
29682968
'botDefaults.stewardCloseHintsHelp': '每 5 分钟检查一次看板(不调模型):挂的 PR 已合入、依赖的事项都结束了、过了复查时间还没动的事项,在看板上标「建议关闭 / 建议推进 / 该看一眼」,并在管家群给管家发一条合并的提示(同一条只发一次)。只提示,不改状态,由管家核对后处理。查 PR 用本机的 GitHub 凭据(GITHUB_TOKEN 或 gh 登录)。默认关闭',
29692969
'botDefaults.stewardTaskHints': '子任务提醒',
2970-
'botDefaults.stewardTaskHintsHelp': '事项关联的群里有一轮交付、举手或中断时,在这一项上标「子任务已交付 / 等人处理 / 中断」,并给管家会话发一条合并的短通知(等两分钟再发,同一个结果只提醒一次,管家已经更新过这一项就不发)。只提示,不改状态。默认开;与上面的后台巡检互不影响。',
2970+
'botDefaults.stewardTaskHintsHelp': '事项关联的群里有一轮交付、举手或中断时,在这一项上标「子任务已交付 / 等人处理 / 中断」,并给管家会话发一条合并的短通知(等两分钟再发,同一个结果只提醒一次,管家已经更新过这一项就不发)。只提示,不改状态。默认关;与上面的后台巡检互不影响。',
29712971
'botDefaults.stewardGuide': '提示词',
29722972
'botDefaults.stewardGuideHelp': '管家开工前会读一遍规则:预置规则,加上你在这里写的内容。',
29732973
'botDefaults.stewardPreset': '预置规则(只读)',
@@ -7636,7 +7636,7 @@ const en: Record<keyof typeof zh, string> = {
76367636
'botDefaults.stewardCloseHints': 'Find items that are ready to close',
76377637
'botDefaults.stewardCloseHintsHelp': 'Checks the board every 5 minutes (no model calls). Items whose linked PRs are merged, whose dependencies have all ended, or that passed their next check time with no update get a "Suggest closing / Suggest moving on / Check in" mark on the board, and the steward gets one combined hint in the steward chat (each hint is sent once). Hints only: no state is changed; the steward verifies and acts. PR checks use this machine\'s GitHub credentials (GITHUB_TOKEN or gh login). Off by default.',
76387638
'botDefaults.stewardTaskHints': 'Subtask alerts',
7639-
'botDefaults.stewardTaskHintsHelp': 'When a chat linked to an item finishes a turn, raises a hand or is interrupted, mark the item "Subtask delivered / needs someone / interrupted" and send the steward session one combined short notice (a couple of minutes later, once per result, skipped if the steward already updated the item). Hints only; no state is changed. On by default; independent of the background check above.',
7639+
'botDefaults.stewardTaskHintsHelp': 'When a chat linked to an item finishes a turn, raises a hand or is interrupted, mark the item "Subtask delivered / needs someone / interrupted" and send the steward session one combined short notice (a couple of minutes later, once per result, skipped if the steward already updated the item). Hints only; no state is changed. Off by default; independent of the background check above.',
76407640
'botDefaults.stewardAutoJoinHelp': 'When botmux creates a chat that you (this bot\'s owner) are in, the steward is added too, so it can later post there as itself to move work forward. It joins silently: no message, no session. New chats with only you and one bot are skipped unless the next switch is on. Stewards are matched by owner, so a steward with no owner is never added. Turn this off if the steward does not post as itself (for example, it posts as you). On by default.',
76417641
'botDefaults.stewardGuide': 'Instructions',
76427642
'botDefaults.stewardGuideHelp': 'Before it starts work, the steward reads its rules: the built-in rules plus what you write here.',

‎src/services/bot-config-store.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const CONFIG_FIELDS: readonly ConfigFieldSpec[] = [
167167
{ key: 'autoStartOnGroupJoin', configKey: 'autoStartOnGroupJoin', kind: 'boolean', effect: 'immediate', clearable: false, hint: '被拉进新群即主动开工 on|off' },
168168
{ key: 'autoInviteOwnerOnGroupAdd', configKey: 'autoInviteOwnerOnGroupAdd', kind: 'boolean', effect: 'immediate', clearable: false, defaultOn: true, hint: 'bot 被拉进新群时自动把 owner 拉进群 on|off(默认 on);off 适用于告警/oncall 批量事件群' },
169169
{ key: 'autoStartOnNewTopic', configKey: 'autoStartOnNewTopic', kind: 'boolean', effect: 'immediate', clearable: false, hint: '话题群每个新话题自动开工 on|off' },
170-
{ key: 'steward', configKey: 'steward', kind: 'json', effect: 'immediate', clearable: true, hint: '管家(决策看板)JSON:{"enabled":true,"chatId":"oc_…","guideMode":"append|replace","guideText":"自定义规则","autoJoinNewGroups":false,"autoJoinSoloGroups":true,"closeHints":true,"decisionCards":false,"taskHints":false};默认关闭;autoJoinNewGroups=拉新群时带上管家,默认开,只在关掉时写 false;autoJoinSoloGroups=只有你和一个 bot 的新群也带,默认关;closeHints=后台巡检提示可以关 / 可以推进 / 过了复查时间的事项(只提示不改状态),默认关;decisionCards=待拍板时往管家群发拍板卡片,默认开,只在关掉时写 false;taskHints=关联群里一轮交付、举手或中断时提醒管家(只提示不改状态),默认开,只在关掉时写 false;unset 关闭(看板数据保留)' },
170+
{ key: 'steward', configKey: 'steward', kind: 'json', effect: 'immediate', clearable: true, hint: '管家(决策看板)JSON:{"enabled":true,"chatId":"oc_…","guideMode":"append|replace","guideText":"自定义规则","autoJoinNewGroups":false,"autoJoinSoloGroups":true,"closeHints":true,"decisionCards":false,"taskHints":true};默认关闭;autoJoinNewGroups=拉新群时带上管家,默认开,只在关掉时写 false;autoJoinSoloGroups=只有你和一个 bot 的新群也带,默认关;closeHints=后台巡检提示可以关 / 可以推进 / 过了复查时间的事项(只提示不改状态),默认关;decisionCards=待拍板时往管家群发拍板卡片,默认开,只在关掉时写 false;taskHints=关联群里一轮交付、举手或中断时提醒管家(只提示不改状态),默认关,只在打开时写 true;unset 关闭(看板数据保留)' },
171171
{ key: 'chatManagerEnabled', configKey: 'chatManagerEnabled', kind: 'boolean', effect: 'immediate', clearable: false, hint: '允许本 bot 被设为普通群负责人(默认接待者)on|off(默认 off):开启后才提供会话内群负责人工具并允许 set,关闭后不免 @ 接话;clear/status 不受影响' },
172172
{ key: 'worktreeMultiPicker', configKey: 'worktreeMultiPicker', kind: 'boolean', effect: 'immediate', clearable: false, hint: 'repo 卡片 worktree 选择器默认多仓库模式 on|off(卡片「切换多仓库选择器」按钮同款)' },
173173
{ key: 'disableCliBypass', configKey: 'disableCliBypass', kind: 'boolean', effect: 'next-session', clearable: false, hint: '不加 CLI 审批/sandbox 绕过参数 on|off' },

‎test/dashboard-decision-board-model.test.ts‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,17 +251,19 @@ describe('steward config payload', () => {
251251
expect(stewardFormFrom(null).decisionCards).toBe(true);
252252
});
253253

254-
it('subtask alerts default on and are written only when turned off', () => {
254+
it('subtask alerts default off and are written only when turned on', () => {
255255
const base = stewardFormFrom({ enabled: true, chatId: 'oc_abc' });
256-
expect(base.taskHints).toBe(true);
256+
expect(base.taskHints).toBe(false);
257+
expect(stewardFormFrom(null).taskHints).toBe(false);
258+
expect(stewardFormFrom({ enabled: true, chatId: 'oc_abc', taskHints: false }).taskHints).toBe(false);
257259
expect(stewardPayload(base)).toEqual({ enabled: true, chatId: 'oc_abc' });
258-
const off = stewardPayload({ ...base, taskHints: false });
259-
expect(off).toEqual({ enabled: true, chatId: 'oc_abc', taskHints: false });
260-
expect(stewardFormFrom(off).taskHints).toBe(false);
261-
expect(normalizeStewardConfig(off)).toEqual({ ok: true, value: off });
262-
// 只关了子任务提醒也要存下来,不能当成「全是默认」写 null。
263-
expect(stewardPayload({ ...stewardFormFrom(null), taskHints: false })).toEqual({ enabled: false, taskHints: false });
264-
expect(stewardPayload({ ...base, taskHints: false, closeHints: true })).toEqual({ enabled: true, chatId: 'oc_abc', closeHints: true, taskHints: false });
260+
const on = stewardPayload({ ...base, taskHints: true });
261+
expect(on).toEqual({ enabled: true, chatId: 'oc_abc', taskHints: true });
262+
expect(stewardFormFrom(on).taskHints).toBe(true);
263+
expect(normalizeStewardConfig(on)).toEqual({ ok: true, value: on });
264+
// 只开了子任务提醒也要存下来,不能当成「全是默认」写 null。
265+
expect(stewardPayload({ ...stewardFormFrom(null), taskHints: true })).toEqual({ enabled: false, taskHints: true });
266+
expect(stewardPayload({ ...base, taskHints: true, closeHints: true })).toEqual({ enabled: true, chatId: 'oc_abc', closeHints: true, taskHints: true });
265267
});
266268

267269
it('produces exactly what the server validator accepts and stores', () => {

‎test/dashboard-decision-board-page.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,16 @@ describe('Bot config steward section', () => {
325325
expect(calls('PUT', '/api/bots/cli_s/steward').at(-1)!.body).toEqual({ steward: { enabled: true, chatId: 'oc_1' } });
326326
});
327327

328-
it('"subtask alerts" is on by default; turning it off saves false, turning it back on drops the field', async () => {
328+
it('"subtask alerts" is off by default; turning it on saves true, turning it back off drops the field', async () => {
329329
serve();
330330
await render({ enabled: true, chatId: 'oc_1', closeHints: true });
331331
const alerts = () => renderer!.root.find(n => n.type === 'input' && n.props['data-action'] === 'toggle-steward-task-hints');
332-
expect(alerts().props.checked).toBe(true);
333-
expect(text()).toContain(zh('botDefaults.stewardTaskHints'));
334-
await act(async () => { alerts().props.onChange({ currentTarget: { checked: false } }); });
335-
expect(calls('PUT', '/api/bots/cli_s/steward').at(-1)!.body).toEqual({ steward: { enabled: true, chatId: 'oc_1', closeHints: true, taskHints: false } });
336332
expect(alerts().props.checked).toBe(false);
333+
expect(text()).toContain(zh('botDefaults.stewardTaskHints'));
337334
await act(async () => { alerts().props.onChange({ currentTarget: { checked: true } }); });
335+
expect(calls('PUT', '/api/bots/cli_s/steward').at(-1)!.body).toEqual({ steward: { enabled: true, chatId: 'oc_1', closeHints: true, taskHints: true } });
336+
expect(alerts().props.checked).toBe(true);
337+
await act(async () => { alerts().props.onChange({ currentTarget: { checked: false } }); });
338338
expect(calls('PUT', '/api/bots/cli_s/steward').at(-1)!.body).toEqual({ steward: { enabled: true, chatId: 'oc_1', closeHints: true } });
339339
});
340340

‎test/decision-board-hints.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,7 @@ describe('解析', () => {
508508

509509
describe('规则与配置', () => {
510510
it('没开 closeHints:guide 与之前逐字相同;开了才多出写条件和「收到提示」两处', () => {
511-
// 子任务提醒是另一个开关(默认开),这里关掉只看 closeHints 带来的差别。
512-
const off: StewardConfig = { enabled: true, chatId: 'oc_x', taskHints: false };
511+
const off: StewardConfig = { enabled: true, chatId: 'oc_x' };
513512
const on: StewardConfig = { ...off, closeHints: true };
514513
for (const locale of ['zh', 'en'] as const) {
515514
expect(stewardGuidePreset(locale, off)).toBe(stewardGuidePreset(locale));

0 commit comments

Comments
 (0)