Skip to content

Conversation

@devyubin
Copy link
Contributor

@devyubin devyubin commented Jan 9, 2026

resolves #7884 (BA-3803)

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options
  • Update of end-to-end CLI integration tests in ai.backend.test
  • API server-client counterparts (e.g., manager API -> client SDK)
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation
  • Documentation
    • Contents in the docs directory
    • docstrings in public interfaces and type annotations

@devyubin devyubin self-assigned this Jan 9, 2026
Copilot AI review requested due to automatic review settings January 9, 2026 03:36
@github-actions github-actions bot added the size:M 30~100 LoC label Jan 9, 2026
Copy link
Contributor

Copilot AI left a 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 SetupLog widget to accept a non_interactive parameter and conditionally write to stdout
  • Updated DevSetup and PackageSetup to pass the non_interactive flag to SetupLog instances
  • 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()
Copy link

Copilot AI Jan 9, 2026

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
Comment on lines +73 to +74
except Exception:
pass
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
@devyubin devyubin changed the title feat(BA-3803): add stdout logging for --non-interactive mode feat(BA-3803): add stdout logging for --headless mode Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add stdout Logging Support for Non-Interactive Mode in TUI Installer

2 participants