Skip to content

v0.8.1 修复番茄钟提醒把会话打死 - #8

Merged
modusensus merged 2 commits into
masterfrom
feat/v0.8.1
Nov 5, 2026
Merged

modusensus merged 2 commits into
masterfrom
feat/v0.8.1

Conversation

@modusensus

@modusensus modusensus commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

症状

某个会话在番茄钟停止的那一刻突然瘫痪:历史还在,但之后每一轮回复都只有一行
format v4 message requires a producer-owned source kind。

根因

番茄钟走完时 index.js 用 agent.followup() 把提醒塞进起钟会话,消息的 source 写成
{ kind: 'plugin', plugin: 'dsh-study-desk', event: 'timer-end', at }。

宿主会话格式 v4 把「kind 一律写 plugin、只靠 plugin 字段认来源」判为退役语法
(app.asar 里 source() 见到 kind === 'plugin' 直接抛),而 followup 的消息会原样落进
agent/inbox/spliced.data.inserted[],于是整条事件落盘被拒,那个会话从此每轮都撞同一堵墙。

改法

改用生产者自己命名的 kind plugin:dsh-study-desk(宿主只要求「非空且不是裸 plugin」,
前缀就是来源标记;clearai / @modusensus/dsh-mneme 在现有会话里早已这么写)。
并把它收成单一出口,不再手写字面量:

export const MESSAGE_SOURCE_KIND = `plugin:${name}`
export function timerEndSource(at = Date.now()) {
  return { kind: MESSAGE_SOURCE_KIND, plugin: name, event: 'timer-end', at }
}

验证

  • node --test:77 / 77 通过(原 73 + 新增 4)。
  • node apply-probe.mjs:✓ 全部通过,含「专注走完 → 提醒以 user 消息送进起钟会话」。
  • node install.mjs --check:profile 接线全 ok,patch 仍为裸包名。
  • 变异自证(两次,均已还原):把 source 改回裸 kind: 'plugin' → 新增的静态扫用例红、
    apply-probe.mjs 端到端也红(✗ 1 项失败);还原后全绿。
  • 生态对照:全量扫本机 418 个 session.v4 文件,已有 4989 处被宿主接受的 plugin: source,
    确认这是现行合法写法。

Summary by CodeRabbit

  • Bug Fixes
    • Fixed timer-completion reminders being rejected because of an unsupported message source. Reminders now use a host-compatible source associated with the originating timer session, allowing them to be delivered as intended. No other user-facing behavior changes are noted.

番茄钟走完时插件用 agent.followup() 把提醒塞进起钟会话,source 写成
{ kind: 'plugin', plugin: 'dsh-study-desk', … }。宿主会话格式 v4 把这个形状判为
退役语法(app.asar 的 source() 见到 kind === 'plugin' 就抛),agent/inbox/spliced
整条落盘被拒,会话从那一刻起每一轮都报
format v4 message requires a producer-owned source kind。

改用 plugin:<包名> 这种生产者自己命名的 kind(宿主只要求非空且不是裸 plugin),
并为它加一层单一出口:MESSAGE_SOURCE_KIND 与 timerEndSource(),不再手写字面量。

- index.js: 新增 MESSAGE_SOURCE_KIND / timerEndSource(),timerEndHook 改用工厂
- apply-probe.mjs: 端到端断言同步到新 kind
- test/message-source.test.js: 4 条回归(含静态扫,禁止裸 kind 'plugin' 回潮)
- AGENTS.md: 更新过时的 source.kind 说明、文件地图与单测数量
- CHANGELOG/package.json: v0.8.1
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6d281d1d-ea91-4ecc-a3f6-5f5fc2cee458
Commits

Reviewing files that changed from the base of the PR and between 932a45d and 423848a.

Files selected for processing: 6

  • AGENTS.md
  • CHANGELOG.md
  • apply-probe.mjs
  • index.js
  • package.json
  • test/message-source.test.js
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

原来那条守卫直接对文件原文跑正则,index.js 里解释退役语法的注释
(「kind 一律写 plugin」那几个字)离踩线只差一个冒号,随时会误红。

- test/message-source.test.js: 新增 maskComments(),把块注释/行注释抹成空格
  (保留换行与字符串),扫描前先过一遍:注释里讲旧写法放过,代码里写了才抓
- 新增一条「扫描器不空转」自证:注释三种写法不误红、代码三种引号必须抓到、
  plugin:dsh-study-desk 与 pluginish 不许误伤
@modusensus
modusensus merged commit 2f7b672 into master Nov 5, 2026
4 checks passed
@modusensus
modusensus deleted the feat/v0.8.1 branch November 5, 2026 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant