Skip to content

Fix flaky skill watch test: add non-recursive watchers on skill subdirectories#327448

Closed
rzhao271 with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-flaky-ahp-test
Closed

Fix flaky skill watch test: add non-recursive watchers on skill subdirectories#327448
rzhao271 with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-flaky-ahp-test

Conversation

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

In scan mode, the watch skill file changes integration test flakily times out because content-only modifications to SKILL.md (two levels deep: skillsDir/skill-name/SKILL.md) are sometimes not detected on macOS CI VMs.

Root cause

Skills were watched exclusively via a recursive @parcel/watcher on skillsDir. On macOS VMs, this recursive watcher can fail to fire for content-only changes deep in the tree. Agents don't have this problem because they use a non-recursive fs.watch/kqueue watcher on a directory whose direct children are the watched files.

Fix

In _scanRoot for DiscoveredType.Skill, add an explicit non-recursive watcher on each discovered skill subdirectory (trigger = the SKILL.md file URI):

// before: only recursive watcher on skillsDir
addWatch(watchRootUris, rootUri, root.recursive ?? false, rootUri);

// after: also add non-recursive watcher on each skill's subdirectory
addWatch(watchRootUris, child.resource, false, skillFile);

When SKILL.md is modified, e.affects(skillFile) returns true immediately — a more specific, reliable trigger that doesn't depend on @parcel/watcher's recursive event delivery. This mirrors how discover mode watches individual skill file paths.

Tests

  • Updated installs watchers for roots that contain discovered customizations to assert skill subdirectories (e.g. .github/skills/bar) are now watched non-recursively in addition to the recursive skillsDir watcher.
  • Added fires onDidChange when an existing SKILL.md file is modified to directly validate content-change detection via the new non-recursive watcher.

Copilot AI requested review from Copilot and removed request for Copilot July 25, 2026 05:50
Copilot AI linked an issue Jul 25, 2026 that may be closed by this pull request
…subdirs

In scan mode, skill files are two levels deep (skillsDir/skill-name/SKILL.md).
Only a recursive @parcel/watcher on skillsDir was used, which can fail to
deliver content-only change events on macOS CI VMs.

Add an explicit non-recursive watcher on each discovered skill subdirectory
(trigger = SKILL.md file URI) to ensure content changes are reliably detected.
This mirrors how agents and discover-mode skill files are watched.

Update the existing watcher installation test and add a new test for SKILL.md
content change detection.

Co-authored-by: rzhao271 <7199958+rzhao271@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 25, 2026 06:29
Copilot AI changed the title [WIP] Fix flaky AHP integration test Fix flaky skill watch test: add non-recursive watchers on skill subdirectories Jul 25, 2026
Copilot AI requested a review from rzhao271 July 25, 2026 06:29
@rzhao271

Copy link
Copy Markdown
Collaborator

Closing in favour of Rob's PR from earlier today.

@rzhao271 rzhao271 closed this Jul 25, 2026
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.

Flaky AHP integration test

2 participants