Skip to content

fix(tui): keep process alive after OpenTUI render - #920

Merged
namastex888 merged 1 commit into
devfrom
fix/tui-keep-alive
Mar 30, 2026
Merged

namastex888 merged 1 commit into
devfrom
fix/tui-keep-alive

Conversation

@namastex888

Copy link
Copy Markdown
Contributor

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.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8d25508f-bd2d-40ec-b40e-e5f5231b4512

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/tui-keep-alive

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/tui/render.tsx Outdated

// Keep process alive — OpenTUI renderer runs in the event loop.
// Without this, bun exits immediately after render() returns.
await new Promise(() => {});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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.
@namastex888
namastex888 merged commit 046174a into dev Mar 30, 2026
5 checks passed
@namastex888
namastex888 deleted the fix/tui-keep-alive branch April 10, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant