fix(cli): explain residency-blocked host conflicts - #3208
Conversation
📝 WalkthroughSummaryThis PR improves CLI and TUI diagnostics for local Runtime Host compatibility conflicts caused by retained resident work.
The change extends the existing Runtime Host registration and admission path. It does not create a parallel Host authority or change Goal durability, Host admission, or the one-Host-per-State-Root model. The implementation is the smallest coherent solution shown by the supplied change summary. No code or tests are clearly removable without weakening behavior or regression coverage. Validation includes targeted CLI tests, typecheck, lint, format checks, and a manual TTY regression with a retained epoch-23 Host. Final required-check status remains unverified. Complexity delta
The total maintenance complexity stays justified. The diagnostics address the reported compatibility conflict. Removing the waiting-state logic offsets part of the added branch and test complexity. Review-relevant risksThe CLI and TUI user-visible behavior changes. The No protected-area effect was identified in the current diff for security, licensing, releases, or governance. Final required-check status is unverified. The person performing the merge reviews the final diff, and a maintainer makes the final determination. WalkthroughThe CLI now includes Runtime Host PID, lifecycle mode, and compatibility epoch in incompatibility errors. The TUI prompts after each conflict and retries only after an explicit wait response. Tests cover lifecycle-specific diagnostics and retry decisions. ChangesRuntime Host conflict handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change improves diagnostics and retry/cancel behavior for residency-blocked host conflicts; no actionable merge-blocking risk remains beyond normal checks and review. Possibly related issues
Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant TUI
participant RuntimeHostCliContext
participant RuntimeHost
TUI->>RuntimeHostCliContext: request Runtime Host connection
RuntimeHostCliContext->>RuntimeHost: perform handshake
RuntimeHost-->>RuntimeHostCliContext: return incompatible handshake and registration
RuntimeHostCliContext-->>TUI: display conflict details
TUI->>TUI: prompt for explicit wait response
TUI->>RuntimeHostCliContext: retry only for w or wait
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
PR Summary by QodoExplain residency-blocked Runtime Host conflicts in CLI
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
a796de8 to
ffadc49
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: dc3501e5-0872-4267-98ac-7202710b0db7
📒 Files selected for processing (3)
packages/cli/src/__tests__/runtime-host-cli-context.test.tspackages/cli/src/runtime-host-cli-context.tspackages/cli/src/runtime-host-tui-command.ts
Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review.
Code Review by Qodo
1.
|
24beee3 to
123cfc3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ad3b9f4c-cc1a-4a87-8e5d-9c53ac659139
📒 Files selected for processing (3)
packages/cli/src/__tests__/runtime-host-cli-context.test.tspackages/cli/src/runtime-host-cli-context.tspackages/cli/src/runtime-host-tui-command.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/cli/src/runtime-host-tui-command.ts
- packages/cli/src/runtime-host-cli-context.ts
Included review availability: Your plan includes up to 3 reviews per rolling hour; 0 remain after this review.
123cfc3 to
8fd1167
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
The change now projects the relevant registration facts, distinguishes operator-managed service Hosts, and requires an explicit wait choice on each retry. I found no concrete P0–P3 issue in this head. The wait_for_idle_exit path remains intentionally handled inside connection election; the CLI conflict diagnostic only receives blocked_by_residency, where the non-idle wording is accurate.
Reviewed with Codex using two independent review passes and DeepSeek V4 Flash as an external adversarial pass; I verified the replacement-state control flow against this exact head and current main.
中文
当前实现已投影必要的 registration 事实,区分 operator 管理的 service Host,并要求每次重试都显式选择 wait。未发现具体的 P0–P3 问题。wait_for_idle_exit 仍由连接选举层内部处理;CLI 冲突诊断只会收到 blocked_by_residency,此时 non-idle 描述成立。
本次由 Codex 两轮独立审查,并使用 DeepSeek V4 Flash 做外部对抗审查;我核对了当前 head 与最新 main。
|
This PR changes the user-visible Runtime Host conflict flow. Could you please add a screenshot showing the updated TUI conflict message and the available wait or cancel choices? One representative state is fine. Thanks! Posted by Codex on behalf of Astro-Han. |
|
Added the requested representative TUI screenshot to the PR body. It shows the revised Host conflict facts and the explicit wait ( |
Generated-by: Codex
8fd1167 to
a110dfa
Compare
|
Rebased the unchanged PR patch onto current main ( |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/cli/src/__tests__/runtime-host-cli-context.test.ts (1)
149-158: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd one test for the observable TUI retry loop.
These assertions verify only
shouldRetryRuntimeHostConflict. They do not verify thatcreateTuiContextWithHostConflictPromptretries afterw, re-prompts after a second conflict, and stops without another attempt after cancellation. A regression in that loop could pass this test unchanged.Disposition: follow-up. Add one focused TUI-boundary test and reuse these parser cases instead of duplicating them.
As per path instructions, tests must protect observable behavior.
Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8cb630d1-251e-40f2-8f1a-28b1a5f92894
📒 Files selected for processing (2)
packages/cli/src/__tests__/runtime-host-cli-context.test.tspackages/cli/src/runtime-host-tui-command.ts
Included review availability: Your plan provides up to 3 included reviews per hour; 1 remains after this review.
|
Human merge confirmation: Astro-Han reviewed the final diff at |
Summary
English
Explain local Runtime Host compatibility conflicts when an older ephemeral Host is retained by resident work.
The CLI now projects safe registration facts—PID, lifecycle mode, and compatibility epoch—and explains that retrying cannot itself retire resident work. The TUI still permits an explicit wait when another compatible Client is expected to finish work, but re-prompts after each failed retry instead of entering a silent loop.
This does not alter Goal durability, Host admission, or the one-Host-per-State-Root authority model.
Fixes #3207
中文
改进本地 Runtime Host 兼容冲突的诊断:展示 PID、lifecycle 和 compatibility epoch,并明确仅重试不会让 resident work 自动结束。
TUI 仍允许用户在预期其他兼容 Client 会完成工作时选择等待,但每次失败后都会重新展示状态与取消选项,不再静默循环。
本修复不改变 Goal durability、Host admission 或一个 State Root 只有一个 Host authority 的约束。
Verification
English
node --test --test-name-pattern='non-interactive CLI reports how to retire an incompatible Runtime Host' packages/cli/dist/__tests__/runtime-host-cli-context.test.jsnpm --workspace maka-agent run typechecknpm run lintnpm run format:check中文
AI use
Tool(s) and scope: Codex investigated the lifecycle behavior, implemented the CLI/TUI projection, and ran local verification. The commit includes the required
Generated-by: Codextrailer.Visual evidence
The representative TUI conflict state shows the projected Host identity/lifecycle facts and makes the explicit wait (
w) versus default cancel (C) choice visible.