Skip to content

Conversation

@jeff-hykin
Copy link
Member

Small change to make non-interactive builds (CI, docker, etc) behave nicely

@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greptile Overview

Greptile Summary

Added non-interactive environment detection using sys.stdin.isatty() in the configure_system function to automatically approve system configuration changes when running in CI, Docker, or other non-interactive contexts.

Key Changes:

  • Imported sys module
  • Added sys.stdin.isatty() check before prompting user for approval
  • Auto-approves with "y" when stdin is not a TTY (non-interactive)
  • Preserves existing interactive behavior with try/except for EOFError and KeyboardInterrupt

Impact:
This change ensures smooth automated builds and deployments without hanging on user input prompts, while maintaining the existing safety mechanism for interactive sessions.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is minimal, well-scoped, and follows a standard pattern for handling non-interactive environments. The sys.stdin.isatty() check is a reliable method used across many Python projects. The existing CI environment check (line 96) already provides an early exit, so this adds an additional layer for other non-interactive scenarios like Docker builds. The logic preserves all existing behavior for interactive sessions.
  • No files require special attention

Important Files Changed

Filename Overview
dimos/protocol/service/system_configurator.py Added sys.stdin.isatty() check to auto-approve system configuration changes in non-interactive environments (CI, Docker, etc.)

Sequence Diagram

sequenceDiagram
    participant User
    participant configure_system
    participant stdin
    participant SystemConfigurator
    
    User->>configure_system: configure_system(checks)
    configure_system->>configure_system: Check if CI environment
    alt CI environment
        configure_system->>User: Skip configuration
    else Not CI
        configure_system->>SystemConfigurator: Run checks
        SystemConfigurator-->>configure_system: failing checks list
        alt No failing checks
            configure_system->>User: Return (no action needed)
        else Has failing checks
            configure_system->>User: Print explanations
            alt check_only mode
                configure_system->>User: Return (no fixes applied)
            else Normal mode
                configure_system->>stdin: isatty()
                alt Non-interactive (not a TTY)
                    stdin-->>configure_system: False
                    configure_system->>configure_system: answer = "y"
                else Interactive (is a TTY)
                    stdin-->>configure_system: True
                    configure_system->>User: Prompt for approval
                    User-->>configure_system: User input (y/n)
                end
                alt User approved (y/yes)
                    loop For each failing check
                        configure_system->>SystemConfigurator: fix()
                    end
                    configure_system->>User: Configuration completed
                else User declined
                    alt Critical check failed
                        configure_system->>User: Exit with error
                    else No critical checks
                        configure_system->>User: Return (no action)
                    end
                end
            end
        end
    end
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@jeff-hykin
Copy link
Member Author

Looks like I need to fix the LCM tests

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.

2 participants