Skip to content

fix: only set HERMES_INTERACTIVE when stdin/stdout are real terminals #17575

@cxgreat2014

Description

@cxgreat2014

Problem

In containerized environments (Docker, Paperclip integrations, cron), Hermes Agent is invoked via hermes chat -q with piped stdin/stdout. The cli_main() function unconditionally sets HERMES_INTERACTIVE=1, triggering sudo password prompts and approval prompts even when no user is present. Each prompt waits 45s before timing out.

Expected Behavior

HERMES_INTERACTIVE should only be set when both stdin and stdout are real TTYs. Piped callers should never see interactive prompts.

Steps to Reproduce

  1. echo 'hello' | hermes chat -q — eventually times out after 45s
  2. Run via Paperclip adapter heartbeat — hangs on approval prompt

Proposed Fix

Gate HERMES_INTERACTIVE=1 behind sys.stdin.isatty() && sys.stdout.isatty(). Also handle PermissionError when ~/.hermes/.env is unreadable in non-root container setups.

PR: #16529

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/dockerDocker image, Compose, packagingcomp/cliCLI entry point, hermes_cli/, setup wizardtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions