Repository navigation
fix(tui): keep process alive after OpenTUI render - #920
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07985859c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| // Keep process alive — OpenTUI renderer runs in the event loop. | ||
| // Without this, bun exits immediately after render() returns. | ||
| await new Promise(() => {}); |
There was a problem hiding this comment.
Resolve renderNav when renderer is destroyed
await new Promise(() => {}) blocks forever even after the OpenTUI renderer is torn down, so launchTui() never returns and the caller in src/genie.ts can’t reach its normal exit path. In the common shutdown path (SIGINT/SIGTERM/SIGHUP, which OpenTUI handles by calling destroy()), this leaves the Bun process hanging instead of exiting cleanly, so users and automation need a hard kill. This should wait on a renderer lifecycle event (e.g., destroy) rather than an unresolvable promise.
Useful? React with 👍 / 👎.
bun exits immediately after createRoot().render() returns. Wait on the renderer's 'destroy' event (EventEmitter) so the process stays alive while OpenTUI runs, and exits cleanly on Ctrl+Q / SIGTERM.
0798585 to
ecb38a9
Compare
Root cause
bun exits immediately after
createRoot().render()returns — the OpenTUI renderer runs in the event loop but the main async function completes, leaving nothing to keep the process alive.Fix
One line:
await new Promise(() => {})after render.Evidence
Before: TUI process exits instantly (EXIT_CODE=0), left pane shows garbled probe artifacts.
After: bun stays alive, OpenTUI nav renders (Agents 5/11, tree, keyboard hints), right pane attaches to agent terminal.