Skip to content

Conversation

@bcharleson
Copy link
Contributor

@bcharleson bcharleson commented Jan 2, 2026

Summary

Adds Augment Code as a fully-featured provider in CodexBar with comprehensive credit tracking, plan information, and billing cycle management.

Features

Core Integration

  • Credits API: Real-time credit usage tracking from /api/credits endpoint
  • Subscription API: Plan metadata and billing cycle from /api/subscription endpoint
  • Cookie-based Auth: Automatic session import from Chrome/Safari/Arc browsers
  • Session Persistence: Cookies saved to disk for reliability across app restarts
  • Graceful Fallbacks: Subscription API is optional - credits display works even if it fails

Menu Bar Display

  • Plan Name: Shows plan type (e.g., "Max") in top-right corner of menu header
  • Credits Progress: Visual bar showing percentage remaining (e.g., "4% left")
  • Billing Cycle Reset: Countdown to next reset (e.g., "Resets in 4d 4h")
  • Usage Details: Remaining credits, used credits, and total limit

Developer Experience

  • Debug Logging: Comprehensive logging for troubleshooting cookie/API issues
  • CLI Support: codexbar usage --provider augment with --augment-debug flag
  • Error Handling: Clear error messages for auth failures, API errors, etc.
  • Browser Cookie Refresh: Manual refresh button in Settings > Debug > Augment

Implementation Details

Architecture

  • Follows existing CodexBar provider pattern (Claude, Codex, etc.)
  • Official Augment branding optimized for menu bar display
  • Actor-based cookie storage with disk persistence
  • Codable structs for Credits and Subscription API responses

Cookie Import

  • Browser Support: Chrome, Chrome Beta, Safari, Arc (in priority order)
  • Cookie Names: session, _session, web_rpc_proxy_session, auth tokens
  • Domain Matching: RFC 6265-compliant cookie filtering for API requests
  • Fallback Storage: Saves cookies to ~/Library/Application Support/CodexBar/augment-session.json

API Integration

  • Credits Endpoint: https://app.augmentcode.com/api/credits
    • Returns: remaining, consumed, available, balance status
  • Subscription Endpoint: https://app.augmentcode.com/api/subscription
    • Returns: plan name, billing period end, monthly cost, features, etc.
  • Error Handling: Graceful degradation if subscription API unavailable

Testing

Manual Testing

  • ✅ Plan name displays correctly ("Max")
  • ✅ Billing cycle reset countdown accurate ("Resets in 4d 4h")
  • ✅ Credits progress bar shows correct percentage
  • ✅ Cookie import from Chrome Beta successful
  • ✅ Session persistence across app restarts
  • ✅ Subscription API failure doesn't break credits display
  • ✅ Debug output shows combined API responses
  • ✅ CLI --augment-debug flag works

Build & Code Quality

  • ✅ Builds successfully (Swift 6, macOS 15+)
  • ✅ SwiftFormat compliant
  • ✅ SwiftLint clean
  • ✅ No compiler warnings
  • ✅ Follows existing code patterns

Files Changed

New Files

  • Sources/CodexBarCore/Providers/Augment/AugmentProCodexBarCore/Providers/Augment/AugmentStatusProbe.swift
  • Sources/CodexBarCore/Providers/Augment/AugmentIcon.swift

Modified Files

  • Sources/CodexBarCore/ProviderRegistry.swift - Register Augment provider
  • Sources/CodexBar/PreferencesDebugPane.swift - Add Augment debug section
  • Sources/CodexBarCLI/CLIEntry.swift - Add --augment-debug flag

Compatibility

  • No breaking changes to existing providers
  • Backward compatible with existing CodexBar settings
  • Optional feature - Augment can be disabled in preferences
  • No new dependencies (uses existing SweetCookieKit)

License

MIT License - maintains compatibility with CodexBar

Cursor API returns bonus credits in breakdown.total field, which
includes both the base plan limit and any bonus credits awarded.

Previously, the code only used the 'limit' field, causing incorrect
usage percentages for users with bonus credits. For example, a user
with 00 base + 6.88 bonus would show 100% used when they still
had 6.88 remaining.

