Skip to content

fix(cli): retry slow iii probes and skip the install prompt on Windows - #1658

Merged
rohitg00 merged 6 commits into
mainfrom
fix/iii-probe-windows-prompt
Nov 3, 2026
Merged

rohitg00 merged 6 commits into
mainfrom
fix/iii-probe-windows-prompt

Conversation

@rohitg00

@rohitg00 rohitg00 commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Bug

On Windows, a hidden launcher (Task Scheduler running wscript, then cmd /c agentmemory) can hang at boot forever. daemon.log ends at the "How would you like to start iii-engine?" prompt, even though ~/.agentmemory/bin/iii.exe --version works when run by hand.

Cause

Three things combine in src/cli.ts:

  1. iiiBinVersion() probes iii --version with a 3 s timeout and returns null on any error. The first run of iii.exe after a reboot can take longer than that. pickCompatibleIii() then treats the installed engine as missing.
  2. interactive is process.stdin.isTTY && !CI. A cmd /c started with window style 0 still has a console, so the clack prompt opens where nobody can answer it.
  3. On Windows, runIiiInstaller() cannot auto-install (zip asset) anyway, so the prompt has no useful outcome.

Fix

  • The probe retries once with a 30 s timeout when the first attempt times out (ETIMEDOUT / SIGTERM). Other errors, such as a missing file, still return null at once, so the fast path does not change.
  • On Windows, startup skips the prompt and goes straight to the installer path. That path prints the manual install steps and exits with the existing no-engine failure instead of waiting.

Testing

  • test/cli-engine-startup.test.ts has two new tests: one for the retry on timeout, and one that checks the Windows branch comes before the p.select prompt.
  • Checked with Node that execFileSync reports a timeout as code: "ETIMEDOUT", signal: "SIGTERM", and a missing binary as ENOENT.
  • Ran npm run build, npm run skills:check and npm test on Node 22. Four tests in graph.test.ts, observation-source.test.ts and cli-lifecycle-safety.test.ts timed out while the host was at load average 78. cli-lifecycle-safety passes when run alone, and the other two files do not touch this code.

Fixes #1643

Summary by CodeRabbit

  • Bug Fixes
    • The CLI retries timed-out iii version 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.
    • Version check results are cached per binary during each engine scan. Checks run again on later scans and after installation.
    • On Windows, if the local iii binary is missing, the CLI proceeds directly to installation instead of showing an interactive installation choice.
    • Verbose output lists fallback candidates together.

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.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agentmemory Ready Ready Preview Nov 3, 2026 5:42pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The CLI retries timed-out iii --version probes, caches results during each engine scan, and invalidates the installed binary’s cached result. On Windows, a missing compatible local binary now selects installation instead of proceeding to the interactive choice flow.

Changes: Engine startup

Layer / File(s) Summary
Retry and cache version probes
src/cli.ts, test/cli-engine-startup.test.ts
Version probes retry with a 30-second timeout after a timeout at 3 seconds. Results are cached per binary path during one engine scan, then the cache is cleared. Successful installation invalidates that binary’s cached result. Verbose fallback output lists candidate paths. Tests cover retries and cache behavior.
Select installation on Windows
src/cli.ts, test/cli-engine-startup.test.ts
When Windows has no compatible local binary, the CLI selects installation and logs a warning instead of proceeding to the interactive install or manual choice. A test checks that this branch occurs before the install prompt.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Merge Risk: Minimal · up to 31302

The changes avoid repeated version checks and unanswered Windows installation prompts. Windows startup reports manual setup instructions when no compatible engine is available. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: retrying slow iii probes and skipping the Windows install prompt.
Linked Issues check Passed Issue #1643 requires two coding outcomes. The PR retries iii --version after a timeout with a longer timeout, while non-timeout errors still return null. The PR also selects the installer path on …
Out of Scope Changes check Passed The reported changes stay within Issue #1643. Probe-result caching limits repeated iii --version calls during an engine scan. Cache clearing supports re-probing after installation and on later scans…
Full details: Linked Issues check

Explanation

Issue #1643 requires two coding outcomes. The PR retries iii --version after a timeout with a longer timeout, while non-timeout errors still return null. The PR also selects the installer path on Windows before the interactive install prompt. The installer path reports manual installation and preserves the existing no-engine failure. test/cli-engine-startup.test.ts covers the timeout retry and Windows prompt ordering.

Full details: Out of Scope Changes check

Explanation

The reported changes stay within Issue #1643. Probe-result caching limits repeated iii --version calls during an engine scan. Cache clearing supports re-probing after installation and on later scans. The added tests cover these supporting changes and the Windows prompt bypass. No unrelated file or behavior change appears in the reviewed change summary.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bdc396e0-5857-4729-a438-20fd980a273a
Commits

Reviewing files that changed from the base of the PR and between c54a21b and 31302d3.

Files selected for processing: 1
  • src/cli.ts
Files skipped from review as they are similar to previous changes: 1
  • src/cli.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 3 potential issues.

Devin Review

Comment thread src/cli.ts
return paths;
}

const III_VERSION_PROBE_TIMEOUTS_MS = [3000, 30000];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread src/cli.ts Resolved
Comment thread test/cli-engine-startup.test.ts Resolved
coderabbitai[bot]

This comment was marked as resolved.

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>
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

rohitg00 and others added 2 commits November 3, 2026 22:16
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>
coderabbitai[bot]

This comment was marked as resolved.

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>
@rohitg00
rohitg00 merged commit 57fdbc3 into main Nov 3, 2026
15 checks passed

This branch was successfully deployed

1 active deployment
Preview — 31302d3b Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: launcher hangs at boot on a hidden install prompt when the 3 s iii --version probe misses

1 participant