fix: resolve 60s terminal_ready timeout on 'cli-box start' (headless + dev-mode) - #55
Merged
Merged
Conversation
In headless mode the readiness signal path (renderer -> screenshot WS -> terminal_ready_sandboxes) never fires, so 'cli-box start' always hits the 60s terminal readiness timeout. Spec proposes the daemon answer readiness from PTY state in headless mode. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
In headless mode no renderer connects the screenshot WebSocket, so terminal_ready_sandboxes was never populated and 'cli-box start' always hit the 60s readiness timeout. Derive terminal_ready from the sandbox's PTY existence in headless mode; non-headless path unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
The dev dist paths (dist/electron/mac-arm64 and mac) looked for
Contents/MacOS/cli-box, but the built bundle's launcher binary is named
"CLI Box" — matching the release path and both cached/downloaded paths,
and the actual file on disk. In dev mode this made Electron fail to
launch ('No such file or directory'), so no renderer connected and
'cli-box start' hit the 60s terminal_ready timeout on the non-headless
path. Align the dev paths with the other four.
The legacy Tauri cmd_start (line 340) is a different app and is left
unchanged.
Co-Authored-By: Claude <noreply@anthropic.com>
🔒 门禁检查结果
Rust 测试覆盖率
前端测试覆盖率
✅ 所有检查通过,可以合入
|
4 tasks
Shadow-Azure
added a commit
that referenced
this pull request
Jul 22, 2026
Patch release for the headless terminal_ready timeout fix (#55): 'cli-box start' waited the full 60s for the renderer to connect in headless and dev mode. Resyncs Cargo.lock. Co-authored-by: ZN-Ice <zn-ice@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
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.
Problem
cli-box startblocked for the full 60s terminal-readiness timeout in two situations, then proceeded anyway (the sandbox was actually ready within milliseconds):--headless, so no Electron renderer ever connects the screenshot WebSocket.terminal_ready_sandboxesis populated only by a renderer-sentterminal_readymessage, which never arrives — so the CLI's readiness poll always times out at 60s. (This is the known "TUI start 60s timeout" on the Aliyun test host.)find_electron_binary()looked forContents/MacOS/cli-boxin the dev dist bundle, but the bundle's launcher binary is namedCLI Box. Electron failed to launch ("No such file or directory"), no renderer connected, same 60s timeout.Solution
Headless terminal_ready timeout —
8615cf2In
readyz_handler(crates/cli-box-core/src/daemon/mod.rs), whenDaemonState.headlessis true, deriveterminal_readyfrom the queried sandbox'spty_pidexistence instead of the renderer-populatedterminal_ready_sandboxesset. PTYs are spawned synchronously at sandbox creation, so this is race-free. The CLI gates solely onterminal_ready(status/renderer_connectedare#[allow(dead_code)]), so no protocol or CLI change is needed. The non-headless (renderer-driven) path is unchanged.Dev-mode Electron binary name —
d8ec07aIn
find_electron_binary()(crates/cli-box-cli/src/main.rs), corrected the two dev dist paths (dist/electron/mac-arm64,dist/electron/mac) fromContents/MacOS/cli-box→Contents/MacOS/CLI Box, matching the release path, both cached/downloaded paths, and the actual on-disk binary. The legacy Tauricmd_start(a different app,#[allow(dead_code)]) is left unchanged.Test Plan
cargo test -p cli-box-core --test daemon_integration— 16/16 pass, incl. 2 new:readyz_terminal_ready_in_headless_mode(headless sb→ready, unknown→not-ready) andreadyz_terminal_ready_uses_renderer_set_when_not_headless(regression guard for the renderer path)cargo clippy --all-targets -- -D warningsclean;cargo fmt --all -- --checkcleancli-box startreturns within ~1s instead of 60s (definitive headless verification)e2e-compound-start-screenshot(was failing on the name bug) to confirm green🤖 Generated with Claude Code