Repository navigation
fix(schedule): 认领卡到点钩子改为异步,卡片记录读失败不再让定时轮次失败 - #2416
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 27, 2026 05:03
Owner
Author
|
合后核验(作者侧):
感谢两位评审。 |
This was referenced Oct 27, 2026
|
🚀 Released in v3.54.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
#2387(定时任务身份认领卡片)合入后的 follow-up,对应 issue #2415 的三项。
改了什么
1. 到点钩子里卡片记录读失败不再让定时轮次失败(#2415 第 1 项)
noteIdentityRestored在每次「有身份」的定时轮次里由prepareScheduledTurnCliIdentity调用,用来把还停在「待认领」的卡收尾。它第一道检查(读这个任务的卡片记录)原来在同步区:卡片存储读失败会同步 throw,绕过 daemon 侧的void ….catch(...),让本该按创建人/认领人身份正常执行的这次定时轮次整个失败。现在
noteIdentityRestored和noteIdentityGap都是async function,任何失败(包括第一次读记录)都只以 rejection 交给 daemon 侧的.catch,记一条 warn,本次轮次照常执行。2. 补「点旧卡回刷不改动当前卡片记录」的回归用例(#2415 第 3 项)
场景:记录已指向较新的
om_card_2(待认领),有人点了最早那张未认领的卡。回刷只改被点的那张,记录保持pending,下一次到点照常把om_card_2收尾。去掉syncRecord里「被点的卡就是记录里的那张」这条守卫后,记录会被翻成claimed/resolved,om_card_2会永远停在橙色——这条用例会变红。3. 老库 CHECK 迁移(#2415 第 2 项):不迁移
带旧约束
status IN ('pending','claimed')的schedule_identity_claim_cards只可能出现在 #2387 分支第一个提交建过的库里:所以真实环境里没有需要迁移的旧表,不为分支中间态加迁移。收敛时「先改卡、再写记录」的顺序保持不变:反过来的话,改卡暂时失败时记录已经写成
resolved,后面就不会再刷,卡会一直停在橙色;按现在的顺序,写记录失败时下次到点会重刷同一张卡、再写一次记录。影响面
只动
src/core/schedule-identity-claim.ts的两个钩子签名(同步返回 Promise →async),调用方 daemon 本来就void x.catch(...),行为对正常路径不变;只在卡片存储出错时,失败从「同步抛出、拖垮本次定时轮次」变为「记 warn」。只影响开了triggerUserAuth的 bot 的定时轮次。验证
npx tsc --noEmit、bun run build:通过。test/schedule-identity-claim.test.ts37 例。noteIdentityRestored改回同步写法后变红。syncRecord的 messageId 守卫后变红。Closes #2415
🤖 Generated with Claude Code