Skip to content

wait_for_change and screen_diff: ignore regions, so a clock or spinner does not defeat them #400

Backlog

Description

@TMHSDigital

Summary

Reuse idleOptionFields.ignoreRegions (same rect shape, same max) on wait_for_change and screen_diff, in target/image pixels.

Where

  • src/tools/waitForChange.ts:31-81
  • src/tools/screenDiff.ts:23-33
  • src/utils/diff.ts:97-135
  • src/utils/idle.ts:39-57

Problem

wait_for_change's inputs are target, exactTitle, mode change|settle|text, text/regex/gone, backend, alwaysOnTop, timeoutSec, settleSec, intervalMs, pixelThreshold, returnImage, keep; screen_diff's are a, b, pixelThreshold, returnImage. diffFrames (diff.ts:111) compares every 8x8 cell with no mask. cut_idle already solved the same problem: ignoreRegions: idleOptionFields.ignoreRegions.describe("Rectangles (a clock) left out of the freeze check.") (idle.ts:44), masked with drawbox at idle.ts:57.

Who benefits

mode: "settle" never settles and mode: "change" returns immediately on a target with a taskbar clock, a blinking caret, a progress spinner, or a live log pane, so agents fall back to fixed sleeps, which the server instructions tell them not to do. screen_diff reports the clock as a changed region in every before/after check, adding noise to UI verification.

Proposal

Reuse idleOptionFields.ignoreRegions (same rect shape, same max) on wait_for_change and screen_diff, in target/image pixels. Zero those rectangles in both bitmaps before diffFrames (or add an ignore: Rect[] to DiffOptions that skips cells overlapping them), scaled through the existing analysis-size factor. For text mode, drop OCR matches inside ignored rects.

Getting started

  • Relevant files: src/tools/waitForChange.ts, src/tools/screenDiff.ts, src/utils/diff.ts, src/utils/idle.ts
  • Run tests: npm test (also npm run typecheck and npm run lint); see CONTRIBUTING.md
  • If you change a tool's schema or description, run npm run docs

Filed by repo-audit/full-audit at f0e5ebd. Severity: medium. Effort: M. audit-key: enhancement|src/tools/waitForChange.ts|ignoreRegions

Activity

  1. added
    enhancement
    help wanted
    effort: medium
    on Nov 29, 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

    effort: mediumenhancementhelp wantedpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions