Repository navigation
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for tightening this up. The direction looks sound to me: the quota check is now driven by an explicit hosted-request boundary instead of the shared sending busy flag, the internal hosted_request_started event is filtered out of the public coding-agent stream, and the added tests cover the important ownership/race cases including pre-dispatch failure, watchdog timeout, and serialized quota probes.
I’m not formally approving from automation because this touches quota/billing-sensitive chat behavior and the current automation context still has non-green Hygiene/Formatting/Detect Changes entries. Please get human maintainer review before merge, but I did not find a concrete code blocker in the static review.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
25ce3df to
f775498
Compare
|
Thanks for the update — the current direction still looks sound to me, and I don’t see a code-level blocker in this head. This now scopes the chat quota probe to an explicit hosted-dispatch/settled path rather than the shared File-by-file notes from this head:
CI is green on the relevant Windows/typecheck jobs in the context I reviewed. I’m leaving this for human maintainer sign-off because it touches quota/billing-sensitive behavior, but from this pass the implementation and tests look coherent. — Automated maintainer review (glm-5.2) by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
aryanorastar
left a comment
There was a problem hiding this comment.
Community review (COMMENT):
Replacing app-wide sending busy→idle inference with an explicit managed-cloud quotaCheckSeq / hosted-dispatch contract is the correct fix for INV-CHAT-1 and the once-per-session latch races called out in #10240. The Vitest coverage for “local/BYOK/cancel must not bump seq” and “managed dispatch does” is the right shape.
Please confirm / keep explicit:
- Serialization — concurrent completions cannot race past the once-per-session popup latch (called out in the body — worth one dedicated assertion if not already isolated).
- Cancel / reset / coding-agent paths never publish a quota-check signal (tests appear to cover this — keep them green on tip).
- Latest PR Metadata Preflight is green on the tip (older CANCELLED rollups are noise if the newest run passed).
Solid Windows chat cost/UX correctness work. Not requesting changes unless (1) is missing on tip.
Replace shared busy-state edge inference with an explicit hosted-chat completion sequence owned by useChat. Failure-Class: new
f775498 to
90aff16
Compare
|
Rebased this onto current main and force-pushed 90aff16. The refresh drops the superseded duplicate probe/popup machinery and now feeds the canonical gate from #12203; focused Vitest is 164/164, both Windows typechecks and touched-file ESLint pass, and current-main PR preflight passes all 13 selected checks. |
|
Verified on the rebased head What I verified statically on this head:
On the three asks from @aryanorastar: cancel/reset/coding-agent paths never publish a quota signal — covered by the new assertions (both reset suites expect seq 0 and the taskRunner filter test holds); the PR Metadata Preflight is green on this tip. For the popup-latch serialization question, that latch now lives in the machinery this rebase adopted from #12203 rather than in this diff — the seq is a functional state update and only the current generation's terminal bumps it, so I don't see a new race here; if the maintainer still wants a dedicated concurrent-completion assertion, it would sit most naturally beside that latch. No code-level blocker found in static review of this head. Not formally approving from automation because this drives quota/billing-sensitive refresh behavior; keeping by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Desktop bug-fix fast lane: title fix(windows), scopes quota-check refresh to real hosted chat dispatches instead of a shared busy flag, well-tested (164 tests), CI green, no abuse signals. Owner-override merge.
What changed and why
Addresses the Stream-1 usage-limit chat integration follow-up in #10240. Current
mainalready owns quota enforcement in the canonicalmainChatQuotaGate, but its post-reply refresh still infers a hosted completion from the app-widechat.sendingbusy-to-idle edge. That flag is also controlled by local automation, coding-agent, cancellation, and reset paths, so unrelated work can refresh the quota snapshot and clear its optimistic send count.This PR replaces that inference with an explicit hosted transport boundary:
hosted_request_startedonly after its provider command is written successfully;useChatadvances a monotonicquotaCheckSeqonly when a real pi-mono or legacy fetch dispatch settles (including the watchdog path), never for pre-dispatch failures or reset/cancelled generations;UsageLimitTriggerHostsyncs the existing canonical quota gate from that sequence instead of watching shared busy state.No second quota gate, popup latch, or probe queue is introduced; this rebased version reuses the implementation now on
mainfrom #12203.Product invariants affected
How it was verified
typecheck:nodeandtypecheck:webpassed with Node 22.23.1.main(219.11s).Tests
UsageLimitTriggerHost.test.tsxproves generic busy-to-idle transitions do not sync quota and an explicit hosted completion does.piMono.test.ts,mainChat.test.ts, anduseChat.pimono.test.tsxcover the managed-cloud event boundary, pre-dispatch failure, retry, and watchdog terminalization.taskRunner.test.tsproves the internal lifecycle event cannot leak into public coding-agent events.useChat.test.tsxcovers legacy fetch dispatch, synchronous pre-dispatch failure, reset suppression, and normal completion.chatQuotaGate.test.tsremains green, covering the canonical gate's in-flight dedupe, refresh throttle, and optimistic count.Failure class (fixes)
Failure-Class: new
Failure-class transition narrative
The violated contract was that post-chat quota refresh inferred hosted-request completion from a shared busy flag with several non-hosted owners. The canonical prevention is an adapter-owned hosted-dispatch marker, a monotonic terminal signal in the chat hook, and host consumption through the existing main-chat quota gate. PR #10236 is the supporting evidence because it introduced the temporary spinner inference and recorded this replacement as deferred work.