fix(runtime-host): recover legacy Root source messages - #3923
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
I reviewed this head and found blocking issues.
[P1] Recovered legacy input appended out-of-order
Missing legacy source inserted at MAX+1 regardless of its original Turn/time; forms [old outputs..., recovered user input] and corrupts catalog preview with stale text + new timestamp.
Fix: recover in original Turn/time order or use non-linear compatible representation with regression for non-empty transcript.
[P1] Two legacy crash cuts still crash Host startup
Missing Root-source transcript with run===undefined or non-terminal Run still throws does not match queue source before nonterminal recovery can run — Host fails despite recoverable receipt.
Fix: allow proof-owned source to materialize fail-closed during later recovery; add crash-cut tests.
Hosted test/windows_recovery: SUCCESS, but code is NO-GO.
简体中文
历史恢复时序与启动崩溃问题。Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
|
Implemented the review remediation in c073644. Changes:
Verification:
No design or plan documents are included. Please re-review the updated changes. |
|
Fixed the CI formatting failure in e63367a. The change is formatting-only across the three files reported by Biome. Fresh local verification:
|
e63367a to
8e2c6a6
Compare
|
Rebased onto current main at 6762085 and resolved the conflicts with #3803 while preserving both authority changes: SubmittedTurnIntent support from main and receipt-proven legacy Root recovery from this PR. Fresh post-rebase verification:
GitHub now reports the PR as MERGEABLE; remaining BLOCKED state is checks/review, not a merge conflict. |
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
8e2c6a6 to
fb45385
Compare
|
已解决与最新 冲突处理中同时保留了最新主线的 WorkHub delegation / Session admission 恢复语义,以及 #3902 对已验证 legacy Root source 的严格兼容恢复;steering 继续使用其独立持久化证明,未放宽普通消息的权威校验。 本地验证:
GitHub 当前报告 |
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for carefully working through the legacy Root-source recovery edge cases.
I reviewed exact head fb453857b4240e11dd90afa1caa04ffce2a05140. The problem is real: legacy persisted Root messages can lack a source while still needing a trustworthy origin during handoff. This implementation keeps the proof chain fail-closed, performs the repair inside the existing transaction, and closes the earlier correctness gaps without introducing another durable authority. I found no P0 or P1 issue, so I’m approving.
One non-blocking P2 for future hardening: ordinary Root handoffs can now cause readSessionMessageOrderingSync() to read and decode the full Session transcript inside the write transaction. Repeating that on very long Sessions may approach quadratic work and hold the write lock longer than necessary. It would be worth narrowing the scan to missing legacy candidates or affected ordering boundaries, or adding a long-history regression/performance case. This does not affect the correctness of the current fix and does not block approval.
Review analysis was assisted by Codex and independent @reviewer agents; Astro-Han verified the exact-head code paths, reachability, and CI state and owns this review.
中文对照
感谢你认真处理这些旧版 Root 来源恢复的边界情况。
我审查了当前提交 fb453857b4240e11dd90afa1caa04ffce2a05140。这个问题是真实存在的:旧版持久化的 Root 消息可能缺少 source,但在 handoff 时仍然需要一个可信的来源。当前实现保持了严格失败的证明链,在现有事务内完成修复,也关闭了此前的正确性缺口,没有引入新的持久化权威来源。我没有发现 P0 或 P1,因此 Approve。
有一个不阻塞的 P2,供后续收敛:普通 Root handoff 现在可能让 readSessionMessageOrderingSync() 在写事务中读取并解码整个 Session transcript。对于很长的 Session,重复执行可能接近二次复杂度,并延长写锁持有时间。后续可以考虑只扫描缺少来源的旧记录或受影响的排序边界,或者补一个长历史的回归/性能用例。这不影响当前修复的正确性,也不阻塞本次 Approve。
本次分析由 Codex 和独立的 @reviewer agents 协助;Astro-Han 核验了当前提交的代码路径、可达性和 CI 状态,并对本次评审负责。
|
已处理 review 中的 P2(commit 根因是普通 Root handoff 虽有现存 message admission,也会携带 Root proof;存储层此前仅凭 proof 存在就进入 legacy 排序恢复,从而读取并解码整个 Session transcript。 整改后:
验证:
|
Summary
message_admissionsRoot cause
#3721 made message-admission proof mandatory during handoff. Older terminal Root admissions can still own source messages but have no corresponding
message_admissionsrow, so startup recovery failed withMessage admission does not existbefore the Host became ready.Verification
npm --workspace @maka/storage run test: 970 passed, 16 skipped--test-concurrency=1: 1242 passed, 9 skippednpm run rebuild: passednpm run typecheck: passednpm run lint: passednpm run check:stale: passedThe default parallel Runtime Host invocation exposed an unrelated shared control-cache cleanup race (
ENOTEMPTY/ENOENT) on two runs; the failing Host-kernel case passed in isolation, the serial full suite passed, and all #3902 recovery tests passed in every run.A production Desktop/Host run against an adopted workspace copy reached ready and materialized both legacy messages exactly once with clean SQLite integrity. The real workspace was intentionally not started because one active durable Goal would auto-resume external work.
Closes #3902