Skip to content

feat: Show offline banner during argent init#113

Open
latekvo wants to merge 15 commits intomainfrom
offline-init-banner
Open

feat: Show offline banner during argent init#113
latekvo wants to merge 15 commits intomainfrom
offline-init-banner

Conversation

@latekvo
Copy link
Copy Markdown
Member

@latekvo latekvo commented Apr 13, 2026

Summary

  • Detects offline state during argent init and gracefully degrades
  • Skills step: warns and skips to manual when offline; uses cached npx skills with --no-install when available
  • Update check: bounded by a 3s timeout so it doesn't hang offline

latekvo added 5 commits April 13, 2026 16:21
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.
@latekvo latekvo changed the title Show offline banner during argent init feat: Show offline banner during argent init Apr 13, 2026
@latekvo latekvo marked this pull request as draft April 13, 2026 15:15
latekvo added 2 commits April 13, 2026 19:01
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`.
@latekvo

This comment was marked as outdated.

latekvo added 5 commits April 16, 2026 15:34
…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.
@latekvo latekvo marked this pull request as ready for review April 16, 2026 14:01
@latekvo latekvo requested a review from pFornagiel April 16, 2026 14:03
@latekvo latekvo marked this pull request as draft April 16, 2026 14:11
@latekvo latekvo removed the request for review from pFornagiel April 16, 2026 14:11
latekvo added 2 commits April 16, 2026 16:17
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 latekvo marked this pull request as ready for review April 17, 2026 08:28
}
}

const PROBE_TIMEOUT_MS = 3_000;
Copy link
Copy Markdown
Member Author

@latekvo latekvo Apr 17, 2026

Choose a reason for hiding this comment

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

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 takes 100-200ms every time
  • isSkillsCliAvailable() probes local fs via npm, takes 0.5-1s
  • getLatestVersion() 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.

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.

1 participant