-
Notifications
You must be signed in to change notification settings - Fork 693
Description
Summary
There is no way for users to clear cached browser cookies from the GUI or CLI. The Debug tab's Caches section only offers "Clear cost cache" but not "Clear cookie cache." When a browser cookie import becomes corrupt or stale (e.g., from a Firefox profile with bad session data), there is no user-facing way to reset it — the cached entry persists in Keychain and is reused indefinitely.
Problem
CodexBar auto-imports browser cookies and caches them in macOS Keychain (com.steipete.codexbar.cache, accounts like cookie.claude, cookie.codex, etc.). When this cached data becomes corrupt or the source browser profile has issues:
- Toggling the provider off/on doesn't help — the stale Keychain entry persists.
- Changing cookie source to "Off" and back to "Auto" doesn't clear the cache either — the old entry is reused.
- The only workaround is running a manual Keychain command:
This is not discoverable and requires knowing the internal Keychain service/account naming.
security delete-generic-password -s "com.steipete.codexbar.cache" -a "cookie.claude"
Real-world scenario: Claude provider shows Cached: Firefox p7cksta2.default-rel... from a corrupt Firefox profile. The probe times out after 15s, and there's no GUI path to clear this and force a fresh import.
Proposed Solution
1. Debug Tab — "Clear cookie cache" button
Add a "Clear cookie cache" button alongside the existing "Clear cost cache" in the Debug → Caches section. This would call CookieHeaderCache.clear(provider:) for all providers (or optionally allow per-provider clearing).
The internal API already exists:
CookieHeaderCache.clear(provider:)→ callsKeychainCacheStore.clear(key:)+ removes legacy entries- Each provider's cookie cache key:
KeychainCacheStore.Key.cookie(provider: .claude), etc.
Mockup (Debug → Caches section):
Caches
Clear cached cost scan results.
[🗑 Clear cost cache] [🗑 Clear cookie cache]
Cleared 3 provider cookies.
2. CLI — codexbar cache clear command
Add a cache management subcommand to the CLI:
# Clear all cookie caches
codexbar cache clear --cookies
# Clear cookie cache for a specific provider
codexbar cache clear --cookies --provider claude
# Clear cost cache (move existing functionality here too)
codexbar cache clear --cost
# Clear everything
codexbar cache clear --allThis follows the existing CLI pattern of subcommands (config validate, config dump) and would integrate with --format json and --json-only flags.
3. (Optional) Per-provider cookie indicator enhancement
On the Providers tab, where cookie source shows Cached: Firefox p7cksta2.default-rel..., consider making the cached label clickable or adding a small ✕ button to clear just that provider's cookie cache inline. This would be the most discoverable location for users who encounter this issue.
Context
CookieHeaderCache(Sources/CodexBarCore/CookieHeaderCache.swift) already hasclear(provider:)— the logic is implemented, just not exposed to users.KeychainCacheStore(Sources/CodexBarCore/KeychainCacheStore.swift) handles the Keychain CRUD. The cache service iscom.steipete.codexbar.cache.- The Debug tab view is in
Sources/CodexBar/DebugTab/— the Caches section currently only has the cost cache button. - CLI entry point is
Sources/CodexBarCLI/CLIEntry.swiftwith commands:usage,cost,config validate,config dump.
Alternatives Considered
| Alternative | Why Not Sufficient |
|---|---|
security delete-generic-password |
Requires knowing internal Keychain naming. Not discoverable. |
| Toggle cookie source Off → Auto | Doesn't clear the Keychain cache entry. Stale data persists. |
| Disable/re-enable provider | Doesn't touch cookie cache. |
| "Disable Keychain access" in Advanced | Nuclear option — disables ALL keychain access, not just cookie cache. |