Monitor: auto-mute superseded watchers when a new Monitor targets the same file/pattern

Resolved 💬 3 comments Opened Apr 21, 2026 by jmoran-dev Closed Apr 24, 2026

When Monitor is re-armed on the same log file (e.g. because the CI gate restarted in a new artifacts directory), the old Monitor task keeps firing "stream ended" / "timed out" notifications long after it's been superseded. These pollute the conversation with events from watchers the agent isn't tracking anymore.

Repro

  1. Arm Monitor on tasks/logA.out.
  2. Kill and restart the underlying script so its output goes to tasks/logB.out.
  3. Arm a second Monitor on logB.out.

Both Monitors emit events; the first fires [Monitor timed out — re-arm if needed.] after its timeout even though it's irrelevant to what the agent is currently tracking.

Observed over one ~4-hour session

Three superseded Monitors timed out and pinged the conversation after newer Monitors had replaced them on different files.

Proposed

Any of:

  • Automatically stop a Monitor when a newer Monitor is armed with an overlapping description or the same underlying output file.
  • Let the agent supersede old monitors via a flag on the new call (e.g. supersede=true).
  • Add a first-class Monitor.stop tool parity with TaskStop.

Environment

  • Claude Code (CLI) running inside VS Code extension
  • Opus 4.7 (1M context)
  • Windows 11 + Git Bash

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