Skip to content

fix(tui): rebuild when ink bundle is missing#15351

Merged
OutThisLife merged 1 commit into
NousResearch:mainfrom
helix4u:fix/tui-rebuild-missing-ink-bundle
Apr 25, 2026
Merged

fix(tui): rebuild when ink bundle is missing#15351
OutThisLife merged 1 commit into
NousResearch:mainfrom
helix4u:fix/tui-rebuild-missing-ink-bundle

Conversation

@helix4u

@helix4u helix4u commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Repairs a TUI first-launch/update failure where hermes --tui could crash after a partial npm install/build.

The TUI imports the local workspace package @hermes/ink, whose index.js re-exports packages/hermes-ink/dist/ink-bundle.js. If a network failure interrupts setup after node_modules/@hermes/ink/package.json exists but before the bundle is built, the production launch path can think dependencies are installed and the main TUI bundle is current, then crash with:

Cannot find module '.../ui-tui/node_modules/@hermes/ink/dist/ink-bundle.js'

The normal production build script already rebuilds @hermes/ink; the missing piece was detecting that the local Ink bundle was absent/stale before deciding whether the TUI build is needed.

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • hermes_cli/main.py: makes _tui_build_needed() return true when packages/hermes-ink/dist/ink-bundle.js is missing or stale.
  • tests/hermes_cli/test_tui_npm_install.py: adds regression coverage for the partial-install state where @hermes/ink appears installed but its bundle is missing.

How to Test

  1. Delete ui-tui/packages/hermes-ink/dist/ink-bundle.js while keeping ui-tui/dist/entry.js and ui-tui/node_modules/@hermes/ink/package.json.
  2. Run hermes --tui.
  3. Confirm Hermes rebuilds the TUI instead of launching into the missing-module crash.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu 24.04

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

  • python -m py_compile hermes_cli/main.py → passed
  • ./scripts/run_tests.sh tests/hermes_cli/test_tui_npm_install.py -n 47 passed
  • ./scripts/run_tests.sh tests/ -n 4 → attempted; the current baseline showed broad unrelated failures, then stalled near 98% after cleanup-thread logging errors (ValueError: I/O operation on closed file) and was stopped instead of leaving pytest wedged.

@helix4u helix4u marked this pull request as ready for review April 24, 2026 22:13
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Apr 24, 2026
@OutThisLife OutThisLife merged commit ee0728c into NousResearch:main Apr 25, 2026
4 of 7 checks passed
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…ssing-ink-bundle

fix(tui): rebuild when ink bundle is missing
fiikf added a commit to fiikf/hermes-agent that referenced this pull request May 8, 2026
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
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…ssing-ink-bundle

fix(tui): rebuild when ink bundle is missing
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…ssing-ink-bundle

fix(tui): rebuild when ink bundle is missing
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…ssing-ink-bundle

fix(tui): rebuild when ink bundle is missing
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…ssing-ink-bundle

fix(tui): rebuild when ink bundle is missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants