Skip to content

fix(tui): use default import for signal-exit (not named export) - #42429

Closed
chronikion wants to merge 1 commit into
NousResearch:mainfrom
chronikion:fix/tui-signal-exit-import
Closed

fix(tui): use default import for signal-exit (not named export)#42429
chronikion wants to merge 1 commit into
NousResearch:mainfrom
chronikion:fix/tui-signal-exit-import

Conversation

@chronikion

@chronikion chronikion commented Jun 8, 2026

Copy link
Copy Markdown

What changes:

Fix ui-tui/packages/hermes-ink/src/ink/ink.tsx: use default import for signal-exit.

Why would it change:

signal-exit is a CJS module exported as a single function via module.exports.

The current prebuilt dist/entry.js accesses the module correctly via .default at three callsites (lines 43321, 53327, 54299). But the TypeScript source uses a named import { onExit } which would resolve to undefined on the next esbuild rebuild, breaking the TUI on any environment — not just the npm-broken one.

Discovered during a separate debugging effort (PR #40694). Confirmed by the actual runtime error: TypeError: (0, import_signal_exit.onExit) is not a function.

How to verify:

The fix has no behavioral change — it corrects the import to match the module's actual export shape. The esbuild __toESM wrapper sets .default to module.exports, so import onExit from 'signal-exit' resolves correctly.

Tests:

Build-time correctness fix — the module's export shape doesn't change at runtime. The existing prebuilt bundle already uses .default access and works. The fix prevents a regression on the next rebuild.

Platforms tested:

  • Rocky Linux 9.7 (kernel 5.14, glibc 2.34)

Related:

  • PR #40694 — TUI launcher prebuilt-fallback fix where this import error was discovered.

@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 Jun 8, 2026
signal-exit exports as a default export, not a named export.  The
named import { onExit } crashes at runtime in the prebuilt bundle on
environments where npm is broken and the fallback path is taken.

Discovered after the npm-install-fallback fix (2a9f0ca): the prebuilt
bundle launched successfully, then immediately crashed because the
bundled import style was wrong.
@chronikion chronikion closed this Jun 24, 2026
@chronikion
chronikion deleted the fix/tui-signal-exit-import branch June 24, 2026 11:44
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.

2 participants