Skip to content

v0.4.2 — desktop app cookies, a status line that tells the truth

Choose a tag to compare

@davorinpavlica davorinpavlica released this 02 Aug 11:39
3bdd103

The status line was lying, and now it isn't

  • statusline.sh only ever read an OAuth token from ~/.claude/.credentials.json or the Claude Code-credentials Keychain item. If you sign in through the Claude desktop app rather than the CLI, that token does not exist anywhere, so every refresh failed silently and the gauge served whatever was last cached. On the author's machine that was a file frozen since 24 May, showing a believable, permanent 0%.
  • When no usable token is found, the status line now falls back to the session cookie through fetch-usage.sh and gets the same figures from the same usage endpoint. The cache records which path it used, "api" or "cookie".
  • A failed refresh can no longer damage a good cache.

The Claude desktop app is now a cookie source

  • New claude-app-cookie.py reads sessionKey, cf_clearance and lastActiveOrg from the desktop app's own cookie store, decrypting them with the Claude Safe Storage Keychain item. One-time approval of the macOS prompt is required, exactly like the Chrome path.
  • It is tried before Firefox and Chrome. It is the one client you are certainly signed into, and it refreshes its own session, whereas the browser paths quietly depend on claude.ai still being open and logged in somewhere. If it is unavailable, the chain falls through to the browsers unchanged.
  • This fixes the queue and the status line from the same place.

Window times stop flickering between two minutes

  • The reported resets_at jitters about a second either side of the true boundary, and crosses it in both directions. One reset of 12:10:00Z came back as 12:09:59.019, 12:09:59.512, 12:10:00.190 and 12:10:00.422 on consecutive reads, from the meter and the API alike.
  • .next_reset only stores HH:MM, and every conversion truncated, so the displayed hour flipped between 14:09 and 14:10 at random. Real resets land on whole minutes, so the value is now snapped to the nearest minute at both places an epoch enters the system.
  • v0.4.1 fixed a real but different rounding bug in the /usage text fallback. It was not the cause of the flicker anyone actually saw; this is.

Notes

  • 264 tests, up from 240. New: 21 for jitter and the desktop-app cookie source, plus a new tests/test-statusline.sh suite.
  • install.sh links the new helper. Nothing on disk changes format, and existing queued tasks keep working.

🤖 Generated with Claude Code