Skip to content

fix(install): detect TLS cert-trust failures during npm install on Windows#40588

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6316b515
Jun 6, 2026
Merged

fix(install): detect TLS cert-trust failures during npm install on Windows#40588
teknium1 merged 2 commits into
mainfrom
hermes/hermes-6316b515

Conversation

@teknium1

@teknium1 teknium1 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Windows installs that fail on a corporate proxy now tell the user it's a TLS certificate-trust problem and how to fix it, instead of an opaque npm install failed (exit 1).

Root cause for #38016: the desktop stage's npm ci runs Electron's install.js, which downloads the Electron binary over HTTPS. A corporate MITM proxy / missing root CA makes Node throw RequestError: unable to get local issuer certificate. The installer reported only the generic exit code, so the reporter misread it as an admin-rights issue. Admin rights were never the problem — the install reached the desktop stage fine.

Changes

  • scripts/install.ps1: add shared Show-NpmCertHint helper that detects the TLS-trust signatures (unable to get local issuer certificate, self-signed certificate, UNABLE_TO_GET_ISSUER_CERT_LOCALLY, SELF_SIGNED_CERT_IN_CHAIN, CERT_HAS_EXPIRED) and prints NODE_EXTRA_CA_CERTS / strict-ssl remediation.
  • Wire it into all three npm-install failure paths so any stage benefits:

Validation

Verified with real PowerShell 7.4.6 (Parser::ParseFile + behavior harness):

Input Behavior
#38016 cert log prints full hint, returns True
Unrelated failure (VS Build Tools missing) silent, returns False
Empty output silent, returns False
Tee-Object -Variable captures output while still streaming it live

Full script parses with zero errors.

Closes #38016.

Infographic

tls-cert-trust-detection

teknium1 added 2 commits June 4, 2026 17:11
Port from anomalyco/opencode#30749.

When compression.enabled is false, NO automatic compaction trigger may
fire. The proactive token-threshold paths (preflight + post-response
should_compress gate) already honoured the setting, but the three
provider-overflow recovery paths in the agent loop — long-context-tier
429, 413 payload-too-large, and context-overflow — called
_compress_context() unconditionally, silently compressing and rotating
the session against the user's explicit choice.

Add a single guard at the top of the overflow-recovery dispatch: when
compression is disabled and the error is one of those three overflow
classes, surface a terminal error (compaction_disabled: True) telling the
user to /compress manually, /new, switch to a larger-context model, or
reduce attachments. Manual /compress (force=True) is unaffected — it never
enters this loop.

Tests: new TestOverflowWithCompactionDisabled (413 + 400 overflow don't
compress when disabled; control case still compresses when enabled).
Existing overflow-recovery tests updated to enable compaction explicitly
(they verify the recovery fires); fixture defaults flipped to True to
match production (compression.enabled defaults to True).
…ndows

Corporate MITM proxies and missing root CAs surface as 'unable to get
local issuer certificate' while npm (most often Electron's install.js
postinstall) downloads over HTTPS. The installer surfaced this as an
opaque 'desktop workspace npm install failed (exit 1)', so users
misread it as a permissions/admin-rights problem (issue #38016).

Add a shared Show-NpmCertHint detector and route all three npm-install
failure paths (agent-browser global install, browser-tools workspace,
desktop workspace) through it. On a cert error it prints actionable
NODE_EXTRA_CA_CERTS / strict-ssl remediation; on any other failure it
stays silent.
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have area/config Config system, migrations, profiles labels Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-6316b515 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9962 on HEAD, 9962 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5167 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@teknium1 teknium1 merged commit fd234ba into main Jun 6, 2026
23 checks passed
@teknium1 teknium1 deleted the hermes/hermes-6316b515 branch June 6, 2026 16:00
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
…ndows (NousResearch#40588)

* fix: respect disabled auto-compaction on context overflow

Port from anomalyco/opencode#30749.

When compression.enabled is false, NO automatic compaction trigger may
fire. The proactive token-threshold paths (preflight + post-response
should_compress gate) already honoured the setting, but the three
provider-overflow recovery paths in the agent loop — long-context-tier
429, 413 payload-too-large, and context-overflow — called
_compress_context() unconditionally, silently compressing and rotating
the session against the user's explicit choice.

Add a single guard at the top of the overflow-recovery dispatch: when
compression is disabled and the error is one of those three overflow
classes, surface a terminal error (compaction_disabled: True) telling the
user to /compress manually, /new, switch to a larger-context model, or
reduce attachments. Manual /compress (force=True) is unaffected — it never
enters this loop.

Tests: new TestOverflowWithCompactionDisabled (413 + 400 overflow don't
compress when disabled; control case still compresses when enabled).
Existing overflow-recovery tests updated to enable compaction explicitly
(they verify the recovery fires); fixture defaults flipped to True to
match production (compression.enabled defaults to True).

* fix(install): detect TLS cert-trust failures during npm install on Windows

Corporate MITM proxies and missing root CAs surface as 'unable to get
local issuer certificate' while npm (most often Electron's install.js
postinstall) downloads over HTTPS. The installer surfaced this as an
opaque 'desktop workspace npm install failed (exit 1)', so users
misread it as a permissions/admin-rights problem (issue NousResearch#38016).

Add a shared Show-NpmCertHint detector and route all three npm-install
failure paths (agent-browser global install, browser-tools workspace,
desktop workspace) through it. On a cert error it prints actionable
NODE_EXTRA_CA_CERTS / strict-ssl remediation; on any other failure it
stays silent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Setup]: Hermes Desktop failed on Windows 11 without admin right

2 participants