Repository navigation
Conversation
SkillWatcher cleared its wake flag before waiting out the debounce, so a notification arriving inside the window scheduled a second reconcile right after the first. A burst spread across one window ran two reconciles instead of one. The debounce now trails: after each window the watcher checks whether another change arrived and, if so, waits a fresh window. It reconciles only once delivery has been quiet for a whole window. The flag is still cleared before each window, so a change landing during the reconcile itself schedules one more pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
SkillWatchercleared its wake flag before waiting out the debounce. A notification that arrived inside the window set the flag again, so a second reconcile followed right after the first: a burst of changes spread across one window ran two reconciles, not one. The TypeScript watcher restarts its timer on every notification and runs one.The debounce now trails. After each window the watcher checks whether another change arrived and, if one did, waits a fresh window. It reconciles only after delivery has been quiet for a whole window. The reconcile reads the store after that last window, so it sees every change in the burst. Nothing is lost.
The flag is still cleared before each window, not after the reconcile. A change that lands while a reconcile is running still schedules exactly one more pass.
Behavior change
A steady stream of notifications closer together than
debouncenow postpones the reconcile until the stream pauses. Before, the watcher reconciled about once per window throughout the stream. A revocation now takes effectdebounceseconds after delivery goes quiet, not withindebounceof its arrival. The README, the module docstring and thedebounceargument docs say so now.Tests
test_a_burst_of_changes_coalesces_into_a_debounce_windownow pins one reconcile for six notifications spread 100 ms apart across a 600 ms window, where it pinned two. It keeps the anti-vacuity setup: the puts come after the listener is attached and are spread out, and the count is an equality check after settling past two windows. It also checks that the single reconcile wrote all six skills.test_a_change_during_a_reconcile_schedules_one_more. A store double delivers a new skill just after an armed reconcile has taken its snapshot. The test asserts exactly two reconciles and checks that the late skill reached disk.make lint format-check typecheckanduv run pytest packages/client testspass: 1924 passed, 18 skipped.Follow-up for #211
#211 (
SkillSource/config_skills) has not merged. Itstest_the_debounce_spans_both_trigger_kindsintests/test_skills_source.pypins the old behavior:reconciles == 2andsource.reads == 1 + 2. Once this lands, that test needs the same edit:reconciles == 1,source.reads == 1 + 1, and the docstring reworded to drop "schedules exactly one further pass".🤖 Generated with Claude Code
Note
Overview
SkillWatcherdebounce is now trailing: each delivery notification restarts the quiet window, and reconcile runs only afterdebounceseconds with no further changes. Bursts that used to trigger about one reconcile per window (e.g. six spaced puts → two passes) collapse to one pass that reads the store after the last window.The worker loop clears the wake flag before each wait (unchanged intent): a change during an in-flight reconcile still schedules exactly one follow-up reconcile. Docs in
README,skills_watch, andwatch_skillsnow describe “quiet fordebounce” instead of “withindebounceof arrival,” including revocation timing.Tests expect one reconcile for the spread burst, assert all six skills on disk, and add
test_a_change_during_a_reconcile_schedules_one_morefor the mid-reconcile case.Reviewed by Cursor Bugbot for commit 224f1ab. Bugbot is set up for automated code reviews on this repo. Configure here.