Open
Conversation
Detect offline state via a DNS lookup of the npm registry at the start of `argent init` and render a red "Offline mode" note listing the steps that require network access (global install/update, `npx skills`). Skip the update-check spinner entirely when offline and default the skills prompt to the manual option so the user is not dropped into a failing npx run. Also pipe stderr on the `npm view` version lookup so its 404 output no longer leaks to the terminal.
Replace the `isOnline` test that hit real DNS with deterministic mocks for `node:dns.lookup` and `node:child_process.execSync`, and add coverage for `isSkillsCliAvailable` and `getLatestVersion` (trim, stderr pipe regression guard, error propagation). Fixes found during verification: - Offline skills install now passes `--no-install` to npx so it uses the cache that `isSkillsCliAvailable()` already confirmed, instead of hitting the registry for a fresh copy and failing offline. - Strip `--no-install` from the manual-recovery hint so users can retry with network access. - `isSkillsCliAvailable` and `getLatestVersion` now pass execSync timeouts (2s and 10s) so a wedged `npx` or captive portal cannot hang `argent init`.
This comment was marked as outdated.
This comment was marked as outdated.
…ning Instead of showing a large offline banner at the start of init that lists everything that will be skipped, only check online status at the skills step — the one place where offline truly matters. The update check already handles registry failures gracefully via try/catch. When offline and skills CLI is not cached, a single-line warning appears right before the skills prompt, and the default shifts to Manual.
The stdio piping and timeout addition to getLatestVersion belongs in a separate PR — it fixes stderr leakage from npm view, not offline handling.
Build the base skillsArgs list once, then derive npxArgs by prepending --no-install when using the offline cache. The error recovery hint uses the base list directly — no stripping needed.
Drop the initialValue on the skills prompt — it changed the default selection which is unrelated to offline handling. Fix the test file comment that still referenced getLatestVersion after its tests were removed.
getLatestVersion (npm view) hangs indefinitely offline without a timeout, blocking users from reaching the skills step. Use the shared PROBE_TIMEOUT_MS constant, lowered to 3s for snappier offline detection.
When offline without cached skills CLI, go straight to manual instead of showing unselectable options. Add PROBE_TIMEOUT_MS to getLatestVersion so the update check doesn't hang indefinitely offline.
latekvo
commented
Apr 17, 2026
| } | ||
| } | ||
|
|
||
| const PROBE_TIMEOUT_MS = 3_000; |
Member
Author
There was a problem hiding this comment.
I believe this is an acceptable wait time for the edge case where someone is offline and is still running argent init.
From my measurements:
isOnline()probes DNS, for me it takes100-200msevery timeisSkillsCliAvailable()probes local fs via npm, takes0.5-1sgetLatestVersion()talks over https, on super super slow connections it could hit the wall, but it doesn't actually regress any features, only defers the available update to a later date. Nothing else happens.
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.
Summary
argent initand gracefully degradesnpx skillswith--no-installwhen available