Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion bin/omarchy-agent-usage-claude
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,8 @@ def collect_limits(access_token: str, expires_at_ms: int, force: bool) -> dict[s
# A panel that is opened and shut repeatedly must not turn into a request
# per flick, so recent probe results are reused for a short window — and
# kept as the answer of record when a later probe fails.
probe_cache = cache_root() / "claude-limits.json"
digest = hashlib.sha1(str(config_dir()).encode("utf-8")).hexdigest()[:16]
probe_cache = cache_root() / f"claude-limits-{digest}.json"
cached = read_fresh_json(probe_cache, float("inf")) or {}
fallback = usable_cached_limits(cached)

Expand Down
6 changes: 4 additions & 2 deletions test/shell.d/agent-usage-claude-limits-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ spec = importlib.util.spec_from_loader(loader.name, loader)
collector = importlib.util.module_from_spec(spec)
loader.exec_module(collector)

cache = collector.cache_root() / "claude-limits.json"
digest = __import__("hashlib").sha1(str(collector.config_dir()).encode("utf-8")).hexdigest()[:16]
cache = collector.cache_root() / f"claude-limits-{digest}.json"
cached = os.environ["CACHED"]
if cached:
cache.write_text(cached, encoding="utf-8")
Expand Down Expand Up @@ -167,7 +168,8 @@ spec = importlib.util.spec_from_loader(loader.name, loader)
collector = importlib.util.module_from_spec(spec)
loader.exec_module(collector)

cache = collector.cache_root() / "claude-limits.json"
digest = __import__("hashlib").sha1(str(collector.config_dir()).encode("utf-8")).hexdigest()[:16]
cache = collector.cache_root() / f"claude-limits-{digest}.json"
cache.write_text(os.environ["CACHED"], encoding="utf-8")

probes = []
Expand Down