[Bug] Silent auto-update can fail because the hard 60s timeout is shorter than a successful global npm install
Summary
Memorix v1.0.6 silent auto-update appears to run npm install -g memorix@<target> with a hard-coded 60s timeout.
On my machine, the built-in auto-update recorded a failed update from 1.0.6 to 1.0.7, but the same update succeeded immediately when run manually. The successful manual install took 1:01.22, which is slightly longer than the built-in 60s limit.
This makes the silent auto-update unreliable even when the upgrade itself is valid and would complete successfully.
Observed behavior
- Installed version:
1.0.6 - Latest version detected by update check:
1.0.7 - Silent auto-update status was recorded as
failed - A manual
npm install -g [email protected]on the same machine completed successfully - The successful manual install took
1:01.22 - After the manual install,
memorix --versionreported1.0.7
This does not look like a permissions problem:
- the global npm installation target was writable
- the manual global install succeeded
- the failure seems tied to the updater's runtime limit, not to npm rejecting the install
Why this looks like a timeout bug
In the installed v1.0.6 bundle, the auto-updater appears to spawn:
npm install -g memorix@<targetVersion>
with a hard-coded timeout of 60000 ms.
That means a completely valid install can be marked as failed if it needs slightly more than 60 seconds.
A successful real-world installation taking 1:01.22 is enough to reproduce the problem.
Expected behavior
If the package can be installed successfully, the silent updater should not fail just because the install takes slightly more than 60 seconds.
Actual behavior
The silent updater marks the update as failed, even though the same exact command succeeds when run manually and only exceeds the built-in timeout by a small margin.
Suggested fixes
- Increase the timeout substantially, or remove the hard stop and let npm finish naturally.
- Make the timeout configurable, for example via something like
MEMORIX_AUTO_UPDATE_TIMEOUT_MS. - Store more diagnostic detail in the update status, such as exit code / signal / whether the child was killed by timeout.
- Consider degrading to notify-only mode instead of recording a generic failed auto-update when the child process is terminated by the updater.
Why this matters
Silent auto-update is most useful on real machines with:
- slower network access
- slower disks
- larger dependency trees
- transient npm latency
Those are exactly the environments where a fixed 60s limit is most likely to cause false failures.
If helpful, I can provide the exact sanitized timings and the recorded update status fields, but the key point is simple:
- silent auto-update failed for
1.0.6 -> 1.0.7 - manual update succeeded
- successful install time was
1:01.22 - the built-in 60s timeout is likely too short
Fixed and verified.
The silent auto-update path now uses a longer default timeout (5 minutes instead of the previous hard 60s cutoff), supports configuration via MEMORIX_AUTO_UPDATE_TIMEOUT_MS with safe clamping, and records richer failure diagnostics including timeout / exit code / signal details.
Verified in this repo with:
- npm test -- tests/cli/update-checker.test.ts
- npm run build
- npm run lint