Skip to content

[FIX] PR #1550 CI failures — _is_unattended_context too aggressive in test env #1554

Description

@Lexus2016

Problem

PR #1550 (suppress pending_approval retries in cron/subagent contexts) has CI failures on test slices 2/8 and 8/8.

Root cause: _is_unattended_context() returns True whenever there's no interactive CLI, no gateway, and no cron session. In the CI test environment (non-interactive, non-gateway, non-cron), this evaluates to True, causing check_all_command_guards and check_execute_code_guard to return blocked instead of pending_approval. Existing tests that expect pending_approval behavior break.

Proposed Fix

Make _is_unattended_context() require a positive signal of an unattended context (HERMES_CRON_SESSION or HERMES_SUBAGENT), instead of the catch-all "nobody's home" default. This preserves the fix for actual cron/subagent sessions while not affecting tests or interactive sessions that haven't set HERMES_INTERACTIVE.

def _is_unattended_context() -> bool:
    """True when in a cron or subagent context where no human can approve."""
    if env_var_enabled("HERMES_CRON_SESSION"):
        return True
    if env_var_enabled("HERMES_SUBAGENT"):
        return True
    return False

Scope

  • ~5-line change to _is_unattended_context() in tools/approval.py
  • Update test to match new behavior
  • Fits ≤200-line cap

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedAccepted by evolution — sent to a PR / implementedbugSomething isn't workingfixBug or fixintrospectionFound by session introspection

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions