Repository navigation
fix(classify): 无 key 的 open 行被后续终态行取代后不再列出 - #43
Merged
Merged
Conversation
…line A status log's needs-decision/blocked line with no [key=...] token folds into the shared "default" bucket, which no later keyed transition can name. So when the task then wrote its own done/paused line, the keyless record stayed open forever and bin/fm-wake-drain.sh re-listed a finished blocker on every wake. _fm_decision_fold_line now drops the default record when a done/paused line arrives, leaving every keyed decision untouched because a terminal line names no key. FM_OPEN_DECISIONS_FOLD_VERSION goes 5 -> 6 so a cursor persisted under the old reading is rebuilt from byte 0 instead of serving the stale record from cache. Tests pin both directions in the existing families: the supersede, the no-terminal-line case that must still list, the keyed decision a terminal line must never clear, and the fold-version rebuild that drops a stale cached record.
onyx-space
force-pushed
the
fm/fm-open-decisions-keeps-superseded-keyless
branch
from
October 4, 2026 02:06
521a048 to
6aa3a0f
Compare
onyx-space
force-pushed
the
fm/fm-open-decisions-keeps-superseded-keyless
branch
from
October 4, 2026 02:08
6aa3a0f to
4d3ee90
Compare
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.
摘要
bin/fm-wake-drain.sh每轮打印的OPEN DECISIONS折叠,把一条早已完成的待决项一直挂在清单上:state/retired-repo-cleanup-x1.status第 42 行是一条无 key 的blocked: dsh-search,它落在折叠的共享default槽里;第 43 行的resolved [key=dsh-search-cleanup-approval]只关掉第 41 行那条 keyed 记录,第 44 行的paused:终态行又不被折叠认作结束。于是每轮 drain 都出现一个不存在的待决项。本次只改这一处折叠语义:同一份 status 日志里,无 key 的
blocked:/needs-decision行之后出现终态行即视为已被取代,不再进 open 集。keyed 决定的配对与关闭语义未动。改动
_fm_decision_fold_line:落在*)分支的终态判定(status_is_terminal_verb的done/failed,或FM_CLASSIFY_PAUSED_VERB的paused,即status_is_paused)命中时,丢弃共享的default记录。keyed 开局的行在更早的分支就返回,永不进入这条规则。_fm_status_open_decision_origins与_fm_span_scan_fold_line:open 集里不再持有default时同步丢弃它的 origin,span-scan 的折叠触发词也加上终态与 paused,两个分类器保持一致。FM_OPEN_DECISIONS_FOLD_VERSION5 → 7、FM_CLASSIFY_SPAN_SCAN_VERSION2 → 3,落盘游标按新语义从字节 0 重建;测试里另补了一条针对版本号的回归钉(旧版本号的 span-scan 游标必须被拒、并从首行重建)。docs/architecture.md一句话同步;测试在既有家族内扩写(decision-key、span-scan、pending-reply、wake-drain、captain-hold lifecycle、watch-triage)。本 PR 的三条记录
① 本地定向证据(逐个文件实跑)
被触及的测试文件在本地逐个跑过(分支 rebase 到当前 main 后的
4d3ee908,同一计数口径),全部退出码 0、无not ok:tests/fm-classify-decision-key.test.shtests/fm-classify-span-scan.test.shtests/fm-wake-drain-open-decisions.test.shtests/fm-wake-drain-open-decisions-cursor.test.shtests/fm-pending-reply.test.shtests/fm-captain-hold-lifecycle.test.shtests/fm-watch-triage.test.sh② 为什么早先那次 CI 是红的
本 PR 上一次 CI(run
36981325080)的三条红 shard 跑在旧底座上:那次 run 在 #45 合并之前,而 #45 修的正是它们红的原因(CI 里 pi 未钉版本导致漂移,以及 pi 1.0.0 的 stock 调用头与 Calm off 不一致)。同一次检查里的PR must be raised via no-mistakes则是闸门本身——手开的 PR 过不了这条。本分支已更新到当前 main(f42a979b)并由 no-mistakes 管线重新出品,该闸门与那三条 shard 都在新底座上重判。③ 验证口径
01M42APR2848K68GRK0D6WY7S5的review/test/document/lint/push/pr各步完成,test步完整跑通(未走 skip);English
Intent
一个反复出现的监督噪声缺陷(firstmate 自己身上的):bin/fm-wake-drain.sh 每轮的 OPEN DECISIONS 折叠会把 retired-repo-cleanup-x1 的 blocked: dsh-search 那一行每轮重新列出来,而那件事早已完成。它收不掉的原因:那一行没有 key,而 bin/fm-send.sh --resolve-key 只能收有 key 的记录(默认槽的 key 是 default,但 drain 的清单不显示它)。实测证据(h 机,2026-10-02):state/retired-repo-cleanup-x1.status 里,第 41 行是 needs-decision [key=dsh-search-cleanup-approval],第 42 行是 blocked: dsh-search(无 key),第 43 行是 resolved [key=dsh-search-cleanup-approval](只关掉第 41 行那条 keyed 记录),第 44 行是 paused: dsh-search 清理完成(终态行,但折叠不因此丢掉第 42 行),于是每轮 drain 都出现一个不存在的待决项。边界:只修这一处折叠语义 —— 同一份 status 日志里,无 key 的 blocked/needs-decision 行之后出现任何终态行(done/paused/failed)即视为已被取代,不再进 open 集;不要重写分类器、不要改 keyed 决定的配对与关闭语义。终态词复用本仓既有的 status_is_terminal_verb(done|failed)加 FM_CLASSIFY_PAUSED_VERB 的 paused,不另写表;span-scan 分类器与 status_open_decisions 保持一致并 bump FM_CLASSIFY_SPAN_SCAN_VERSION,让落盘的 partial-scan 游标重建。
What Changed
needs-decision/blockedrecord once a later line in the same log is a terminal verb (done/failed, viastatus_is_terminal_verb) or a declaredpaused; only the shareddefaultrecord is dropped, so keyed decisions keep their existing resolve/captain-held close semantics.FM_CLASSIFY_SPAN_SCAN_VERSION(2 to 3); the open-decisions fold version advances to 7 (version 6 added thedone/pausedsupersede, 7 extends it tofailed) so persisted partial-scan and fold cursors rebuild from the span's first line.defaultkey when the open set no longer holds it, and tests cover the supersede rule, legacy pending-reply escalation closure under a terminal reply, and both cursor migrations.Risk Assessment
✅ Low: 该变更紧贴单条 fold 规则,在 whole-file、incremental、origin-map 和 span-scan 各消费者之间保持一致,使过期的持久化 cursors 失效,并由行为级回归测试覆盖;此前提出的分歧已解决。
Testing
I derived the product surface from the intent:
bin/fm-wake-drain.sh's OPEN DECISIONS section, backed byfm-classify-lib.sh'sstatus_open_decisionsfold, the incremental cursor fold, and the watch/daemon span-scan classifier. Driving the real drain over the exact reported log (keyed decision, keyless blocked, keyed resolved, thenpaused:) now prints nothing; the base build printeddefault blocked: dsh-search ..., and the base span scan reported that line (rc 0) while the target returns rc 1 with no record, so the fold and the classifier agree. Guards were exercised live: a keyless blocker with no later terminal line still lists, a later unrelateddone:never clears a still-open keyed decision, a fresh keyless decision raised after a terminal line lists again, and the configuredFM_CLASSIFY_PAUSED_VERB(not a hardcodedpaused) defines the supersede vocabulary.done:andfailed:both supersede. I also confirmed a persisted partial span-scan cursor written under the previous scanner version is discarded and rebuilt rather than trusted as live; since no test pinned that version-bump requirement, I added one focused regression test totests/fm-classify-span-scan.test.sh(drivesstatus_span_first_actionableand asserts rc=1, empty record, and no leftover cursor). Targeted suites for the drain, cursor, decision-key, span-scan, pending-reply, and the two changed fixture cases all pass. The full 52-case captain-hold and 116-case watch-triage files were not run to completion; only their changed cases were run, in isolation, because the intent is targeted validation. Evidence: live transcripts, a base-vs-head comparison, suite logs, and the pause-verb check are in the evidence directory. Overall the change satisfies the intent with no failures.default blocked, head prints nothing)done:line does not clear a still-open keyed decision, which the drain still liststask1 [key=api-shape] needs-decision: pick REST or RPC)done:orfailed:and stops being listedtask1 blocked: the forge went down again)status_span_first_actionable+status_open_decisions)pausedFM_CLASSIFY_PAUSED_VERB=waitingretires onwaiting:and not onpaused:)Evidence: Live drain + span-scan scenario transcript (reported sequence, guards, adversarial reopen, cursor migration)
Source: Live drain + span-scan scenario transcript (reported sequence, guards, adversarial reopen, cursor migration)
Evidence: Before/after: base lists the stale keyless blocker and re-signals it via span scan; head does not
Source: Before/after: base lists the stale keyless blocker and re-signals it via span scan; head does not
Evidence: Targeted suite logs (drain, cursor, decision-key, span-scan, pending-reply, focused captain-hold/watch-triage)
Source: Targeted suite logs (drain, cursor, decision-key, span-scan, pending-reply, focused captain-hold/watch-triage)
Evidence: FM_CLASSIFY_PAUSED_VERB override defines the terminal-supersede vocabulary
Source: FM_CLASSIFY_PAUSED_VERB override defines the terminal-supersede vocabulary
Evidence: Reproducible evidence driver script for the live drain/span-scan scenarios
Source: Reproducible evidence driver script for the live drain/span-scan scenarios
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
default blocked, head prints nothing)done:line does not clear a still-open keyed decision, which the drain still liststask1 [key=api-shape] needs-decision: pick REST or RPC)done:orfailed:and stops being listedtask1 blocked: the forge went down again)status_span_first_actionable+status_open_decisions)pausedFM_CLASSIFY_PAUSED_VERB=waitingretires onwaiting:and not onpaused:)bash tests/fm-wake-drain-open-decisions.test.sh(exit 0, includes keyless-supersede and guards)bash tests/fm-wake-drain-open-decisions-cursor.test.sh(exit 0, includes pre-fix fold-version rebuild)bash tests/fm-classify-decision-key.test.sh(exit 0, includes keyless-superseded-by-terminal case)bash tests/fm-classify-span-scan.test.sh(exit 0, incl. newtest_pre-fix span-scan cursor is discarded and the span rebuilt under the supersede rule)bash tests/fm-pending-reply.test.sh(exit 0, includes updated legacy-escalation contract)Affected captain-hold case in isolation:test_terminal_single_owner_status_decision_does_not_block_empty_inventory(exit 0)Affected watch-triage case in isolation:test_status_span_survives_a_later_routine_append(exit 0)Live drain scenarios over crafted logs vialive-drain-scenarios.sh(realbin/fm-wake-drain.sh, isolatedFM_STATE_OVERRIDEstate)Live classifier scenarios viastatus_open_decisions,status_open_decisions_incrementalandstatus_span_first_actionableon the realbin/fm-classify-lib.shBefore/after comparison of basef42a979vs target4d3ee90on the exact reported log and on a pre-fix span-scan cursorFM_CLASSIFY_PAUSED_VERB=waitingoverride check on the real fold✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.