-
Notifications
You must be signed in to change notification settings - Fork 165
feat(BA-3803): add stdout logging for --headless mode #7885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds stdout logging support for the installer's --non-interactive mode. When non-interactive mode is enabled, log messages are written to stdout in addition to the textual UI widget, allowing for better visibility in automated/scripted installations.
Key changes:
- Modified
SetupLogwidget to accept anon_interactiveparameter and conditionally write to stdout - Updated
DevSetupandPackageSetupto pass thenon_interactiveflag toSetupLoginstances - Added Rich Console integration for formatted stdout output
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/ai/backend/install/widgets.py | Added non_interactive parameter to SetupLog, implemented stdout logging via Rich Console when enabled, overrode write() method to duplicate logs to stdout |
| src/ai/backend/install/app.py | Updated DevSetup and PackageSetup to pass non_interactive flag to SetupLog instances |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self._stdout_console.print(content) | ||
| elif isinstance(content, Exception): | ||
| self._stdout_console.print(f"[red]Error: {content}[/red]") | ||
| self._stdout_console.print_exception() |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When handling Exception objects, print_exception() is called without arguments, which prints the currently active exception from sys.exc_info(). However, the Exception object passed to this method may not be the currently active exception. Consider passing the exception object explicitly to print_exception() or using print() with the exception object directly, which would be more consistent with the error message on line 69.
| self._stdout_console.print_exception() | |
| tb = getattr(content, "__traceback__", None) | |
| if tb is not None: | |
| self._stdout_console.print(Traceback.from_exception(type(content), content, tb)) | |
| else: | |
| # Fallback to the current exception if no traceback is attached | |
| self._stdout_console.print_exception() |
| except Exception: | ||
| pass |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bare except clause silently suppresses all exceptions that might occur during stdout writing. While this might be intentional to prevent the logging from crashing the application, it makes debugging difficult when stdout logging fails. Consider at least logging the exception to stderr or using a more specific exception type, or add a comment explaining why exceptions must be suppressed here.
resolves #7884 (BA-3803)
Checklist: (if applicable)
ai.backend.testdocsdirectory