Skip to content

fix(tui): use git commit hash for build staleness — immune to git pull mtime changes#21837

Open
ygd58 wants to merge 2 commits into
NousResearch:mainfrom
ygd58:fix/tui-build-fallback-on-pty
Open

fix(tui): use git commit hash for build staleness — immune to git pull mtime changes#21837
ygd58 wants to merge 2 commits into
NousResearch:mainfrom
ygd58:fix/tui-build-fallback-on-pty

Conversation

@ygd58

@ygd58 ygd58 commented May 8, 2026

Copy link
Copy Markdown
Contributor

Problem

mtime-based staleness check caused _tui_build_needed() to always return True after git pull. In PTY/WebSocket context this triggered a rebuild that failed silently with sys.exit(1), showing [session ended] in the dashboard Chat tab.

Fix

  1. _tui_get_source_hash() — uses git HEAD commit hash (immune to mtime changes), falls back to mtime hash for non-git installs
  2. Write dist/.build-stamp after successful build; compare on next run — skips rebuild when hash matches
  3. Fall back to existing dist/entry.js when rebuild fails in PTY context instead of sys.exit(1)

Fixes #21801

ygd58 added 2 commits May 8, 2026 13:32
…TY context

After git pull, source file mtimes are newer than dist/entry.js so
_tui_build_needed() returns True and triggers a rebuild. When triggered
from the PTY WebSocket handler (hermes dashboard --tui), the build
fails silently — sys.exit(1) is caught as SystemExit, the PTY session
dies, and the Chat tab shows [session ended] immediately (issue NousResearch#21801).

Fix: if dist/entry.js already exists and the rebuild fails, emit a
warning and fall back to the existing build instead of calling
sys.exit(1). The fallback only applies when a pre-existing dist exists;
a missing dist still hard-fails as before.

Users can run 'npm run build' in ui-tui/ manually to update the build.

Fixes NousResearch#21801
…l mtime changes

mtime-based staleness check caused _tui_build_needed() to always return
True after git pull (all source files get new mtimes). In PTY/WebSocket
context this triggered a rebuild that failed silently with sys.exit(1),
showing [session ended] in the dashboard Chat tab (issue NousResearch#21801).

Two-part fix:
1. Add _tui_get_source_hash() — uses git HEAD commit hash when
   available (immune to mtime changes), falls back to mtime hash for
   non-git installs
2. Write dist/.build-stamp after successful build; compare against
   current hash on next run — skips rebuild when hash matches
3. Fall back to existing dist/entry.js when rebuild fails in PTY
   context instead of calling sys.exit(1)

Fixes NousResearch#21801
@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/) comp/cli CLI entry point, hermes_cli/, setup wizard labels May 8, 2026
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/) 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.

[Bug]: hermes dashboard --tui shows [session ended] after v0.13.0 update — TUI build fails when triggered via PTY WebSocket handler

2 participants