checkpoints: a restore queued behind a stalled save has no ceiling (follow-up to PR 1404 thread PRRT_kwDOSK-bwM607p-r)
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- git, typescript
调研方向
Start with src/core/checkpoints/index.ts, especially enqueueCheckpointWork around lines 293–327, and read the named checkpoint tests around lines 143–184 and 261. Trace the queued save calls from Task.ts and ApplyPatchTool.ts to confirm which callers can wait behind a stalled predecessor. Done means a deadline releases affected waiters and tests cover that behavior while preserving the rule that expired saves do not commit.
由索引模型根据 Issue 内容生成。
描述
Filed as the disposition the reviewer offered on PR 1404, thread PRRT_kwDOSK-bwM607p-r (https://github.com/Zoo-Code-Org/Zoo-Code/pull/1404#discussion_r4542246559).
What is unbounded
src/core/checkpoints/index.ts line 316 builds next = previous.then(attempt, attempt) and line 327 returns it; attempt reads options.expiresAt only at line 306, when its turn arrives. The deadline therefore decides whether an operation starts. It never releases the caller waiting behind a stalled predecessor.
Saves are content-safe because of that gate: lines 307-313 warn and resolve with no commit, and src/core/checkpoints/__tests__/checkpoint.test.ts:143 ("drops a queued save whose checkpoint window expired behind a stalled predecessor") tests it. The shape of that test's own lines 164-174 is the evidence that the release comes at the predecessor's settlement and not at the deadline.
The user-initiated restore is the case with no ceiling at all. index.ts:415 calls enqueueCheckpointWork with no options, DEFAULT_QUEUED_WORK_OPTIONS at line 293 carries no expiresAt, and checkpoint.test.ts:261 ("never drops a user-initiated restore queued behind a stall") pins that a restore must run whenever its turn arrives. Its ceiling is the in-flight save's git add . --ignore-errors plus git commit (src/services/checkpoints/ShadowCheckpointService.ts:258, called at 356 and 456). A -E grep for timeout|setTimeout over that whole file returns exactly one row, line 566 ({ interval: 500, timeout: 2_000 }, a different wait), so nothing bounds it. The task-start baseline is bounded separately by its own race at src/core/task/Task.ts:3968-3980, default window 15 seconds (packages/types/src/global-settings.ts:115 DEFAULT_CHECKPOINT_TIMEOUT_SECONDS = 15).
What a fix costs, priced with the gate's own instrument
scripts/stryker-diff.mjs (executableChangedLines), run against the blob at 9811691a111537e1be290330f43e7bd9dccb1289:
- release the waiter at its own deadline when the work carries one: 18 diff rows, 12 counted executable lines;
- the single-warning variant that also flags
attemptso it does not warn a second time: 23 diff rows, 17 counted lines.
PR 1404 counts 463 of the instrument's 500 counted-line cap (435 of it in the extension package), so the cheap shape would take the pull to 475 and the tidy one to 479. Either rewrites checkpoint.test.ts:143-184, which today tests release-at-settlement, adds one test row (a test file is priced zero executable lines by that instrument), and adds a branch whose mutants only that new test can kill.
Why it was not done in 1404
The harm is latency and a missing warning, not a wrong commit: no save commits state its caller did not ask about, and the only genuinely unbounded await is a restore behind a hung git child. Spending 12 to 17 counted lines of the 37 this pull has left under the cap, rewriting a passing behavioural test, and preflighting a new branch is the dearer path - and 1404 is green at that head on all six required contexts (the organisation door prints HTTP 200 with total_count 21, the six contexts all completed/success).
Filed by this account as the answer to the reviewer's offer. If a maintainer would rather see the guard here, the 12-line shape above is the whole change and the test that has to move is named in it.
Amended 2026-11-12T21:33Z by the lane that read the review reply, so the destination matches what the reviewers described
Filed for one coordinate, the restore queued at index.ts:415. A reviewer row under thread PRRT_kwDOSK-bwM607p-r (comment 4556008315, served 2026-11-12T20:34:36Z, 599 B at sha256-16 1746fa7e54bcfa83) corrected that scope and stated it would not mark the finding as addressed; the lane that answered it checked the mechanism at head 9811691a111537e1be290330f43e7bd9dccb1289 and named the added coordinates there. They belong on this issue, so they are added here in the words that thread uses.
- The per-write save path is not exempt from the finding.
options.expiresAtis read atindex.ts:306insideattempt, which everything queued reaches through the chainprevious.then(attempt, attempt)atindex.ts:316, so the same deadline field is read by the per-write save path as well as by baselines. The per-write saves get one atindex.ts:374,expiresAt: Date.now() + Math.max(1, timeoutSeconds * 1000), under both labels named at:373. The reviewer put it as: "a per-write save can also wait indefinitely behind a stalled baseline. The expiry check runs only after the baseline settles, soapply_patchand its queued-message handoff can remain blocked." - A stalled predecessor blocks the tool handoff, not only a background commit.
apply_patchawaits those saves atApplyPatchTool.ts:196,:206and:220, each writtenawait checkpointSave(task, false, true).catch(() => {})- three call sites that await a checkpoint save and swallow its error. - The predecessor is named by the sites that request it: the task-start baseline requested at
Task.ts:3963and the turn-boundary save atTask.ts:2495, which is where a stalled baseline comes from. The task-start race atTask.ts:3968-3980with its 15-second default bounds that baseline's own record, and commit872f5630d364bounds what a late baseline records, not how long its waiters wait.
Nothing in the paragraphs above this line was rewritten. Both priced shapes stand exactly as filed - 12 and 17 counted executable lines, taking PR 1404 to 475 or 479 of the instrument's 500 counted lines, each rewriting checkpoint.test.ts:143-184 - and what changes is that release-at-deadline now has to be priced against both victims, the restore and the per-write saves.
Two sentences the reviewers asked for, recorded so they are not mistaken for work this issue owes. The reply thread PRRT_kwDOSK-bwM607p-r stays open, because the unbounded wait is unfixed at head 9811691a111537e1be290330f43e7bd9dccb1289. And the ask, raised by a reviewer row under thread PRRT_kwDOSK-bwM607p-u at src/core/tools/ApplyPatchTool.ts, that the last saved security gate be reassessed at the current head before merge belongs to the people who own that gate rather than to this campaign: this issue neither carries it nor defers it.
Amended once, 2026-11-12T21:33Z, by lane u9-1917 from the thread rather than by re-deriving it. Everything between the top of this body and the heading above is the body as filed at 2026-11-12T20:33:39Z, 3,359 B at sha256 eecdedf8019c0039b24b95688393dffe9beb6f1708ecb338c828d37d7206fca7, byte-for-byte intact.
- 主要语言
- TypeScript
- 星标
- 2k
- 派生
- 301
- 平均合并
- 3 天 14 小时
- 30 天内合并 PR
- 103
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Zoo-Code-Org/Zoo-Code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
Zoo-Code-Org/Zoo-Code#2773 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Zoo-Code-Org/Zoo-Code#2717 · 1 条评论 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
Zoo-Code-Org/Zoo-Code#2515 ·
维护者通常 3 天内回复
-
fix(scripts): stryker-diff.mjs spawns the extensionless .bin shim and cannot run on Windows可能已有人在做 @easonLiangWorldedtech 于 15 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
Zoo-Code-Org/Zoo-Code#2514 ·
维护者通常 3 天内回复
-
[BUG] search_files hides matching text on long lines可能已有人在做 @DananjayaNadun 于 9 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
Zoo-Code-Org/Zoo-Code#2496 · 1 条评论 · 已指派 1 人 ·
维护者通常 3 天内回复
查看 Zoo-Code-Org/Zoo-Code 的全部 Issue
相似的 Issue
-
needs-triage
难度 2/5 1-3 小时 新手友好度 86/100
EPPIcenter/sampledb3#162 ·
-
Particle-1 model未关闭
难度 2/5 1-3 小时 新手友好度 67/100
tashfeenahmed/freellmapi#2169 ·
维护者通常 1 天内回复
-
via-triage
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
🎙️ task - feat(mechanic): pave git.pull.close, a close of a superseded pull with its why on record未关闭
难度 2/5 1-3 小时 新手友好度 72/100
ehmpathy/rhachet-roles-ehmpathy#1576 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
vercel-labs/ui#1563 ·
维护者通常 1 天内回复