Changes:
- Use breakdown.total when available (includes bonus credits)
- Fall back to limit if breakdown is not present
- Add rawJSON capture for debugging
- Add Cursor to debug pane for easier troubleshooting
- Add fetchWithManualCookies method for testing

Fixes usage calculation for Cursor Ultra and other plans with bonus credits.
- Implement AugmentProvider with credits API integration
- Add official Augment logo icon (simplified for menu bar)
- Support keychain-based API key storage
- Add usage tracking and credit monitoring
- Include provider in registry and settings
- Add comprehensive error handling and logging
Copy link

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

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.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…ests

- Add debugRawProbe() method to AugmentStatusProbe for detailed probe diagnostics
- Implement ring buffer to maintain 5 most recent debug dumps
- Add latestDumps() method to retrieve captured probe failures
- Integrate debug logging into UsageStore with 15-second timeout
- Add comprehensive test suite (AugmentStatusProbeTests) with 6 passing tests
- Fix CursorStatusProbeTests compilation errors (missing rawJSON parameter)

Debug output includes:
- Timestamp and cookie import logs
- Probe success/failure status
- Credits balance, consumed, monthly limit, plan name, account status
- Raw API response JSON for troubleshooting

Follows existing debug logging patterns from Claude and Cursor providers.
Add .augment to expected provider order list in providerOrder_persistsAndAppendsNewProviders test.
Previously only error paths were captured in the debug ring buffer.
Now both success and error paths record to ensure latestDumps() shows
complete debugging history for troubleshooting.
Initialize augmentCookieSourceRaw from UserDefaults in init, matching
the pattern used by other providers. Without this, the cookie source
always falls back to .auto after relaunch, causing users who select
.manual or .off to lose their preference.

Addresses Codex bot review feedback on PR steipete#120.
bcharleson added a commit to bcharleson/codexbar that referenced this pull request Jan 2, 2026
Initialize augmentCookieSourceRaw from UserDefaults in init, matching
the pattern used by other providers. Without this, the cookie source
always falls back to .auto after relaunch, causing users who select
.manual or .off to lose their preference.

Addresses Codex bot review feedback on PR steipete#120.
…ogging

- Add Auth0 session cookies (auth0, auth0.is.authenticated, a0.spajs.txs)
- Expand cookie domains to include login.augmentcode.com and .augmentcode.com
- Add detailed debug logging with emoji indicators (✓, ✗, ⚠️)
- Implement fallback to use any augmentcode.com cookies if known session cookies not found
- Improve error messages for better troubleshooting
…ry pattern

- Remove early return for non-session cookies
- Now continues searching other browsers if session cookies not found
- Matches Cursor/Factory behavior: only returns when valid session cookies present
- Prevents false positives from random augmentcode.com cookies
- Add NextAuth and AuthJS cookie variants for broader compatibility
- Add comprehensive comment noting list may not be exhaustive
- Improve logging to help discover missing cookie names
- Log specific matched cookies when found
- Warn users when cookies exist but don't match known session cookies
- Request users report unrecognized cookies to improve detection

This addresses potential authentication failures if Augment uses
non-standard cookie names not in our current list.
- Remove CodexBar 2.app and CodexBar_Dev.app from git (should never be committed)
- Improve .gitignore to catch all app bundle variations (CodexBar_*.app/)
- Add development setup documentation (docs/DEVELOPMENT_SETUP.md)
- Add script to create stable dev signing certificate (Scripts/setup_dev_signing.sh)

This prevents build artifacts from polluting the repository and provides
guidance for reducing keychain permission prompts during development.
- Fix provider icons not showing by including Resources as SwiftPM bundle
- Update ProviderBrandIcon to load icons from CodexBar_CodexBar.bundle
- Add session expiration detection (HTTP 401) for Augment provider
- Add 'Refresh Cookies' button when session expires
- Update Package.swift to process Resources instead of excluding them
- Implement automatic retry logic when session expires (HTTP 401)
- Detect session expiration and automatically re-import fresh cookies from browser
- Add comprehensive logging for debugging cookie import and API requests
- Update error handling to show 'Log in to Augment' for both session expiration and missing cookies
- Preserve manual cookie mode (no auto-refresh when using manual override)

