fix(bin): 停止将 mate home 的父通道读取为任务日志 - #2
Merged
Merged
Conversation
A remote secondmate home publishes its captain-facing outcomes on its own state/parent-replies.status, which the parent's remote reply adapter mirrors into the parent's state/<mate-id>.status. That file sits inside the mate home's own state/*.status walks, so every published line was classified as a task named `parent-replies`: a phantom `signal parent-replies.status` wake on each append, a phantom open decision the drain offered to close with fm-send --resolve-key, and a phantom row in the heartbeat backstop. The design already said the parent classifies that stream (docs/secondmate-parent-channel.md); the scans had not implemented it. Add one predicate, bin/fm-parent-channel-lib.sh's fm_parent_channel_is_own_log, which resolves the home's channel once and answers whether a path is that outbound log, and consult it in every task-state walk: the watcher's per-poll signal scan and heartbeat backstop, the daemon's catch-all scan, the fleet-wide open-decision and unread folds, the presentation snapshot, the digest's orphan listing, and the task-record divergence report. bin/fm-pending-reply-lib.sh's wrong-home scan drops its own copy of the same rule in favor of the predicate. The exclusion is scoped to the home that owns the log: only a remote-route mate home resolves a channel at that path, so a main home's same-named file, a local-route mate home, and every ordinary state/<task>.status log are scanned exactly as before. Cover the predicate's scope and each scan family in tests/fm-parent-channel.test.sh, and the digest's orphan listing in tests/fm-session-start.test.sh.
…fm-parent-channel-lib.sh` source(后者又 source bin/fm-secondmate-parent-lib.sh),使新的 fm_parent_channel_is_own_log 谓词在每个 state/*.status walk 中可用。三个测试 fixture 复制了一个包含 fm-classify-lib.sh(或传递性 source 它的 fm-pending-reply-lib.sh / fm-branch-outcome.sh)但不包含这两个新依赖文件的最小化 bin/ 目录树,因此 source 复制后的脚本失败,报错 'fm-parent-channel-lib.sh: No such file or directory'。这正好产生了三处报告的失败:fm-remote-transport-lanes (secondmate, shard 1)、fm-afk-return (afk, shard 2)、fm-pi-branch-extension (standalone, shard 2)。修复:将 fm-parent-channel-lib.sh 和 fm-secondmate-parent-lib.sh 添加到以上三个 fixture 各自的复制列表中。已在本地验证:fm-afk-return 和 fm-remote-transport-lanes 现已通过,本 PR 自身的 fm-parent-channel 测试通过,所有已编辑文件的 bash -n 检查均无错误。fm-pi-branch-extension 的 broken-fixture 路径通过复现 fixture 并确认 fm-branch-outcome.sh 现在能正常 source 来验证(其本地全量测试运行还额外遇到一个预先存在的、与本改动无关的 ERR_MODULE_NOT_FOUND,涉及全局安装的 @earendil-works/pi-ai package,并非本次改动所致)。
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.
Intent
队长原话:「2 派」——派 worker 修 w 上分 firstmate 报的那个 firstmate 共享代码缺陷(任务已建:firstmate-selfwake-parent-replies)。
背景:remote secondmate home 里的 state/parent-replies.status 是父频道出站日志(该 home 向主 home 上报用的),但它落在该 home watcher 的 state/*.status 通配里,被当成了名叫 parent-replies 的任务状态文件。后果:
elmo home 的实测证据:追加 3 行 → 1 次 signal parent-replies.status 唤醒 + 3 条伪未决项。它同时指出设计文档 docs/secondmate-parent-channel.md 已写明该文件“只应由父 home 的 watcher 分类”,所以这是实现没跟上文档,不是配置问题。
What Changed
bin/fm-parent-channel-lib.sh中新增fm_parent_channel_is_own_log,一个独立谓词,用于识别远程 mate home 自身的出站通道日志(state/parent-replies.status),并将其从该 home 的 task-state 扫描中排除。state/*.status遍历——每次 wake 信号扫描、heartbeat backstop、daemon catch-all、open-decision 与 unread folds、presentation snapshot、orphan digest,以及 wrong-home sighting 扫描——使该通道不再被误分类为名为parent-replies的任务(phantom signal wakes、phantom open decisions、phantom heartbeat rows)。tests/fm-parent-channel.test.sh与tests/fm-session-start.test.sh中新增覆盖。Risk Assessment
✅ Low: 该改动是一个边界清晰的单 predicate 修复,通过基于行为的测试覆盖,全面关闭了 phantom-signal/phantom-decision/phantom-heartbeat 路径,且未发现任何可达的错误结果、授权或隐私路径。
Testing
本次运行中针对真实 firstmate 生产脚本进行了验证:sourced bin/fm-watch.sh 和 bin/fm-classify-lib.sh,并对携带 state/parent-replies.status 出站 log 及真实 t1.status task log 的 remote-secondmate home 执行了 bin/fm-wake-drain.sh,对比 base commit(phantom signal/heartbeat row/OPEN DECISION 存在)与 target(phantom 消失,t1 仍被报告),并确认排除范围保持窄化(main/local home 和普通 task log 仍扫描该文件)。项目自身的集成套件——fm-parent-channel、fm-session-start、fm-daemon、fm-pending-reply、fm-captain-hold-lifecycle——全部通过。三个已报告的 failure mode 均已消除,未出现 regression;无 warnings 或 blockers。
parent-replies.status+t1.status,target 仅出现t1.status(live-before-after-transcript.txt);tests/fm-parent-channel.t…parent-replies [key=captain-hold-x-1] needs-decision: ...及parent-replies note: ...,target 仅折叠出t1 blocked: waiting on creds(live-…parent-replies.status+t1.status,target 仅出现t1.status(live-before-after-transcript.txt);tests/fm-parent-channel.t…Evidence: Live base-vs-target transcript(signal、heartbeat、drain、scoping、predicate)
Source: Live base-vs-target transcript(signal、heartbeat、drain、scoping、predicate)
Evidence: Drain OPEN DECISIONS before/after
Source: Drain OPEN DECISIONS before/after
Evidence: Signal + heartbeat scan before/after
Source: Signal + heartbeat scan before/after
Evidence: Fix summary transcript
Source: Fix summary transcript
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.
parent-replies.status+t1.status,target 仅出现t1.status(live-before-after-transcript.txt);tests/fm-parent-channel.t…parent-replies [key=captain-hold-x-1] needs-decision: ...及parent-replies note: ...,target 仅折叠出t1 blocked: waiting on creds(live-…parent-replies.status+t1.status,target 仅出现t1.status(live-before-after-transcript.txt);tests/fm-parent-channel.t…bash tests/fm-parent-channel.test.shbash tests/fm-session-start.test.shbash tests/fm-daemon.test.shbash tests/fm-pending-reply.test.shbash tests/fm-captain-hold-lifecycle.test.shLive base-vs-target drive:sourced 真实 bin/fm-watch.sh 的 scan_signals + heartbeat_scan_finds_actionable,真实 bin/fm-classify-lib.sh 的 scan_open_decisions,并对真实 remote-mate home 执行了真实 bin/fm-wake-drain.sh(base 300137d vs target 570651f)通过真实 bin/fm-classify-lib.sh 对 scan_open_decisions_incremental、scan_unread_surface_lines、status_presentation_snapshot 进行 Live drive对 fm_parent_channel_is_own_log 在 main/local/remote home 及普通 task log 上进行 Live predicate scope check✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.