Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/agent/test_skill_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,17 @@ def test_skill_config_raw_cache_invalidates_on_config_edit(tmp_path, monkeypatch
assert get_disabled_skill_names() == {"old-skill"}

config_path.write_text("skills:\n disabled: [new-skill]\n", encoding="utf-8")
# Force an mtime the cache is guaranteed to read as newer. The cache keys
# on (path, st_mtime_ns, st_size); both configs are the same byte length,
# so mtime is the only field that can invalidate the entry. `os.utime(...,
# None)` stamps the current time, which on filesystems with coarse (1s)
# mtime granularity can equal the first write's mtime when both writes land
# in the same second — leaving the stale entry cached and flaking the
# assertion. Bump a full second past the current value instead, which
# survives second-granularity truncation.
import os
os.utime(config_path, None)
bumped_ns = config_path.stat().st_mtime_ns + 1_000_000_000
os.utime(config_path, ns=(bumped_ns, bumped_ns))

assert get_disabled_skill_names() == {"new-skill"}

Expand Down