This eliminates the need for manual 'Refresh Cookies' button - the system now automatically recovers from expired sessions when browser cookies are still valid.
@bcharleson
Copy link
Contributor Author

🔄 Automatic Cookie Refresh Implementation

This commit adds automatic cookie refresh functionality for the Augment provider, eliminating the need for manual intervention when sessions expire.

Changes Made

1. Automatic Retry Logic ()

  • Added .sessionExpired error case to detect HTTP 401 responses
  • Implemented automatic retry mechanism in fetch() method:
    • Detects session expiration (HTTP 401)
    • Automatically re-imports fresh cookies from browser
    • Retries the API request once with fresh cookies
    • Provides detailed logging at each step

2. Enhanced Error Handling ()

  • Updated to show "Log in to Augment" button for both:
    • Session expiration errors
    • Missing cookie errors
  • Unified user experience since auto-refresh has already been attempted

How It Works

  1. Initial Request: Imports cookies from browser and makes API request
  2. Session Expired (HTTP 401): Aomatically re-imports fresh cookies
  3. Retry: Makes one retry attempt with fresh cookies
  4. Success: Returns usage data seamlessly
  5. Failure: Shows "Log in to Augment" button if browser session is also expired

Benefits

  • Self-healing: Automatically recovers from expired sessions
  • No manual intervention: Users don't need to click "Refresh Cookies"
  • Comprehensive logging: Detailed debug output for troubleshooting
  • Preserves manual mode: No auto-refresh when using manual cookie override
  • Better UX: Seamless experience when browser cookies are still valid

This implementation follows the same pattern as modern authentication systems that automatically refresh tokens when they expire.

Fixes packaging failure when Developer ID certificate is unavailable.
Without this, the script would exit before copying resource bundles,
causing provider icons to not display.
## Keychain Permission Prompts Fix

### Problem
Development rebuilds changed code signature, causing 9+ keychain prompts
(once per credential: Claude, Codex, MiniMax, Copilot, Zai cookies/tokens).

### Solution
- Changed keychain accessibility from kSecAttrAccessibleAfterFirstUnlock
  to kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
- Created one-time migration (KeychainMigration.swift) to convert existing items
- First launch after update: 4-5 prompts (migration)
- Subsequent rebuilds: Zero prompts!

### Files Changed
- CookieHeaderStore.swift - Updated accessibility
- MiniMaxCookieStore.swift - Updated accessibility
- ZaiTokenStore.swift - Updated accessibility
- CopilotTokenStore.swift - Updated accessibility
- KeychainMigration.swift - New migration logic
- CodexBarApp.swift - Added migration call on startup

## Augment Cookie Detection Improvements

### Enhanced Cookie Discovery
- Added 'session' and 'web_rpc_proxy_session' to known cookie names
- Improved logging with cookie expiration details
- Fallback: attempt to use unrecognized cookies (auto-refresh handles expiration)
- Better debugging output for cookie troubleshooting

### Files Changed
- AugmentStatusProbe.swift - Enhanced cookie detection and logging

## Development Workflow Improvements

### New Scripts
- Scripts/launch.sh - Simple launch script (no rebuild)

### Documentation
- docs/DEVELOPMENT.md - Comprehensive development guide
- docs/KEYCHAIN_FIX.md - Detailed keychain fix explanation
- AUGMENT_COOKIE_FIX.md - Augment cookie troubleshooting guide
- README.md - Added development section

## Testing
- Verified zero keychain prompts on subsequent rebuilds
- Confirmed migration runs once and sets UserDefaults flag
- Tested Augment cookie auto-refresh with Chrome/Arc
- Validated app launches successfully after changes
@bcharleson
Copy link
Contributor Author

🔧 Keychain Prompts Fix + Development Improvements

This update addresses keychain permission prompts during development and adds comprehensive documentation.

🎯 Keychain Permission Prompts Fix

Problem: Development rebuilds changed code signature, causing 9+ keychain prompts (once per credential: Claude, Codex, MiniMax, Copilot, Zai cookies/tokens).

