Skip to content

feat(validator): add --no-tui runtime flag#1252

Open
0xzrf wants to merge 2 commits into
magicblock-labs:masterfrom
0xzrf:add_no_tui
Open

feat(validator): add --no-tui runtime flag#1252
0xzrf wants to merge 2 commits into
magicblock-labs:masterfrom
0xzrf:add_no_tui

Conversation

@0xzrf
Copy link
Copy Markdown
Contributor

@0xzrf 0xzrf commented May 27, 2026

Summery

Adds --no-tui so published TUI builds can run without the in-process terminal UI.

  • Default: TUI still launches when built with --features tui.
  • --no-tui: headless startup (banner + graceful shutdown on SIGINT/SIGTERM).

Compatibility

  • Config: new optional no-tui field (CLI: --no-tui; env: MBV_NO_TUI=true).
  • Migrations: none.
  • Operator impact: non-breaking; existing behavior unchanged unless --no-tui is set.

Testing

  • cargo run -p magicblock-validator --features tui → TUI
  • cargo run -p magicblock-validator --features tui -- --no-tui → headless

Fixes #1239.

Summary by CodeRabbit

  • New Features

    • Added a --no-tui flag to run the validator in headless mode, allowing the terminal UI to be disabled at runtime.
  • Documentation

    • Updated the Validator In-Process Mode docs/README to describe the new --no-tui runtime option and clarify behavior when the TUI feature is not enabled.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 783c5ee6-121b-4673-8d55-d1f0383a913d

📥 Commits

Reviewing files that changed from the base of the PR and between 575ab38 and 80532d7.

📒 Files selected for processing (4)
  • magicblock-config/src/config/cli.rs
  • magicblock-config/src/lib.rs
  • magicblock-validator/src/main.rs
  • tools/magicblock-tui-client/README.md

📝 Walkthrough

Walkthrough

This PR adds a --no-tui CLI flag and corresponding no_tui: bool config fields, refactors startup to consult that flag at runtime, unifies imports and tracing setup, and extracts a shared headless startup path as run_no_tui. When no_tui is set the validator prints startup info and waits for graceful shutdown instead of launching the TUI. The README notes the runtime --no-tui option for tui builds.

Assessment against linked issues

Objective Addressed Explanation
Published binary should have an option to disable TUI [#1239]

Assessment against linked issues: Out-of-scope changes

(none)

Suggested reviewers

  • GabrielePicco
  • Dodecahedr0x
  • thlorenz
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@magicblock-validator/src/main.rs`:
- Around line 133-167: The duplicated headless startup/banner/shutdown sequence
should be extracted into a single helper function (e.g., run_headless_startup)
that accepts the needed context (rpc_url, ws_url, remote_rpc_url,
validator_identity, api, overall_start) and performs the print_info calls,
version reporting, the initial debug log, waits on Shutdown::wait().await and
logs the shutdown debug/error using the same shutdown_wait measurement; replace
the duplicated blocks in both the tui + no_tui and not(feature = "tui") branches
with a call to this new helper, ensuring the helper uses the existing
print_info, debug!, and error! calls and returns/awaits as appropriate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: cea00d67-459b-4d52-adfb-05fb078198c6

📥 Commits

Reviewing files that changed from the base of the PR and between 4ba4a87 and 575ab38.

📒 Files selected for processing (4)
  • magicblock-config/src/config/cli.rs
  • magicblock-config/src/lib.rs
  • magicblock-validator/src/main.rs
  • tools/magicblock-tui-client/README.md

Comment thread magicblock-validator/src/main.rs Outdated
Copy link
Copy Markdown
Collaborator

@GabrielePicco GabrielePicco left a comment

Choose a reason for hiding this comment

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

Thanks for the cotribution @0xzrf, LGTM!

Please address the nit: #1252 (comment) and we are good to merge

@0xzrf
Copy link
Copy Markdown
Contributor Author

0xzrf commented May 27, 2026

@GabrielePicco addressed #1252 (comment)

All ready for review 🫡

@0xzrf 0xzrf requested a review from GabrielePicco May 27, 2026 13:38
0xzrf and others added 2 commits May 27, 2026 21:06
Allow TUI-enabled builds to run headless via `--no-tui` (default: TUI on).
Closes magicblock-labs#1239.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

feat: published binary without TUI

2 participants