Fix/gemini service missing json import - #3951
Conversation
…g in FastAPI backend
…s and prod resource limits
…sions and silent failures
…re Supabase upload
…resolve schedules
Adds an animated pulse dot next to the priority selector for tickets marked critical or high, making urgent tickets easier to spot at a glance in the admin dashboard list. Fixes riteshbonthalakoti#3889
- Add formatRelativeTime() to dateUtils.js using date-fns formatDistance - Add safeParseDateForSort() for stable chronological sorting - Show relative time (e.g. '3 hours ago') in TicketDetail, AdminTicketDetail, AdminTickets, and TicketAuditTimeline - Absolute timestamp preserved as a hover tooltip everywhere it was replaced Closes riteshbonthalakoti#3885
- Show relative time (e.g. '3 hours ago') in TicketDetail, AdminTicketDetail, AdminTickets, and TicketAuditTimeline - Absolute timestamp preserved as a hover tooltip everywhere it was replaced Closes riteshbonthalakoti#3885
…odules Adds formatRelativeTime()/equivalent to the root-level dateUtils copies used outside Frontend/, keeping behavior consistent with riteshbonthalakoti#3885.
generate_rca_hypotheses() calls json.dumps() and json.loads() but the json module was never imported, causing a NameError on the first real API call. Adds the missing import. Also adds an optional stream_chat_response() helper with disconnect-safe streaming (request cancellation, cleanup, chunk timeout) for future use, in case a streaming/SSE chat endpoint is added later. Refs riteshbonthalakoti#3949
|
@Nancy-3012 is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedToo many files! This PR contains 2971 files, which is 2871 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. Usage-priced reviews support at most 300 files. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (17)
📒 Files selected for processing (2983)
You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests (beta)
|
Summary
Fixes a crash bug in
backend/services/gemini_service.py:generate_rca_hypotheses()callsjson.dumps()andjson.loads(),but
jsonwas never imported. This throwsNameError: name 'json' is not definedon the first real invocation.Changes
import jsonat the top ofgemini_service.pystream_chat_response()async generator withdisconnect-safe cleanup (cancels the in-flight Gemini task, closes
the stream handle, and enforces a per-chunk timeout), for future use
if a streaming/SSE chat endpoint is added. This is additive and does
not change any existing method's behavior.
Note on #3949
This PR addresses the confirmed bug found while reviewing this file.
I was not able to confirm the specific async-stream-disconnect-leak
described in #3949 against the current codebase — there is no
async generator, SSE handling, or
request.is_disconnected()callanywhere in
gemini_service.pyas it currently stands, so there isnothing there to leak yet. If the streaming endpoint referenced in
that issue lives in a different file, please point me to it and I'll
follow up with a targeted fix.
Testing
generate_rca_hypotheses()with the API keyset, confirmed no
NameError