Solution:

  • Changed keychain accessibility from kSecAttrAccessibleAfterFirstUnlock to kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
  • Created one-time migration (KeychainMigration.swift) to convert existing items
  • First launch after update: 4-5 prompts (one-time migration)
  • Subsequent rebuilds: Zero prompts! 🎉

Files Changed:

  • CookieHeaderStore.swift - Updated accessibility
  • MiniMaxCookieStore.swift - Updated accessibility
  • ZaiTokenStore.swift - Updated accessibility
  • CopilotTokenStore.swift - Updated accessibility
  • KeychainMigrswift - New migration logic
  • CodexBarApp.swift - Added migration call on startup

🍪 Augment Cookie Detection Improvements

Enhanced Cookie Discovery:

  • Added session and web_rpc_proxy_session to known cookie names
  • Improved logging with cookie expiration details
  • Fallback: attempt to use unrecognized cookies (auto-refresh handles expiration)
  • Better debugging output for cookie troubleshooting

Files Changed:

  • AugmentStatusProbe.swift - Enhanced cookie detection and logging

🛠️ Development Workflow Improvements

New Scripts:

  • Scripts/launch.sh - Simple launch script (no rebuild)

Documentation:

  • docs/DEVELOPMENT.md - Comprehensive development guide
  • docs/KEYCHAIN_FIX.md - Detailed keychain fix explanation
  • AUGMENT_COOKIE_FIX.md - Augment cookie troubleshooting guide
  • README.md - Added development section

✅ Testing

  • ✅ Verified zero keychain prompts on subsequent rebuilds
  • ✅ Confirmed migration runs once and sets Userg
  • ✅ Tested Augment cookie auto-refresh with Chrome/Arc
  • ✅ Validated app launches successfully after changes

📊 Impact

This update significantly improves the development experience by eliminating repetitive keychain prompts while maintaining security. The migration is automatic and transparent to users.

- Include Chrome Beta and Chrome Canary in Augment browser cookie order
- Fixes cookie import for users running beta/canary Chrome versions
- Remove temporary debug files and documentation
- Add browserSessionExpired error case for when both cached and browser cookies expire
- Update error message to clarify that browser session needs refreshing
- Change button text from 'Log in to Augment' to 'Refresh Augment Session'
- Improve logging to distinguish between auto-retry success and browser session expiration
- Automatic retry logic now clearly indicates when browser visit is required
- Add domain filtering to AugmentCookieImporter.SessionInfo.cookieHeader(for:)
- Only send cookies valid for the target URL's domain (RFC 6265 semantics)
- Support exact match, parent domain, and wildcard domain matching
- Prevent cookies from auth.augmentcode.com being sent to app.augmentcode.com
- Add 7 comprehensive test cases covering all domain matching scenarios
- All 338 tests pass

This prevents potential authentication issues from cookies intended for
other subdomains being sent to the Augment API endpoints.
@bcharleson
Copy link
Contributor Author

🔒 Cookie Domain Filtering Fix

This update fixes a security/correctness issue with Augment cookie handling.

🎯 Problem

The Augment status probe was sending all cookies from *.augmentcode.com subdomains to app.augmentcode.com, including cookies from:

  • auth.augmentcode.com
  • billing.augmentcode.com
  • Any other subdomain

This could cause authentication issues or unexpected behavior.

✅ Solution

Added proper domain filtering to AugmentCookieImporter.SessionInfo.cookieHeader(for:) following RFC 6265 cookie semantics:

Allowed matches:

  • ✅ Exact domain: app.augmentcode.comapp.augmentcode.com
  • ✅ Parent domain: augmentcode.comapp.augmentcode.com
  • ✅ Wildcard domain: .augmentcode.comapp.augmentcode.com

Blocked:

  • ❌ Different subdomain: auth.augmentcode.com ❌→ app.augmentcode.com
  • ❌ Different base domain: example.com ❌→ app.augmentcode.com
    rehensive test cases covering all domain matching scenarios
  • All 338 tests pass
  • Verified with actual API calls (HTTP 200 responses)

📝 Files Changed

  • Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift - Added domain filtering logic
  • Tests/CodexBarTests/AugmentStatusProbeTests.swift - Added 7 new test cases

This ensures only cookies valid for the target domain are sent to Augment API endpoints.

