Skip to content

Fix/claude permanent firefox#35

Closed
BlockedPath wants to merge 4 commits into
mainfrom
fix/claude-permanent-firefox
Closed

Fix/claude permanent firefox#35
BlockedPath wants to merge 4 commits into
mainfrom
fix/claude-permanent-firefox

Conversation

@BlockedPath

Copy link
Copy Markdown
Owner

Description

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / code cleanup
  • Other:

Testing

  • Firmware builds: pio run -e m5stack_atoms3
  • Python lint: ruff check .
  • Python tests: pytest -q
  • iOS: Xcode build succeeds
  • Tested on device (AtomS3 / iOS)

Screenshots

Checklist

  • I've read the contributing guide
  • My code follows the project style
  • I've updated documentation if needed

BlockedPath and others added 4 commits May 22, 2026 11:27
Claude Desktop is Electron+Chromium and stores claude.ai cookies in the
same encrypted SQLite format Chrome does, under the macOS Keychain entry
service="Claude Safe Storage", account="Claude Key". Because the desktop
app renews sessionKey whenever you use Claude, this source basically
never goes stale — no manual re-login needed like the Firefox path.

- New scripts/claude-plan-usage-desktop.py reads the cookie DB, decrypts
  via PBKDF2/AES-CBC, and hits the same claude.ai/api/.../usage endpoint
  as the Firefox script. Falls through to the Firefox script
  automatically when Keychain access fails or no sessionKey is present.
- LaunchAgent + install.sh now point at the desktop script as primary.
- CLAUDE.md updated to document both sources and the new triage steps
  for Keychain access issues.
- pycryptodome added to requirements.txt for the AES decrypt.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Display:
- iOS label "% remaining" -> "% used" to match claude.ai's framing
- Bar now fills as you consume; color is green<50% used, orange<80%, red>=80%
- usedPct = 100 - sessionPct/weeklyPct, computed on the iOS side, no
  protocol change so firmware/daemon contract stays the same.

Refresh cadence:
- Chrome plan scrape LaunchAgent StartInterval: 60s -> 15s
- Claude daemon CODEXMETER_POLL_INTERVAL: 30s -> 10s (env in plist)
- iOS fetchTimer: 30s -> 15s
- Worst-case lag from claude.ai change to phone display drops from
  ~2 min to ~40s.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The widget was rendering the raw sessionPct/weeklyPct payload fields,
which are "remaining %" — so when the main app showed "61% used" the
widget showed "39% left." Same data, opposite framing. User couldn't
tell at a glance that they were synced.

- New helpers usedPct(from:) and usedColor(forUsed:) convert the
  on-the-wire remaining% to displayed used%.
- AtomProgressBar now fills LEFT-to-RIGHT as the user consumes; color
  goes green -> orange (>=50% used) -> red (>=80% used).
- Atom-style widget labels switch from "X LEFT" / "WK LEFT" to
  "5H USED" / "7D USED" and show the inverted percentage.
- Accessory circular and rectangular variants display used% too.
- Bumped widget timeline reload from 15 min to 5 min so iOS gets a
  more aggressive refresh hint (the app already calls
  WidgetCenter.reloadAllTimelines on every fetch, but the timeline
  policy bounds how patient iOS is).

The protocol fields (s/w) still carry remaining%; only the widget's
display layer changed. Firmware contract is untouched.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Lets the user pick whether percentages are shown as
"X% used" (fills as you consume, matches claude.ai — default) or
"X% left" (drains as you consume, the original behavior).

- Settings screen gets a new "Display > Percentages" segmented picker.
- Stored as display_framing in sharedGroup so both the main app and
  the widget read the same value.
- Bar color stays keyed on usage pressure (red when heavily used)
  regardless of framing, so visual urgency doesn't invert.
- WidgetCenter.reloadAllTimelines() is called on toggle so the home
  screen picks up the new framing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b2b98ec69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


// Session (Today)
Text(entry.isOk ? "\(formatResetTime(mins: entry.sessionResetMins).uppercased()) LEFT" : "TODAY")
Text(entry.isOk ? "5H \(DisplayFraming.current.suffix)" : "TODAY")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep widget window labels aligned with active provider

These labels are now hard-coded to 5H/7D for every successful entry, but AtomWidgetStyleView renders both Claude and Codex payloads. When the source is Codex, the widget still shows a 5-hour/7-day framing even though Codex session usage is daily, so the timeframe context presented to users is incorrect despite valid percentages. Please keep provider-specific labels (or derive them from the payload/reset window) instead of forcing Claude-specific text.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@codex fit it

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

  • Implemented provider-specific widget window labels in UsageWidget.swift so Claude continues to show 5H/7D, while Codex now shows TODAY/WEEK, preventing incorrect timeframe framing on Codex payloads.
  • Replaced hardcoded timeframe text in AtomWidgetStyleView with the new helper functions at both session and weekly label callsites.
  • Committed the change as: Fix widget window labels by provider (commit 81a5e57).

Testing

  • cd /workspace/CodexMeter && git diff -- ios/CodexMeterApp/CodexMeterAppWidget/UsageWidget.swift
  • cd /workspace/CodexMeter && rg -n "sessionWindowLabel|weeklyWindowLabel|5H|7D|TODAY|WEEK" ios/CodexMeterApp/CodexMeterAppWidget/UsageWidget.swift
  • cd /workspace/CodexMeter && git commit -m "Fix widget window labels by provider"

View task →

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.

1 participant