Skip to content

Refresh Claude usage after the clock moves backwards - #9956

Closed
rdjperron wants to merge 4 commits into
omacom:quattrofrom
rdjperron:fix/claude-cache-backwards-clock
Closed

rdjperron wants to merge 4 commits into
omacom:quattrofrom
rdjperron:fix/claude-cache-backwards-clock

Conversation

@rdjperron

Copy link
Copy Markdown
Contributor

Fixes #9955.

After a reboot the Agents panel showed Claude at Session 0% for two hours, with the local Claude Code stats frozen as well. The automatic refreshes ran the whole time. Only --force got fresh numbers, and the panel recovered by itself once wall time caught up.

The machine boots with its clock two hours ahead (the CMOS clock holds local time, a dual-boot side effect) and systemd-timesyncd steps it back about 75 seconds in. The shell starts at 52 seconds and the agents plugin collects on start, so the first omarchy-agent-usage-claude run stamps every cache two hours into the future. Both readers then accept a negative age:

if time.time() - path.stat().st_mtime <= max_age_seconds:
if fallback and not force and time.time() - fetched_at < PROBE_MIN_INTERVAL_SECONDS:

A negative number is below every positive bound. The scan cache is fresh until its future mtime plus the TTL, and the limits throttle skips the probe until the future fetchedAtMs plus 15 seconds. #6780 closed the same hole in the Codex scan cache.

Claude needs a slightly different fix, because claude-limits.json does two jobs. It is the 15-second probe throttle, and since #6795 it is the last-known fallback that keeps still-open windows visible when the token is missing, expired, or the endpoint is unreachable. A blanket future-mtime rejection would fix the throttle and lose the fallback. So the two policies are now separate:

  • read_fresh_json requires 0 <= age <= max_age, the same guard and comment as the Codex collector. This covers the transcript, pi/omp, and opencode scan caches.
  • The limits cache is read with no age check at all (read_json). Its windows retire on their own resetsAt, as before.
  • The probe throttle applies only when 0 <= now - fetchedAt < 15 s.
  • --force is unchanged.

The RTC setup that exposed this is deliberately not part of the change. Any backwards correction hits the same comparisons.

Verification

Four new assertions, all against temp homes with urlopen stubbed:

  • append a transcript record, future-date the scan cache: the new record is counted (58,793 becomes 58,803)
  • future-date the limits cache and fetchedAtMs with a live token: one probe, the probe's numbers returned
  • same cache, endpoint unreachable: the cached window is returned and retryAdvised is set, which proves the probe ran
  • future-dated limits cache, no token: the open window is still served. This is the case an mtime-only guard would break.

On the unpatched collector the scanner suite fails at the first case and the limits suite at the unreachable case. With the patch: scanner 9/9, limits 17/17, codex 21/21. ./test/all runs all 226 files; the only three failures need the separate omarchy-pkgs checkout.

🤖 Generated with Claude Code

A cache written before an NTP step back carries a future timestamp, and
both Claude cache readers accepted the negative age as fresh: the scan
cache until its mtime plus the TTL, and the limits probe throttle until
fetchedAtMs plus 15 seconds. On a machine that boots two hours ahead the
Agents panel froze for two hours after every reboot.

Require a nonnegative age in read_fresh_json, matching the Codex
collector (omacom#6780). Read claude-limits.json with no age check, since it
is also the last-known fallback (omacom#6795) and its windows retire on their
own resetsAt. Apply the probe throttle only when the age is between zero
and the interval. --force is unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
omarchybot and others added 3 commits October 2, 2026 03:26
quattro gave collect_limits a per-account cache name. The resolution keeps that name and this branch's read_json, so the limits cache is still read with no age check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
replenished_limits arrived from quattro reading the per-account cache through read_fresh_json with an infinite age, which this branch now rejects when the file is stamped in the future. A parked account whose cache was written before the clock stepped back would then lose its reset windows and show nothing instead of 0%, so it reads the cache through read_json like collect_limits does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After a failed probe, collect_limits called the kept numbers live when their age was under fifteen minutes, and a negative age passed. A cache stamped before the clock stepped back would then be shown as just measured, without the panel's "Last known" note, so the age has to be non-negative here too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Codex Medium <[email protected]>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and verified on a disposable Omarchy worker. The bug is real: a cache stamped in the future reads as fresh, and your new assertions fail on quattro and pass on this branch.

This branch conflicted with quattro after #13770 gave collect_limits a cache per account, so I merged quattro in and pushed three commits:

  • d1c1240 merges quattro. The resolution keeps the per-account cache_name and your read_json.
  • b80d2b3 makes replenished_limits, which came in from quattro, read the per-account cache through read_json as well. Through read_fresh_json, the new guard threw away a parked account's future-dated cache, so its reset windows showed nothing instead of 0%. A new assertion in agent-usage-accounts-test.sh covers this.
  • db01243 applies the 0 <= guard to the live check after a failed probe. Without it, numbers stamped in the future were reported as just measured, so the panel left out its "Last known" note. A new assertion in agent-usage-claude-limits-test.sh covers this.

Each new assertion passes on the head and fails with its fix reverted. On the worker, every agent-usage* and agents* test under test/shell.d/ passes at db01243. ./test/cli has one failure, "vscode generated theme references current theme file". It fails the same way on quattro and has nothing to do with this change, but it keeps the suite from being green.

Codex Medium gave a second opinion over two rounds. The first round found the live gap, which is now fixed. The second round found nothing open. Its independence is not guaranteed.

Fixes #9955. Nothing is needed from you. This is waiting on the maintainer and on the unrelated ./test/cli failure on quattro.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Handles clock backwards scenarios in usage cache logic.

The PR appears safe to merge; no actionable regression was identified.

Summary

The PR separates Claude cache freshness from limits fallback retention after a backward clock correction:

  • Future-dated transcript and other scan caches are rescanned.
  • Open limits windows remain available as fallback, while a future-dated probe timestamp no longer suppresses a probe or marks failed-probe results as live.
  • Tests cover future-dated scan and limits caches, failed probes, and parked accounts.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read Claude caches] --> B{Scan cache age between 0 and TTL?}
  B -- Yes --> C[Reuse scan]
  B -- No --> D[Rescan and write cache]
  A --> E[Read limits cache regardless of mtime]
  E --> F{Window still open?}
  F -- Yes --> G[Keep as fallback]
  F -- No --> H[Discard expired window]
  G --> I{Probe age between 0 and 15 seconds?}
  I -- Yes --> J[Reuse limits]
  I -- No --> K[Probe with live token]
Loading

Reviews (1) · Last reviewed commit: "Report a future-dated fallback as stale"

@dhh

dhh commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thank you! Brought in with your authorship in #14049.

@dhh dhh closed this Oct 2, 2026
dhh added a commit that referenced this pull request Oct 3, 2026
…ommunity PRs (#14049)

* Read Codex app-server replies from the raw fd (#13703)

* Resolve Codex through mise which instead of running the lazy launcher (#13109)

* Skip the Codex app-server probe when there are no credentials (#13106)

Adapted: credentials are checked in the home being probed rather than in
the CODEX_HOME environment variable, since each registered account is
probed in its own home, so a signed-out secondary account isn't hidden
behind the primary's login. A home without credentials reports "Waiting
for auth" like any other signed-out home. The credentials store setting is
read with tomllib, so a single-quoted value counts too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Show the Codex CLI's own error when its app-server dies (#8977)

Detect an app-server that exits or stops answering, and report the end of
its stderr instead of a bare RPC method name. Rebased onto the raw-fd
reply reader; the switch from "-a on-request" to "-a never" is left out,
keeping the current approval flags.

* Count pi sessions when HOME is a git checkout (#13209)

* Count only OpenAI-backed native sessions as Codex usage (#12032)

* Deduplicate Pi usage across forked sessions (#8602)

* Skip unchanged native Codex token snapshots (#10531)

* Count omp and pi profile sessions in the agent usage collectors (#9546)

`omp --profile=<name>` (and pi's equivalent) relocates the whole agent
tree under <base>/profiles/<name>/. The Claude and Codex collectors only
ever scanned <base>/agent/sessions, so a subscription driven entirely
through a profile was invisible to the agents panel: no tokens by day, no
tokens by model, no prompt or session counts.

Discover the profile roots alongside the default one. Sessions are keyed
by file path, so a profile adds sessions instead of double-counting the
default root, and a missing or unreadable profiles directory leaves the
existing behavior untouched.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014zFbJcDEEpV5BAmsH6kAB3

* Skip unrelated Codex session lines before JSON parsing (#12803)

Adapted: session_meta lines also pass the pre-filter, since the provider
filter from #12032 reads them to skip rollouts served by a non-OpenAI
provider.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Read only the Codex session files that changed since the last scan (#12595)

Native Codex rollouts keep per-file totals between runs, replayed while a
file's mtime and size are unchanged. Rebased onto the session_meta
provider filter, snapshot dedup, and line pre-filter, which now live in
the per-file reader. pi and omp sessions are left out of the per-file
cache: a forked pi session repeats its parent's messages, so they are
deduplicated across the whole tree on every scan.

* Count streamed Claude messages by their highest-output usage line (#10606)

Claude Code writes a streamed assistant response as several transcript
lines that share one message id, one per content block. Each line
carries a usage object. The first line's output_tokens is a placeholder,
often 1, and the last line has the real count. Input and cache fields
usually match across the lines.

The scanner dedupes by message id and keeps the first line it sees, so
it under-counts output tokens. On a machine with 2,577 transcripts it
reported 39.0M output tokens against 60.1M used, a 35% shortfall. Input
and both cache fields differed by under 0.01%.

Keep the line with the highest output count, with the last one scanned
winning a tie. The whole line is kept because a response can fall back
to another model mid-stream. Those lines are separate snapshots with
different cache figures and a different model, and taking a maximum per
field across them over-counts cache tokens and credits the wrong model.

The zero-usage check now runs before dedup, so a zero-usage first line
no longer claims a message id and hides a later line with real usage.

Co-authored-by: Claude Fable 5.1 <[email protected]>
Co-authored-by: GPT-6 Astra <[email protected]>

* Index Claude transcripts so the agents refresh reads only what was appended (#8313)

omarchy-agent-usage-claude re-parsed every line of every transcript under
~/.claude/projects on each refresh: no mtime cutoff, no memory of the last
pass. The agents widget is on by default and ticks every 15 minutes, so the
cost grew for the life of the machine. After one month here that was 803
files, 640 MB, 127k lines and 57k JSON parses per tick, about 1 core-second,
pushed through the page cache every quarter hour forever.

Keep a per-file index next to the scan cache: the unique usage records
already parsed out of each transcript and the byte offset they end at. A
file whose size and mtime match is not opened; a file that grew is read
from the stored offset; a file that shrank or was rewritten is read from
the start. --force drops the index and rescans from scratch.

The summary is built from the indexed records in the same directory order
the walk always used. That matters: when a resumed session carries earlier
messages, the same message id appears in two files with different usage,
and the first file visited wins. 91 ids differed on this machine; sorting
the walk moved one model's output total by 25k tokens. Output is now
byte-identical to the previous scan on a frozen copy of the corpus, cold,
warm, and after an append.

Warm refresh: 1.0 s -> 0.10 s of CPU, of which the scan itself is 70 ms;
the index for this corpus is 2.9 MB.

Adapted:
- Rebased onto #10606: the highest-output rule for streamed messages now
  lives where the index parses records, and decides between files too.
- The index records the timezone it was written in, and a change rereads
  every transcript, since its records hold local days.
- A file only counts as appended to when its inode and the hash of what
  was already read still match, so a transcript replaced by a larger one,
  or rewritten in place, is read from the start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Label a Claude Team seat by its subscription, not its rate-limit tier (#11109)

The collector built the plan label from the OAuth rateLimitTier first, so a
Team premium seat, which runs on default_claude_max_5x, showed in the agents
panel as "Max 5x". Lead with subscriptionType and keep the multiplier as its
qualifier: Max still reads "Max 5x", a Team seat reads "Team 5x".

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* Label the Claude plan from the profile the CLI refreshes (#7225)

Adapted: the profile is found the same way current_account_id() finds it,
now shared as profile_path(): ~/.claude.json for the default home, the
home's own .claude.json otherwise. The original fell back to ~/.claude.json
for any home without CLAUDE_CONFIG_DIR set, so a secondary account read the
primary's tier. The profile's tier also keeps the subscription in the label,
so a Team seat stays "Team" (#11109).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Call a lapsed Claude access token paused, not signed out (#8093)

* Refresh Claude usage after the clock moves backwards (#9956)

* Bound unreadable Claude transcript warnings (#12414)

* Count Claude usage from opencode v2 sessions (#13894)

* Reload agent usage records when an inotify watch fails to rearm (#10067)

* Reload agent usage records after each update run instead of on a timer

Rather than #10067's two-minute timer per record, reload every record when
the omarchy-agent-usage-update process exits, the moment its files can have
been replaced. A reload that finds a file unchanged keeps its record, so the
panel isn't stirred up by identical data. The grep test now runs the QML
functions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Show the agent status when the trouble line has no help text (#8497)

* Clear stale agent login guidance after a successful probe (#8892)

* Clear the Grok login hint after a successful probe

#8892 cleared the default login hint after a successful probe in the
Claude and Codex collectors; Grok's collector had the same stale hint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Read Fireworks credentials from pi's auth.json (#7455)

The Fireworks collector skipped pi, Omarchy's default agent, when
walking its credential ladder, so a machine signed in to Fireworks only
through pi (/login fireworks) never showed the tab. Insert the key pi
stores in $PI_CODING_AGENT_DIR/auth.json (default ~/.pi/agent) between
the firectl auth.ini and the opencode fallback.

pi keys can be literals, $ENV_VAR/${ENV_VAR} references, or !command
shell lookups. The collector resolves the first two; command lookups
stay pi-only and are skipped rather than sent to the API verbatim.

* Call a lapsed Grok access token paused, not signed out

Grok's access token lives six hours and Grok mints a new one from its
refresh token whenever it starts, so a lapsed one is routine. Reporting
it as an expired sign-in made the panel offer Sign-in required several
times a day, sending people through grok login for nothing. With a
refresh token present it now reads as paused, like Claude's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep showing Grok's last limits while it sits idle

While Grok hasn't run, nothing on the machine has spent its allowance,
so with a refresh token on hand the last numbers still stand: they show
as current rather than dimmed under a status line. A weekly window that
reset in the meantime starts over at 0%, a whole number of weeks on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Ask for a Grok sign-in once its refresh token is past 30 days

A refresh token older than Grok's 30-day sign-in can't renew anything,
so the panel offers Sign-in required again instead of showing the last
limits as current. With nothing cached yet it says to start Grok, rather
than showing an empty section without a word.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Check both ends of what the Claude index read before resuming a transcript

A transcript rewritten in place could grow and change only after its
first kilobytes, and the index took it for an append. It now compares
the last kilobytes before the resume point too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Simplify the agent usage collectors

- Codex: pass the forced-scan choice down instead of a module global, make
  the per-file reader's cache arguments required, shrink the cache record
  check, and drop guards for shapes that can't occur: an empty launcher
  path, realpath raising, mise itself being a lazy launcher, multi-line
  `mise which` output, and probing without a temp file for stderr.
- Claude: decide an append by the digest of both ends of what was read
  alone; the inode and mtime checks it made redundant are gone.
- Snapshot: the device id falls back to the hostname, which always exists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Share fixture setup in the agent usage scanner tests

Every fixture home lives under one scratch directory with a single cleanup
trap, instead of a trap rewritten with a longer list for each new home, and
the Codex test builds its signed-in homes with one helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Treat a replaced Claude transcript as new even when its ends match

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Probe Codex without its error text when there's no temporary space

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: tossbaws <[email protected]>
Co-authored-by: surim0n <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: anonwurcod <[email protected]>
Co-authored-by: Kevin Rajan <[email protected]>
Co-authored-by: Nate Ashby <[email protected]>
Co-authored-by: Aris Gysel <[email protected]>
Co-authored-by: Brams <[email protected]>
Co-authored-by: This_Is_NPC <[email protected]>
Co-authored-by: sanjyay <[email protected]>
Co-authored-by: PapistProtocol <[email protected]>
Co-authored-by: steez <[email protected]>
Co-authored-by: GPT-6 Astra <[email protected]>
Co-authored-by: Ryan Yogan <[email protected]>
Co-authored-by: Oli Denton <[email protected]>
Co-authored-by: Igor Kramar <[email protected]>
Co-authored-by: Martin Eidensten <[email protected]>
Co-authored-by: Romain Perron <[email protected]>
Co-authored-by: Omarchy Contributor <[email protected]>
Co-authored-by: manuaudio <[email protected]>
Co-authored-by: Tyler South <[email protected]>
Co-authored-by: whathek <[email protected]>
Co-authored-by: Ty Richards <[email protected]>
sgruendel pushed a commit to sgruendel/omarchy that referenced this pull request Oct 3, 2026
…ommunity PRs (omacom#14049)

* Read Codex app-server replies from the raw fd (omacom#13703)

* Resolve Codex through mise which instead of running the lazy launcher (omacom#13109)

* Skip the Codex app-server probe when there are no credentials (omacom#13106)

Adapted: credentials are checked in the home being probed rather than in
the CODEX_HOME environment variable, since each registered account is
probed in its own home, so a signed-out secondary account isn't hidden
behind the primary's login. A home without credentials reports "Waiting
for auth" like any other signed-out home. The credentials store setting is
read with tomllib, so a single-quoted value counts too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Show the Codex CLI's own error when its app-server dies (omacom#8977)

Detect an app-server that exits or stops answering, and report the end of
its stderr instead of a bare RPC method name. Rebased onto the raw-fd
reply reader; the switch from "-a on-request" to "-a never" is left out,
keeping the current approval flags.

* Count pi sessions when HOME is a git checkout (omacom#13209)

* Count only OpenAI-backed native sessions as Codex usage (omacom#12032)

* Deduplicate Pi usage across forked sessions (omacom#8602)

* Skip unchanged native Codex token snapshots (omacom#10531)

* Count omp and pi profile sessions in the agent usage collectors (omacom#9546)

`omp --profile=<name>` (and pi's equivalent) relocates the whole agent
tree under <base>/profiles/<name>/. The Claude and Codex collectors only
ever scanned <base>/agent/sessions, so a subscription driven entirely
through a profile was invisible to the agents panel: no tokens by day, no
tokens by model, no prompt or session counts.

Discover the profile roots alongside the default one. Sessions are keyed
by file path, so a profile adds sessions instead of double-counting the
default root, and a missing or unreadable profiles directory leaves the
existing behavior untouched.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014zFbJcDEEpV5BAmsH6kAB3

* Skip unrelated Codex session lines before JSON parsing (omacom#12803)

Adapted: session_meta lines also pass the pre-filter, since the provider
filter from omacom#12032 reads them to skip rollouts served by a non-OpenAI
provider.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Read only the Codex session files that changed since the last scan (omacom#12595)

Native Codex rollouts keep per-file totals between runs, replayed while a
file's mtime and size are unchanged. Rebased onto the session_meta
provider filter, snapshot dedup, and line pre-filter, which now live in
the per-file reader. pi and omp sessions are left out of the per-file
cache: a forked pi session repeats its parent's messages, so they are
deduplicated across the whole tree on every scan.

* Count streamed Claude messages by their highest-output usage line (omacom#10606)

Claude Code writes a streamed assistant response as several transcript
lines that share one message id, one per content block. Each line
carries a usage object. The first line's output_tokens is a placeholder,
often 1, and the last line has the real count. Input and cache fields
usually match across the lines.

The scanner dedupes by message id and keeps the first line it sees, so
it under-counts output tokens. On a machine with 2,577 transcripts it
reported 39.0M output tokens against 60.1M used, a 35% shortfall. Input
and both cache fields differed by under 0.01%.

Keep the line with the highest output count, with the last one scanned
winning a tie. The whole line is kept because a response can fall back
to another model mid-stream. Those lines are separate snapshots with
different cache figures and a different model, and taking a maximum per
field across them over-counts cache tokens and credits the wrong model.

The zero-usage check now runs before dedup, so a zero-usage first line
no longer claims a message id and hides a later line with real usage.

Co-authored-by: Claude Fable 5.1 <[email protected]>
Co-authored-by: GPT-6 Astra <[email protected]>

* Index Claude transcripts so the agents refresh reads only what was appended (omacom#8313)

omarchy-agent-usage-claude re-parsed every line of every transcript under
~/.claude/projects on each refresh: no mtime cutoff, no memory of the last
pass. The agents widget is on by default and ticks every 15 minutes, so the
cost grew for the life of the machine. After one month here that was 803
files, 640 MB, 127k lines and 57k JSON parses per tick, about 1 core-second,
pushed through the page cache every quarter hour forever.

Keep a per-file index next to the scan cache: the unique usage records
already parsed out of each transcript and the byte offset they end at. A
file whose size and mtime match is not opened; a file that grew is read
from the stored offset; a file that shrank or was rewritten is read from
the start. --force drops the index and rescans from scratch.

The summary is built from the indexed records in the same directory order
the walk always used. That matters: when a resumed session carries earlier
messages, the same message id appears in two files with different usage,
and the first file visited wins. 91 ids differed on this machine; sorting
the walk moved one model's output total by 25k tokens. Output is now
byte-identical to the previous scan on a frozen copy of the corpus, cold,
warm, and after an append.

Warm refresh: 1.0 s -> 0.10 s of CPU, of which the scan itself is 70 ms;
the index for this corpus is 2.9 MB.

Adapted:
- Rebased onto omacom#10606: the highest-output rule for streamed messages now
  lives where the index parses records, and decides between files too.
- The index records the timezone it was written in, and a change rereads
  every transcript, since its records hold local days.
- A file only counts as appended to when its inode and the hash of what
  was already read still match, so a transcript replaced by a larger one,
  or rewritten in place, is read from the start.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Label a Claude Team seat by its subscription, not its rate-limit tier (omacom#11109)

The collector built the plan label from the OAuth rateLimitTier first, so a
Team premium seat, which runs on default_claude_max_5x, showed in the agents
panel as "Max 5x". Lead with subscriptionType and keep the multiplier as its
qualifier: Max still reads "Max 5x", a Team seat reads "Team 5x".

Co-Authored-By: Claude Fable 5.1 <[email protected]>

* Label the Claude plan from the profile the CLI refreshes (omacom#7225)

Adapted: the profile is found the same way current_account_id() finds it,
now shared as profile_path(): ~/.claude.json for the default home, the
home's own .claude.json otherwise. The original fell back to ~/.claude.json
for any home without CLAUDE_CONFIG_DIR set, so a secondary account read the
primary's tier. The profile's tier also keeps the subscription in the label,
so a Team seat stays "Team" (omacom#11109).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Call a lapsed Claude access token paused, not signed out (omacom#8093)

* Refresh Claude usage after the clock moves backwards (omacom#9956)

* Bound unreadable Claude transcript warnings (omacom#12414)

* Count Claude usage from opencode v2 sessions (omacom#13894)

* Reload agent usage records when an inotify watch fails to rearm (omacom#10067)

* Reload agent usage records after each update run instead of on a timer

Rather than omacom#10067's two-minute timer per record, reload every record when
the omarchy-agent-usage-update process exits, the moment its files can have
been replaced. A reload that finds a file unchanged keeps its record, so the
panel isn't stirred up by identical data. The grep test now runs the QML
functions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Show the agent status when the trouble line has no help text (omacom#8497)

* Clear stale agent login guidance after a successful probe (omacom#8892)

* Clear the Grok login hint after a successful probe

omacom#8892 cleared the default login hint after a successful probe in the
Claude and Codex collectors; Grok's collector had the same stale hint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Read Fireworks credentials from pi's auth.json (omacom#7455)

The Fireworks collector skipped pi, Omarchy's default agent, when
walking its credential ladder, so a machine signed in to Fireworks only
through pi (/login fireworks) never showed the tab. Insert the key pi
stores in $PI_CODING_AGENT_DIR/auth.json (default ~/.pi/agent) between
the firectl auth.ini and the opencode fallback.

pi keys can be literals, $ENV_VAR/${ENV_VAR} references, or !command
shell lookups. The collector resolves the first two; command lookups
stay pi-only and are skipped rather than sent to the API verbatim.

* Call a lapsed Grok access token paused, not signed out

Grok's access token lives six hours and Grok mints a new one from its
refresh token whenever it starts, so a lapsed one is routine. Reporting
it as an expired sign-in made the panel offer Sign-in required several
times a day, sending people through grok login for nothing. With a
refresh token present it now reads as paused, like Claude's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep showing Grok's last limits while it sits idle

While Grok hasn't run, nothing on the machine has spent its allowance,
so with a refresh token on hand the last numbers still stand: they show
as current rather than dimmed under a status line. A weekly window that
reset in the meantime starts over at 0%, a whole number of weeks on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Ask for a Grok sign-in once its refresh token is past 30 days

A refresh token older than Grok's 30-day sign-in can't renew anything,
so the panel offers Sign-in required again instead of showing the last
limits as current. With nothing cached yet it says to start Grok, rather
than showing an empty section without a word.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Check both ends of what the Claude index read before resuming a transcript

A transcript rewritten in place could grow and change only after its
first kilobytes, and the index took it for an append. It now compares
the last kilobytes before the resume point too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Simplify the agent usage collectors

- Codex: pass the forced-scan choice down instead of a module global, make
  the per-file reader's cache arguments required, shrink the cache record
  check, and drop guards for shapes that can't occur: an empty launcher
  path, realpath raising, mise itself being a lazy launcher, multi-line
  `mise which` output, and probing without a temp file for stderr.
- Claude: decide an append by the digest of both ends of what was read
  alone; the inode and mtime checks it made redundant are gone.
- Snapshot: the device id falls back to the hostname, which always exists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Share fixture setup in the agent usage scanner tests

Every fixture home lives under one scratch directory with a single cleanup
trap, instead of a trap rewritten with a longer list for each new home, and
the Codex test builds its signed-in homes with one helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Treat a replaced Claude transcript as new even when its ends match

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Probe Codex without its error text when there's no temporary space

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: tossbaws <[email protected]>
Co-authored-by: surim0n <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: anonwurcod <[email protected]>
Co-authored-by: Kevin Rajan <[email protected]>
Co-authored-by: Nate Ashby <[email protected]>
Co-authored-by: Aris Gysel <[email protected]>
Co-authored-by: Brams <[email protected]>
Co-authored-by: This_Is_NPC <[email protected]>
Co-authored-by: sanjyay <[email protected]>
Co-authored-by: PapistProtocol <[email protected]>
Co-authored-by: steez <[email protected]>
Co-authored-by: GPT-6 Astra <[email protected]>
Co-authored-by: Ryan Yogan <[email protected]>
Co-authored-by: Oli Denton <[email protected]>
Co-authored-by: Igor Kramar <[email protected]>
Co-authored-by: Martin Eidensten <[email protected]>
Co-authored-by: Romain Perron <[email protected]>
Co-authored-by: Omarchy Contributor <[email protected]>
Co-authored-by: manuaudio <[email protected]>
Co-authored-by: Tyler South <[email protected]>
Co-authored-by: whathek <[email protected]>
Co-authored-by: Ty Richards <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents panel keeps stale Claude usage for hours after the clock is set back at boot

3 participants