Skip to content

fix: alert again when a change watch returns to a seen page - #147

Merged
jerelvelarde merged 2 commits into
CopilotKit:mainfrom
Mrdifferent2022:fix/monitor-change-realert
Oct 6, 2026
Merged

jerelvelarde merged 2 commits into
CopilotKit:mainfrom
Mrdifferent2022:fix/monitor-change-realert

Conversation

@Mrdifferent2022

Copy link
Copy Markdown
Contributor

Problem

A watch with condition change keys its dedup notice on the page content hash alone. When a page oscillates A→B→A, the return to A produces a notice key that already exists, so insertIfAbsent silently swallows the alert and the user is never told the page changed back.

Commit 96c2525 fixed exactly this clears-and-reappears case for contains/price_below by committing an alertSequence with the outcome; the change branch was left content-hash-keyed.

Fix

  • Increment alertSequence for every notification-worthy observation, including change.
  • Key the notice on sequence:hash for all conditions, so a change back to previously seen content is a new alert while outcome-replay retries still deduplicate on the same committed key.

Verification

  • New regression scenario in tests/monitor-recovery.test.ts: change with pages A→B→A→B alerts exactly 3 times; unchanged repeats stay quiet.
  • Updated the count in tests/agent-api.test.ts (a change back to a seen page now alerts; identical consecutive checks still deduplicate).
  • Full suite passes locally. Untested paths: none, sample-mode engine behavior is fully covered by existing fixtures.

Co-authored-by: Claude noreply@anthropic.com

Mrdifferent2022 and others added 2 commits October 6, 2026 13:28
A change-condition watch keyed its dedup notice on the page content
hash alone, so a page that changed A→B→A never alerted on the return
to A. The alertSequence mechanism already added for contains/price
conditions in 96c2525 now covers change too: every notification-worthy
observation bumps the committed sequence and keys the notice on
sequence+hash, so publication replays still deduplicate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@jerelvelarde jerelvelarde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Value: change watches alert again for A→B→A while outcome replay still deduplicates against a persisted sequence. Twenty-nine monitor-recovery/agent API tests passed. Template: problem, behavior, checks and sample-path limits are stated. Updated-main diff reviewed; no actionable security/correctness findings. Merge after required CI.

@jerelvelarde
jerelvelarde merged commit bba4780 into CopilotKit:main Oct 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants