Fix mobile settings and live provider usage#854
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@copilot review but do not make fixes |
📝 WalkthroughWalkthroughThe PR changes desktop usage polling ownership, provider-state reconciliation, binding-aware snapshot handling, and event routing. It also updates iOS connection transition state, toolbar settings access, quota presentation, usage refresh behavior, and related tests. ChangesDesktop usage synchronization
iOS connection and settings controls
iOS usage quota presentation
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/components/usage/HeaderUsageControl.tsx (1)
172-177: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winGuard explicit refreshes against project-binding changes.
Both refresh handlers can apply an old project’s response after rebinding. Promote the binding generation to a ref shared with these callbacks, capture it before the request, and discard the result if it changed.
apps/desktop/src/renderer/components/usage/HeaderUsageControl.tsx#L172-L177: generation-guard the result ofwindow.ade.usage.refresh().apps/desktop/src/renderer/components/usage/UsageQuotaPanel.tsx#L287-L292: apply the same guard inrefreshNowand add a binding-during-refresh regression test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/desktop/src/renderer/components/usage/HeaderUsageControl.tsx` around lines 172 - 177, Promote the project-binding generation to a shared ref used by both refresh callbacks. In apps/desktop/src/renderer/components/usage/HeaderUsageControl.tsx lines 172-177, capture the generation before window.ade.usage.refresh() and applySnapshot only when it is unchanged; make the same change in apps/desktop/src/renderer/components/usage/UsageQuotaPanel.tsx lines 287-292 within refreshNow, and add a regression test covering rebinding during refresh.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/desktop/src/main/services/usage/usageTrackingService.ts`:
- Around line 2673-2689: The skipped-provider handling around carriedWindows and
providerStatus must not restore a previous “ok” status when all carried windows
have expired. Only preserve the previous status while carriedWindows remains
valid; otherwise retain the stale-status fallback when lastSuccessAt exists or
clear/downgrade the status. Add a test covering expiration of the final carried
window and the resulting non-ok status.
---
Outside diff comments:
In `@apps/desktop/src/renderer/components/usage/HeaderUsageControl.tsx`:
- Around line 172-177: Promote the project-binding generation to a shared ref
used by both refresh callbacks. In
apps/desktop/src/renderer/components/usage/HeaderUsageControl.tsx lines 172-177,
capture the generation before window.ade.usage.refresh() and applySnapshot only
when it is unchanged; make the same change in
apps/desktop/src/renderer/components/usage/UsageQuotaPanel.tsx lines 287-292
within refreshNow, and add a regression test covering rebinding during refresh.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c05f0c70-b659-42f4-8c85-98b44132a8b2
⛔ Files ignored due to path filters (3)
docs/ARCHITECTURE.mdis excluded by!docs/**docs/features/onboarding-and-settings/README.mdis excluded by!docs/**docs/features/sync-and-multi-device/ios-companion.mdis excluded by!docs/**
📒 Files selected for processing (18)
apps/desktop/src/main/main.tsapps/desktop/src/main/services/usage/usageProviderStrategies.tsapps/desktop/src/main/services/usage/usageTrackingService.test.tsapps/desktop/src/main/services/usage/usageTrackingService.tsapps/desktop/src/preload/preload.test.tsapps/desktop/src/preload/preload.tsapps/desktop/src/renderer/components/usage/HeaderUsageControl.tsxapps/desktop/src/renderer/components/usage/UsageQuotaPanel.tsxapps/desktop/src/renderer/components/usage/usage.test.tsxapps/desktop/src/renderer/components/usage/usageSnapshotOrdering.tsapps/ios/ADE/Models/RemoteModels.swiftapps/ios/ADE/Services/SyncService.swiftapps/ios/ADE/Views/Components/ADEDesignSystem.swiftapps/ios/ADE/Views/Settings/ConnectionSettingsView.swiftapps/ios/ADE/Views/Work/WorkNewChatScreen.swiftapps/ios/ADE/Views/Work/WorkRootScreen.swiftapps/ios/ADE/Views/Work/WorkUsageActivityCarousel.swiftapps/ios/ADETests/ADETests.swift
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Validation
Summary by CodeRabbit
New Features
Bug Fixes
Greptile Summary
This PR aligns desktop and iOS usage surfaces around live, binding-scoped quota snapshots. The main changes are:
Confidence Score: 5/5
Safe to merge with low risk.
The changes are focused on usage snapshot routing, quota preservation, and mobile UI state transitions, with tests covering the main stale-snapshot and binding-change paths.
No files require special attention.
What T-Rex did
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Provider as Claude/Codex provider participant Machine as Machine usage tracker participant Runtime as Runtime event pump participant Preload as Desktop preload bridge participant UI as Header/Quota panel participant iOS as iOS usage surfaces Provider->>Machine: Poll quota windows alt Non-interactive Claude cannot verify credentials Machine->>Machine: Preserve previous unexpired windows else Fresh provider result Machine->>Machine: Merge fresh windows/status end Machine->>Runtime: Emit usage snapshot event Runtime->>Preload: Stream binding-scoped usage event Preload->>UI: Dispatch only events matching binding state UI->>UI: Ignore older snapshots and reset on binding change iOS->>Machine: Refresh quota / request usage stats Machine-->>iOS: Return live quota/activity snapshots%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Provider as Claude/Codex provider participant Machine as Machine usage tracker participant Runtime as Runtime event pump participant Preload as Desktop preload bridge participant UI as Header/Quota panel participant iOS as iOS usage surfaces Provider->>Machine: Poll quota windows alt Non-interactive Claude cannot verify credentials Machine->>Machine: Preserve previous unexpired windows else Fresh provider result Machine->>Machine: Merge fresh windows/status end Machine->>Runtime: Emit usage snapshot event Runtime->>Preload: Stream binding-scoped usage event Preload->>UI: Dispatch only events matching binding state UI->>UI: Ignore older snapshots and reset on binding change iOS->>Machine: Refresh quota / request usage stats Machine-->>iOS: Return live quota/activity snapshotsReviews (2): Last reviewed commit: "ship: iteration 1 — harden usage refresh..." | Re-trigger Greptile