-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(goal): stamp the wind-down hand-off only when its turn was delivered #10260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+93
−7
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] This change tightens the wind-down stamp rule —
finishedWindDown = heldWindDown && delivered— but leaves three earlier comments stating the old "finished ⇒ stamps" rule: the in-memory field doc atgoal-runtime.ts:300-304("only the turn that actually finishes stamps the record"), the budget-gate comment atgoal-runtime.ts:608-610("The record marks the hand-off that finished" — its case list omits the new granted-finished-but-undelivered state), and theGoalTurnFinishedTransition.windDownTurnIdcontract atgoal-reducer.ts:49("Set when the finishing turn was the spend window's wind-down hand-off").goal-protocol.ts:175-183already documents the delivered rule, so the module now contradicts itself. A maintainer extending the settle/release/restore paths — or adding a caller ofreduceGoalTurnFinished— reads one of these comments first, concludes that finishing a wind-down turn alone stamps the record, and stamps an undelivered hand-off through a new path, silently reintroducing the #10150 defect: a Goal stopped atusage_limitedwith the record claiming a hand-off the user never received. Reword all three to the delivered-and-finished rule, for example:中文说明
此变更收紧了收尾盖章规则——
finishedWindDown = heldWindDown && delivered——但留下了三处仍在陈述旧规则(「结束即盖章」)的注释:goal-runtime.ts:300-304的内存字段文档("only the turn that actually finishes stamps the record")、goal-runtime.ts:608-610的预算闸门注释("The record marks the hand-off that finished"——其情形列表缺少新增的「已授予、已结束但未送达」状态)、以及goal-reducer.ts:49的GoalTurnFinishedTransition.windDownTurnId契约("Set when the finishing turn was the spend window's wind-down hand-off")。goal-protocol.ts:175-183已记载送达规则,模块内部因此自相矛盾。未来扩展 settle/release/restore 路径(或新增reduceGoalTurnFinished调用方)的维护者会先读到这些注释,误以为仅结束收尾轮即可盖章,从而在新路径上为未送达的交接盖章,悄悄重现 #10150 缺陷:Goal 停在usage_limited,记录却声称用户已收到交接,而用户从未收到。建议将三处注释都改为「已送达且结束」规则,例如:— qwen3.8-max via Qwen Code /review (v0.22.2)