Load queue depths on freebuff landing so picker doesn't flash "No wait"#532
Load queue depths on freebuff landing so picker doesn't flash "No wait"#532
Conversation
After returnToFreebuffLanding, the picker applied bare {status:'none'}
with no queueDepthByModel and nextDelayMs returns null for 'none', so
stale zeros showed until POST. Kick off a fire-and-forget GET in
landing mode that extracts just queueDepthByModel (ignoring status,
so a stale pre-DELETE row can't trip the takeover branch), and render
blank hints instead of "No wait" while the snapshot is missing.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Greptile SummaryThis PR fixes a UX bug where the freebuff model picker flashed "No wait" for every model whenever the landing screen was shown after a session ended. The root cause was that Key changes:
Confidence Score: 4/5Safe to merge; logic is sound and race conditions are handled correctly via abort signals. The fix is narrowly scoped, well-reasoned, and the abort/cancellation guards are correctly implemented. The one non-blocking nuance is that when the server still returns queued (pre-DELETE propagation), the depth for the user's own model includes their in-queue position, so the hint may be off-by-one — but this is an intentional, documented trade-off. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Picker as FreebuffModelSelector
participant Hook as useFreebuffSession
participant Server
User->>Hook: returnToFreebuffLanding()
Hook->>Hook: abort in-flight request
Hook->>Hook: apply({ status: 'none' }) — no queueDepthByModel
Hook-->>Picker: session = { status: 'none' } → hints = null (blank)
Hook->>Server: GET /api/v1/freebuff/session (fire-and-forget)
Note over Hook,Server: signal = fetchController.signal
alt Server responds with none or queued status
Server-->>Hook: { status: 'none'/'queued', queueDepthByModel: {...} }
Hook->>Hook: apply({ status: 'none', queueDepthByModel })
Hook-->>Picker: hints show real depths
else Server responds with active/ended/other
Server-->>Hook: response ignored
Hook-->>Picker: hints stay blank (prevents auto-rejoin)
else User presses Enter before fetch returns
User->>Hook: joinFreebuffQueue(model)
Hook->>Hook: abort fetchController.signal
Note over Hook: .then() checks signal.aborted → exits early
Hook->>Server: POST /api/v1/freebuff/session
Server-->>Hook: real session response
Hook-->>Picker: full session state applied
end
Reviews (1): Last reviewed commit: "Load queue depths on landing so picker d..." | Re-trigger Greptile |
Summary
returnToFreebuffLandingwas applying bare{status:'none'}with noqueueDepthByModel, andnextDelayMsreturnsnullfor'none'so nothing refreshed — every model showed "No wait" until the user hit Enter and POST finally returned real depths.queueDepthByModel(ignoring status, so a stale pre-DELETE row can't trip the takeover branch into a silent re-join).Test plan
/end-sessionor click the end-session button → landing picker shows accurate hints immediately, not stale zeros.🤖 Generated with Claude Code