Session Keepalive:
- Add AugmentSessionKeepalive actor for automatic session management
- Proactively refresh cookies before expiration (5-minute buffer)
- Check session health every 5 minutes
- Rate-limited refresh attempts (2-minute minimum interval)
- Support for both expiring and session cookies
- Integrated into UsageStore lifecycle

Menu Improvements:
- Update Augment error action text for clarity
- Change 'Refresh Augment Session' to 'Open Augment (Log Out & Back In)'
- Remove outdated 'session has expired in your browser' error check

Performance Optimization:
- Add 1-minute cache for Claude OAuth credentials
- Reduce repeated keychain access during rapid credential checks
- Invalidate cache on login/logout

Integration:
- Start keepalive automatically when Augment is enabled
- Stop keepalive when Augment is disabled
- Observe augmentCookieSource setting changes
- Comprehensive logging for debugging

This ensures Augment sessions remain active without manual intervention,
improving user experience and reducing authentication errors.
@bcharleson
Copy link
Contributor Author

🔄 Augment Session Keepalive

This update adds automatic session management for Augment to prevent cookie expiration.

🎯 Features

Automatic Session Refresh:

  • Monitors cookie expiration every 5 minutes
  • Proactively refreshes session 5 minutes before expiration
  • Rate-limited to prevent excessive refresh attempts (2-minute minimum)
  • Supports both expiring cookies and session cookies (refreshed every 30 minutes)

Smart Integration:

  • Automatically starts when Augment is enabled in settings
  • Automatically stops when Augment is disabled
  • Respects cookie source preference changes
  • Comprehensive logging for debugging

Session Refresh Mechanism:

  • Pings /api/auth/session endpoint to trigger cookie refresh
  • Re-imports fresh cookies from browser after refresh
  • Handles session expiration gracefully with error reporting

📝 Implementation Details

New File:

  • AugmentSessionKeepalive.swift - Main keepalive actor (240 liModified Files:
  • UsageStore.swift - Integrated keepalive lifecycle management
  • MenuDescriptor.swift - Improved error messaging
  • ClaudeOAuthCredentials.swift - Added 1-minute cache to reduce keychain prompts

✅ Benefits

  • No manual intervention - Sessions stay active automatically
  • Reduced authentication errors - Proactive refresh prevents expiration
  • Better UX - Users don't need to manually refresh sessions
  • Efficient - Rate-limited and only runs when Augment is enabled

🧪 Testing

  • ✅ Verified keepalive starts/stops with provider toggle
  • ✅ Confirmed session refresh works with Chrome/Arc cookies
  • ✅ Tested rate limiting prevents excessive refreshes
  • ✅ All 338 tests still pass

Phase 1: Fork Identity & Credits

About Section:
- Add dual attribution: Original author (Peter Steinberger) + Fork maintainer (Brandon Charleson)
- Update About.swift with clear original/fork links
- Update PreferencesAboutPane.swift with organized sections
- Change app icon click to open fork repository

README Updates:
- Add fork notice at top with link to original
- Update download links to point to fork releases
- Add 'Fork Enhancements' section documenting improvements
- List Augment provider as fork enhancement
- Update credits section with dual attribution

Documentation:
- Add comprehensive docs/augment.md covering:
  - Setup and configuration
  - Cookie import mechanism
  - Automatic session keepalive
  - Troubleshooting guide
  - Privacy and security details
  - Technical implementation notes

This establishes the fork's identity while properly crediting the
original author, preparing for independent development and distribution
via topoffunnel.com while maintaining option to contribute upstream.
Planning Documents:
- FORK_ROADMAP.md: Complete 5-phase development plan
  - Phase 1: Fork identity (COMPLETE)
  - Phase 2: Enhanced Augment diagnostics
  - Phase 3: Quotio feature analysis
  - Phase 4: Upstream sync workflow
  - Phase 5: Multi-account management

- FORK_QUICK_START.md: Developer quick reference
  - Common commands and workflows
  - Troubleshooting guide
  - Contribution guidelines
  - Learning resources

These documents provide a clear roadmap for fork development while
maintaining the option to contribute valuable changes upstream.
Adds FORK_STATUS.md to track:
- Completed work (Phase 1)
- Current state and known issues
- Next steps for each phase
- Progress tracking checklist
- Questions and decisions needed
- Recommendations for proceeding

This document serves as a living status tracker for the fork
development process.
Implements complete strategy for managing fork while monitoring and
selectively incorporating changes from both upstream repositories.

Automation Scripts:
- check_upstreams.sh: Monitor both upstreams for new commits
- review_upstream.sh: Create review branches for upstream changes
- prepare_upstream_pr.sh: Prepare clean branches for upstream PRs
- analyze_quotio.sh: Analyze quotio for patterns and features

GitHub Actions:
- upstream-monitor.yml: Automated weekly monitoring
  - Runs Monday/Thursday at 9 AM UTC
  - Creates/updates GitHub issues with change summaries
  - Provides links to review changes

Documentation:
- UPSTREAM_STRATEGY.md: Complete multi-upstream management guide
  - Git repository structure and remotes
  - Workflows for monitoring, reviewing, incorporating changes
  - Decision matrix for what to contribute upstream vs keep in fork
  - Commit message strategies and attribution
  - Practical examples and best practices

- QUOTIO_ANALYSIS.md: Framework for learning from quotio
  - Ethical guidelines for pattern analysis
  - Analysis process and templates
  - Feature comparison matrix
  - Implementation planning
  - Legal and attribution considerations

- FORK_SETUP.md: One-time setup guide
  - Git remote configuration
  - Script testing and verification
  - Critical discovery: upstream removed Augment provider
  - Selective sync strategy
  - Regular workflow recommendations

Key Features:
- Separate commits for fork-specific vs upstream-suitable changes
- Cherry-pick valuable upstream improvements
- Learn from quotio patterns without copying code
- Protect fork attribution and identity
- Maintain option to contribute back upstream
- Automated monitoring and notifications

Critical Discovery:
Upstream (steipete) has removed Augment provider in recent commits.
This validates the fork strategy - we preserve features important to
our users while selectively incorporating valuable upstream improvements.

This system enables best-of-both-worlds: independent fork development
while staying current with upstream innovations.
Updates FORK_STATUS.md to reflect:
- Completion of multi-upstream management system
- Critical discovery: upstream removed Augment provider
- New automation scripts and GitHub Actions
- Urgent upstream sync decision needed
- Updated git status and next steps
- Three options for proceeding

This validates the fork strategy - we preserve Augment support
while selectively incorporating valuable upstream improvements.
bcharleson and others added 14 commits January 4, 2026 08:16
Creates IMPLEMENTATION_SUMMARY.md documenting:
- Complete Phase 1 accomplishments
- Multi-upstream management system details
- Critical discovery: upstream removed Augment
- Strategic benefits of fork approach
- Current state and next steps
- Documentation index
- Success criteria verification

This serves as the definitive record of what was accomplished
and provides clear guidance for next steps.
…orce Refresh button

Improves Augment session management to prevent disconnections:

Session Keepalive Enhancements:
- Try multiple session endpoints (/api/auth/session, /api/session, /api/user)
- Add detailed logging for each endpoint attempt
- Log Set-Cookie headers when received
- Better error handling and fallback logic
- Enhanced cookie expiration diagnostics with per-cookie status

Cookie Diagnostics:
- Log each cookie's name and expiration time
- Show time until expiration in seconds
- Identify which cookie expires first
- Better visibility into session health

UI Improvements:
- Add 'Force Refresh Session' button in Augment settings (auto mode)
- Button manually triggers session refresh and usage update
- Separate actions for auto vs manual cookie modes
- Better user guidance for session issues

Implementation:
- forceRefreshAugmentSession() method in UsageStore
- Automatically starts keepalive if not running
- Refreshes usage after forcing session refresh
- All changes are @mainactor safe

This should significantly improve session stability and give users
a manual recovery option when automatic refresh fails.
- Enable supportsTokenCost in VertexAIProviderDescriptor
- Route Vertex AI cost requests to use Claude JSONL scanner (same data source)
- Add vertexai support in CostUsageFetcher and CostUsageScanner
- Enable token snapshot loading in StatusItemController+Menu
- Enable token usage refresh in UsageStore
- Add vertexai to MenuCardView token usage section
- Remove quota usage display (user only cares about token cost)
- Add docs/vertexai.md with setup instructions, prerequisites, and troubleshooting
- Update docs/providers.md to include Vertex AI in fetch strategies table
- Update README.md to list Vertex AI as a supported provider
- Update CHANGELOG.md with Vertex AI feature details for 0.17.1

Vertex AI cost tracking uses gcloud OAuth credentials and reads local
Claude usage logs from ~/.claude/projects/ for cost calculation. This
provides the same cost display (daily + 30-day) as Claude provider.
Since Vertex AI uses the same local Claude logs in  as the standard Claude provider, tracking cost for Vertex AI separately results in double-counting if both providers are active.
This change disables discrete cost tracking for Vertex AI and updates documentation to advise users to view their combined Claude + Vertex AI token costs via the Claude provider.
Vertex AI entries in Claude logs now have dedicated token cost tracking:

- Detect Vertex AI entries by _vrtx_ prefix in message/request IDs
  (e.g., msg_vrtx_0154LUXjFVzQGUca3yK2RUeo)
- Fall back to model name @ format detection and metadata fields
- Add ClaudeLogProviderFilter enum for filtering log entries by provider
- Handle Cloud Monitoring .noData error gracefully so token costs display
- Include Vertex AI in cost history chart submenu and token cost section
- Add tests for _vrtx_ prefix detection and provider filtering

This enables the Vertex AI tab to show token costs independently of the
Claude provider, with proper filtering to avoid double-counting.
- Use contains closure instead of for-if loop for Vertex detection
- Reduce processClaudeFile parameter count by moving range/filter to state
- Fix line wrapping in VertexAIProviderDescriptor
… cookie guidance

Addresses the common issue where browser cookies in the database are stale
even though the user has an active session in their browser tabs.

UI Improvements:
- Add 'Refresh Browser Cookies' button in Augment settings (auto mode)
- Button opens Augment dashboard and shows step-by-step instructions
- Explains that browser cookies may take time to write to disk
- Suggests closing/reopening browser if cookies remain stale

Error Message Improvements:
- Update browserSessionExpired error to mention new button
- Add detailed logging with step-by-step fix instructions
- Clarify that the issue is stale saved cookies, not expired session

User Workflow:
1. Click 'Refresh Browser Cookies' to open dashboard + see instructions
2. Refresh the page in browser (⌘R) or log out/in
3. Wait a few seconds for cookies to write to disk
4. Click 'Force Refresh Session' to reload usage data

This provides a clear path to recove when browser cookies are out of sync
with the active browser session, which is the most common cause of 401 errors.
- Fetch from /api/subscription endpoint to get plan name and billing period end
- Display plan name (e.g., 'Max') in menu header top-right corner
- Show billing cycle reset countdown (e.g., 'Resets in 4d 4h') below credits bar
- Parse billingPeriodEnd from ISO8601 format to Date
- Make subscription API optional/graceful - credits API is still primary
- Add --augment-debug CLI flag to dump raw API responses for debugging
- Combine Credits API and Subscription API JSON in debug output
- Maintain backward compatibility with existing cookie session handling
- Preserve all existing error handling and fallback behavior
Remove fork-specific branding to maintain consistency with upstream project.
Personal branding will be maintained in fork's main branch only.
- Revert to upstream README structure
- Keep Augment in provider list (without 'Fork enhancement' label)
- Remove fork download links, fork enhancements section, and dual attribution
- Personal branding will be maintained in fork's main branch only
@steipete steipete merged commit 3c76079 into steipete:main Jan 5, 2026
1 check passed
Finesssee pushed a commit to Finesssee/Win-CodexBar that referenced this pull request Jan 16, 2026
Initialize augmentCookieSourceRaw from UserDefaults in init, matching
the pattern used by other providers. Without this, the cookie source
always falls back to .auto after relaunch, causing users who select
.manual or .off to lose their preference.

Addresses Codex bot review feedback on PR steipete#120.
Finesssee pushed a commit to Finesssee/Win-CodexBar that referenced this pull request Jan 16, 2026
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.

3 participants