Repository navigation
fix(cli): retry slow iii probes and skip the install prompt on Windows - #1658
Conversation
A cold first run of iii.exe after a reboot can take longer than the 3 s --version probe. The probe then returned null, startEngine treated the installed engine as missing and opened the install prompt. Under a hidden launcher (Task Scheduler, wscript, cmd /c) stdin is still a TTY, so the prompt waited forever and port 3111 never opened. The probe now retries once with a 30 s timeout when the first attempt times out. Other errors still return null at once. On Windows the launcher no longer prompts, because auto-install is unavailable there: it goes straight to the installer path, which prints the manual steps and exits.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| return paths; | ||
| } | ||
|
|
||
| const III_VERSION_PROBE_TIMEOUTS_MS = [3000, 30000]; |
There was a problem hiding this comment.
🟡 Missing sign-off blocks PR merge
The commit introducing III_VERSION_PROBE_TIMEOUTS_MS lacks a Signed-off-by trailer. The repository's DCO policy blocks merging unsigned commits.
Learn more
Every commit must carry a Signed-off-by trailer under the repository's DCO policy. The PR's sole commit has none, so changing source lines cannot fix the violation.
Example: Commit d3837b3 has a subject and body but no Signed-off-by: Name <email> line; the maintainer cannot accept it under the policy.
Recommended fix: Add a valid sign-off trailer to the PR commit and push the updated commit according to the repository's review-feedback and commit-history policy.
Was this helpful? React with 👍 or 👎 to provide feedback.
startEngine probes the same paths several times (fallback logging, compatibility pick, the PATH mismatch message). With the 30 s retry, a binary that hangs on --version could add over a minute of startup. A path whose probe timed out on both attempts is now remembered for the rest of the process and returns null at once. A successful install clears the entry for the installed path. Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
The previous change kept a timed-out path rejected for the rest of the process. A binary that answers later, for example on a second start from doctor, was then skipped and the installer ran instead. startEngine now opens a probe memo for its own scan and drops it when the scan ends. Within one scan each path is probed at most once, which still bounds the repeated 30 s retries. Every later scan probes again. A successful install removes the installed path from the memo. Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
The merge of main placed the reconcile identity test inside the Windows prompt test, so cli-engine-startup.test.ts no longer parsed and every test job failed. Close the Windows test before the next one. Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
scanAndStartEngine ran iii --version on every fallback path only to write a verbose log line, before pickCompatibleIii probed the same paths again for selection. With the longer retry that loop could cost up to 33 s per hanging fallback even when PATH already had a compatible iii. The verbose log now lists the fallback candidates, and probing is left to selection. Signed-off-by: Rohit Ghumare <ghumare64@gmail.com>
Bug
On Windows, a hidden launcher (Task Scheduler running
wscript, thencmd /c agentmemory) can hang at boot forever.daemon.logends at the "How would you like to start iii-engine?" prompt, even though~/.agentmemory/bin/iii.exe --versionworks when run by hand.Cause
Three things combine in
src/cli.ts:iiiBinVersion()probesiii --versionwith a 3 s timeout and returnsnullon any error. The first run ofiii.exeafter a reboot can take longer than that.pickCompatibleIii()then treats the installed engine as missing.interactiveisprocess.stdin.isTTY && !CI. Acmd /cstarted with window style 0 still has a console, so the clack prompt opens where nobody can answer it.runIiiInstaller()cannot auto-install (zip asset) anyway, so the prompt has no useful outcome.Fix
ETIMEDOUT/SIGTERM). Other errors, such as a missing file, still returnnullat once, so the fast path does not change.no-enginefailure instead of waiting.Testing
test/cli-engine-startup.test.tshas two new tests: one for the retry on timeout, and one that checks the Windows branch comes before thep.selectprompt.execFileSyncreports a timeout ascode: "ETIMEDOUT", signal: "SIGTERM", and a missing binary asENOENT.npm run build,npm run skills:checkandnpm teston Node 22. Four tests ingraph.test.ts,observation-source.test.tsandcli-lifecycle-safety.test.tstimed out while the host was at load average 78.cli-lifecycle-safetypasses when run alone, and the other two files do not touch this code.Fixes #1643
Summary by CodeRabbit
iiiversion checks after 3 seconds and again with a 30-second timeout. If both attempts time out, the version is reported as unavailable; other check failures also report it as unavailable.iiibinary is missing, the CLI proceeds directly to installation instead of showing an interactive installation choice.