Skip to content

fix(tui): update _hermes_ink_bundle_stale to check for entry-exports.js - #21630

Closed
fiikf wants to merge 1 commit into
NousResearch:mainfrom
fiikf:fix/ink-bundle-stale-check
Closed

fix(tui): update _hermes_ink_bundle_stale to check for entry-exports.js#21630
fiikf wants to merge 1 commit into
NousResearch:mainfrom
fiikf:fix/ink-bundle-stale-check

Conversation

@fiikf

@fiikf fiikf commented May 8, 2026

Copy link
Copy Markdown

Bug Description

The dashboard "Chat" tab is permanently broken after any server restart. /api/pty WebSocket connections hang and eventually return HTTP 502 via nginx (upstream prematurely closed connection).

Root Cause

Commit 2d3d1d973 changed the @hermes/ink build script from --outfile=dist/ink-bundle.js to --outdir=dist (producing dist/entry-exports.js), but _hermes_ink_bundle_stale() was never updated to match. It continues to check for the old filename dist/ink-bundle.js, which never exists.

This causes _tui_build_needed() to always return True, triggering a synchronous npm run build (~21 seconds) on every /api/pty WebSocket connection. The subprocess.run() call blocks the asyncio event loop, preventing the WebSocket 101 handshake from being flushed to the client, resulting in a timeout.

Fix

One-line change in hermes_cli/main.py:975:

-    bundle = ink_root / "dist" / "ink-bundle.js"
+    bundle = ink_root / "dist" / "entry-exports.js"

Also updates the test helper _touch_ink_bundle in tests/hermes_cli/test_tui_npm_install.py to use the correct filename.

How to Verify

  1. Ensure ui-tui/packages/hermes-ink/dist/entry-exports.js exists and is up-to-date
  2. Open the dashboard Chat tab — the WebSocket connection should succeed immediately
  3. Check _tui_build_needed() returns False once the bundle is present:
    from hermes_cli.main import _tui_build_needed, PROJECT_ROOT
    assert _tui_build_needed(PROJECT_ROOT / "ui-tui") is False

Test Plan

  • All 11 existing tests in test_tui_npm_install.py pass
  • Manual verification: /api/pty WebSocket connects in <1s (was timing out at 5s)

Risk Assessment

Low — single-line string change matching the actual esbuild output filename. Both filenames refer to the same bundled artifact; the check logic is unchanged.

@alt-glitch alt-glitch added type/bug Something isn't working P1 High — major feature broken, no workaround comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/cli CLI entry point, hermes_cli/, setup wizard labels May 8, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #20951 (identical one-line fix: ink-bundle.js → entry-exports.js in _hermes_ink_bundle_stale). Also duplicates #21098 and #20322. Superset PR #20686 adds auto-resume on top of the same fix.

Commit 2d3d1d9 changed the hermes-ink build script from --outfile=dist/ink-bundle.js
to --outdir=dist (producing dist/entry-exports.js), but _hermes_ink_bundle_stale was
never updated to match. This caused _tui_build_needed to always return True, triggering
a 20+ second npm run build on every /api/pty WebSocket connection, which blocked the
asyncio event loop and caused the WebSocket handshake to time out (HTTP 502 via nginx).

Fixes: the dashboard 'Chat' tab being permanently broken after any restart.
See: commit 2d3d1d9 ("fix(tui): use --outdir instead of --outfile")
See: PR NousResearch#15351 which originally added the stale check
@fiikf

fiikf commented May 8, 2026

Copy link
Copy Markdown
Author

Closing as duplicate. Superseded by #20686 which includes the same ink-bundle → entry-exports fix plus auto-resume functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/tui Terminal UI (ui-tui/ + tui_gateway/) P1 High — major feature broken, no workaround type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants