Skip to content

Explain an expired Claude sign-in instead of hiding the limits - #6795

Merged
dhh merged 1 commit into
quattrofrom
agent-limits-expired-signin
Aug 13, 2026
Merged

dhh merged 1 commit into
quattrofrom
agent-limits-expired-signin

Conversation

@dhh

@dhh dhh commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

The agents panel showed no limits for Claude, and no error either.

Only the Claude Code CLI can refresh the OAuth token it saves in
.credentials.json; omarchy-agent-usage-claude only reads it. Leave a
machine alone long enough and the saved token lapses, and that branch
returned an empty limits list with usageStatusText unset — so the panel's
limits section (visible: root.limits.length > 0) disappeared with nothing
to explain it.

Now it says so, and keeps showing the numbers it already has:

  • The expired branch sets a status and help text, which the panel renders in
    the hero line and the urgent box it already uses for every other failure.
  • The probe-cache read moved above the credential checks, so an expired or
    missing token falls back to the last known limits instead of throwing away
    what is on disk.
  • Cached windows survive only until they reset. A percentage from a rolled-over
    window describes a period that is over, so an expiry during a week away would
    otherwise pin a stale 78% on an allowance that is now untouched. Entries
    with no reset time, or an unparseable one, are kept. The probe-failure path
    gets the same filtering for the same reason.

Verification

Eight new cases drive collect_limits over a planted cache with the network
stubbed unreachable, so only the credential state decides the answer. Full
suite passes (166 files).

Checked in the running shell by planting the real expired-branch output into
the usage record while the panel was open: the hero reads SIGN-IN EXPIRED in
place of MAX 20X, the help box wraps without clipping, and the cached limit
rows still render with their countdowns.

🤖 Generated with Claude Code

Only the Claude Code CLI can refresh the OAuth token it saves; the
collector just reads it. A machine left alone long enough finds the
token lapsed, and that branch returned an empty limits list with no
status text at all, so the panel hid its whole limits section and
explained nothing.

Say what is wrong, and fall back to the cached limits already on disk
rather than discarding them. Cached windows are kept only until they
reset: a percentage from a window that has rolled over describes a
period that is over, and pinning a stale 78% on an allowance that is
now untouched would be worse than showing nothing. The probe-failure
path gets the same filtering for the same reason.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI balanced review requested due to automatic review settings August 13, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves Claude usage reporting when OAuth credentials expire while preserving valid cached limits.

Changes:

  • Reports expired sign-ins with actionable authentication guidance.
  • Filters cached limits whose reset windows have elapsed.
  • Adds coverage for expired, missing, and unreachable credential states.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
bin/omarchy-agent-usage-claude Adds expiry messaging and valid-cache fallback behavior.
test/shell.d/agent-usage-claude-limits-test.sh Tests credential states and cache-window filtering.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dhh
dhh merged commit c8fb5be into quattro Aug 13, 2026
4 checks passed
@dhh
dhh deleted the agent-limits-expired-signin branch August 13, 2026 09:13
nick1udwig pushed a commit to nick1udwig/omarchy that referenced this pull request Sep 9, 2026
…m#6795)

Only the Claude Code CLI can refresh the OAuth token it saves; the
collector just reads it. A machine left alone long enough finds the
token lapsed, and that branch returned an empty limits list with no
status text at all, so the panel hid its whole limits section and
explained nothing.

Say what is wrong, and fall back to the cached limits already on disk
rather than discarding them. Cached windows are kept only until they
reset: a percentage from a window that has rolled over describes a
period that is over, and pinning a stale 78% on an allowance that is
now untouched would be worse than showing nothing. The probe-failure
path gets the same filtering for the same reason.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants