fix(runtime): bound malformed compaction retries - #3751
Conversation
435b957 to
480f9cf
Compare
xxhZs
left a comment
There was a problem hiding this comment.
Reviewed exact head 480f9cfaa9933f5d410a3589a8eae59ea9ad58cb.
The core liveness fix is sound: strict checkpoint validation remains intact, malformed summaries get one bounded repair attempt, the Turn latch prevents repeated calls in the same Turn, and the Session-backend fingerprint circuit stops unchanged bad input from being retried across Turns. The granular failure reason is also preserved through Runtime Event → Runtime Host failed-turn state → Desktop, with the compatibility epoch advanced to 49. Exact-head test is green. I found no P1 correctness issue.
I do see two contract gaps worth resolving before approval:
- [P2] Recovery behavior is only closed on Desktop. CLI/TUI still consume the generic
context_budget_exhaustedclass and do not usecontextBudgetExhaustedDetail. If #3743 is explicitly Desktop-only, please record CLI/TUI as follow-up scope; otherwise the cross-surface recovery contract is incomplete. - [P2] Fingerprint invalidation is not regression-locked. The implementation is intended to re-enable compaction when model, connection, context-window budget, or request shape changes, but tests only prove source-history invalidation. Please add a parameterized regression covering unchanged input plus at least model, connection, and context-window changes; this fingerprint is the core cross-Turn safety/liveness boundary.
Non-blocking follow-ups:
- [P3] Repair coverage only exercises
malformed_summary_missing_section;truncatedandtoo_small_for_foldshare the path but have no second-call regression, and the repair prompt is not reason-specific. - [P3] Desktop recovery is actionable copy rather than an actionable control:
deriveFailedTurnRecovery()returns an action, but the turn view model retains only the label, so there is no direct settings/model/new-task affordance.
Recommendation: this can proceed to maintainer review as the Desktop liveness fix, but I would clarify the CLI/TUI scope and add the configuration-change fingerprint tests before approval.
AI-assisted review disclosure: OpenAI Codex inspected the exact-head diff, protocol/runtime/host/Desktop flow, focused tests, and live CI state; I verified the findings against the source before posting.
简体中文
核心限流与熔断方向正确,没有发现 P1;当前主要缺口是 CLI/TUI 未消费细分失败原因,以及跨 Turn 指纹对 model/connection/context-window 变化的契约缺少回归测试。另有 repair 场景覆盖和 Desktop 一键恢复能力两个非阻断缺口。
480f9cf to
cbe797d
Compare
Review follow-upAddressed the fingerprint-invalidation P2 in The new table-driven regression verifies the complete cross-Turn circuit contract:
The existing source-history invalidation regression remains in place. Scope clarification for the other P2: #3743 and this PR are explicitly scoped to Desktop + Runtime Host. CLI/TUI currently retain the generic The branch was rebased onto This is ready for maintainer review after CI completes. AI assistance disclosure: Codex implemented the review follow-up, ran the verification, and drafted this response; I verified the result before posting. 简体中文已在 范围方面,#3743 和本 PR 明确限定为 Desktop + Runtime Host。CLI/TUI 目前仍展示通用的 分支已 rebase 到 CI 通过后即可请求 maintainer review。 |
Astro-Han
left a comment
There was a problem hiding this comment.
I reviewed this head and found a blocking issue.
[P2] Repair failure overwrites the initial malformed cause and retries indefinitely
Once initial.defect is malformed_summary_*, the repair budget is spent, but generateSummary(1) can itself throw output_length or be wrapped as provider_error. That final reason replaces the malformed fact, so neither the session-backend fingerprint circuit nor the Turn latch blocks the next identical compactHistory — leading to 4 physical calls across two compactions instead of 2.
Fix: arm the circuit with the original malformed reason whenever repair is entered and does not produce a checkpoint.
Checks on cbe797d811 are test: success.
简体中文
存在修复失败覆盖原始缺陷导致的重试环。
Review follow-upFixed the blocking repair-failure P2 in Once repair is entered, every path that fails to produce a valid checkpoint now reports the original malformed reason to the caller. This covers repair The end-to-end regression reproduced the review's exact failure on the prior head: two identical Verification on
AI assistance disclosure: Codex reproduced the finding, implemented the fix and regression coverage, ran verification, and drafted this response; I verified the result before posting. 简体中文已在 一旦进入 repair,只要最终没有生成有效 checkpoint,对外都会保留第一次的 malformed 原因;repair 阶段的 端到端回归在旧 head 上复现了 review 描述的问题:相同输入连续两次
|
3e9a3d3 to
943d344
Compare
There was a problem hiding this comment.
I reviewed this head and found no code blocking issues, but the change cannot be merged as is.
[P2] RUNTIME_HOST_COMPATIBILITY_EPOCH collision and merge conflict
Head 943d344af sets RUNTIME_HOST_COMPATIBILITY_EPOCH = 50 for compaction detail, but main already uses 50 for WorkHub coordination summaries (merged #3798). The two 50s have different meanings, so incompatible peers would accept or reject the wrong fields. Also packages/runtime-host/src/protocol/index.ts is CONFLICTING.
Fix: rebase onto current main and bump epoch to 51 (strictly greater than main's 50), keeping the comment load-bearing.
Hosted test: SUCCESS (32858535454) on code.
简体中文
epoch 与 main 上的 50 语义不同,需要重排并升到 51。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.
Preserve granular context-budget failure details through Runtime Host and show actionable Desktop recovery guidance. Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
943d344 to
4c37dc5
Compare
Summary
Fixes #3743
Verification
npm run buildnpm run lintnpm run format:checknpm run typechecknpx knip --workspace apps/desktopnpx knip --workspace packages/uinode scripts/protocol-epoch-check.mjs --base origin/main --head HEAD(epoch 48 -> 49)npm testpassed the affected Runtime (3,052 tests) and Desktop (1,497 tests) workspaces, but the concurrent root run exited nonzero on three unrelated timing/process tests. Each passed when rerun in isolation:AI use
Select exactly one:
Tool(s) and scope: Codex inspected the incident evidence and repository, implemented the Runtime/Runtime Host/Desktop changes, added tests, and drafted this PR description. The commit includes a
Generated-by: Codextrailer.Checklist
Does this PR entail a change in behavior?