Skip to content

PowerShell calls (monitors, windows, OCR) have no timeout and can hang tools indefinitely #183

Closed

Description

@TMHSDigital

Why it matters

The PowerShell helpers that enumerate monitors and windows and run OCR have no timeout. A stuck WinRT call (a locked or corrupt PNG, a hung OCR engine, a slow WMI query) makes find_text, screenshot, start_recording and anything else that resolves a target hang forever. The agent gets no error and has nothing to retry.

Evidence

Suggested approach

  • Add a shared runPowerShell(script, { timeoutMs }) helper with timeout and killSignal set. Give it a sensible default (for example 20 s for enumeration, 60 s for OCR) and an env override.
  • Replace Wait(-1) with a finite wait that throws a clear error.
  • Map a timeout to an actionable ScreencastError such as "Window enumeration timed out after 20 s".

Done when

  • No PowerShell call path can block indefinitely.
  • A unit test with a fake slow command asserts the timeout error.

Activity

  1. added
    bug
    effort: small
    impact: medium
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugeffort: smallimpact: mediumpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions