Repository navigation
fix(desktop-windows): wire chat quota gate into main-window send path (#10240) - #12203
Conversation
|
Thanks @formed2forge — this is a clean close-out of the main-window half of #10240, and it lands exactly where the tree was waiting for it: main's What I verified on the diff:
The blocker is branch state, not the change: the branch carries 43 upstream commits after its last sync, which is why GitHub shows a 208-file diff and conflicts against main. Everything outside the six files above is content that already landed through merged PRs (#11933, #12019, #12089, #12096, #12109, …), including all of the workflow/AGENTS.md/monitoring churn in the file list. Syncing your fork with upstream and rebasing Leaving for human maintainer review before merge: routine sign-off on the rebased head once CI confirms the three suites — the Mac-parity direction itself is already settled in the issue and in by AI on behalf of David. |
800a034 to
26bc736
Compare
|
Rebased onto current main — PR now shows 6 files (the 6 Windows files in the fix commit). Mergeable. |
…BasedHardware#10240) Replaces the post-send polling approach in UsageLimitTriggerHost with a pre-send gate check in useChat.send(), matching Mac's AgentBridge.quotaExceeded parity: a blocked send never fires the request, shows the upgrade popup immediately, and leaves the chat history untouched. UsageLimitTriggerHost now refreshes the gate snapshot (chatQuotaGate.sync) on the busy→idle edge so the next send check reads a fresh verdict without a network round trip. Removes maybeTriggerChatQuotaPopup (no callers remain) and its tests. Failure-Class: none Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KADKRuaPJdho9CDE7nLXQP
26bc736 to
beac65a
Compare
|
Thanks @formed2forge — the rebase did exactly what was asked: the PR now shows just the six Windows files from the fix commit, and GitHub reports it mergeable with no conflicts. I re-verified on the rebased head (beac65a):
One cosmetic nit, no action needed: the new in-quota test uses CI has re-queued on the new head — Desktop Checks is green; Desktop Windows CI was still pending at review time. Removed the stale by AI on behalf of David. |
|
Rebased and all 68/68 tests pass. Ready for maintainer merge sign-off. |
|
The |
kodjima33
left a comment
There was a problem hiding this comment.
Clean, scoped desktop bug fix (chat quota pre-send gate, closes #10240), matches Mac/bar parity pattern, tests added, not already fixed on main. Stale Android/Dart 'Detect Changes' check re-ran clean. Owner-override (desktop fix).
Summary
Closes #10240.
The main-window send path had no pre-send quota check — it fired the request, received the server's canned "You've reached your limit" reply as a chat message, and then
UsageLimitTriggerHostpolled the quota endpoint post-hoc to show the upgrade popup. This is now replaced with a proper pre-send gate matching Mac'sAgentBridge.quotaExceededparity and the bar's existingFloatingBarUsageLimiterparity:useChat.send()callsmainChatQuotaGate.check()before the request fires. If blocked:showUsageLimit('chat')is raised immediately and the send returns — no request sent, no history entry, no canned server reply.UsageLimitTriggerHostnow callschatQuotaGate.sync()on the busy→idle edge to refresh the snapshot for the next send's check, instead of pollingmaybeTriggerChatQuotaPopup.maybeTriggerChatQuotaPopupremoved fromusageLimit.ts(no remaining callers).Test plan
node_modules/.bin/vitest run src/renderer/src/lib/usageLimit.test.ts src/renderer/src/lib/chatQuotaGate.test.ts src/renderer/src/hooks/useChat.test.tsx— 68/68 passdescribe('useChat — chat quota gate')covers: blocked send (popup shown, no fetch, no history entry) and allowed send (proceeds,recordQuerycalled)Product invariants affected
Failure-Class: none
🤖 Generated with Claude Code