Skip to content

Fix customer chat deletion races and make RAG latency profiling safe - #18

Merged
yashaskn8 merged 12 commits into
mainfrom
fix/servy-delete-races-latency-profiler
Nov 16, 2026
Merged

yashaskn8 merged 12 commits into
mainfrom
fix/servy-delete-races-latency-profiler

Conversation

@yashaskn8

@yashaskn8 yashaskn8 commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR addresses the two customer-demo issues reported in the live Servy RAG UI.

1. Prevent deleted chats from reappearing

  • Perform server-side DELETE before removing a persisted chat from React state.
  • Keep the row visible and show an error if DELETE fails.
  • Invalidate history requests that began before a deletion.
  • Keep session-scoped deleted-UUID tombstones to reject stale list responses.
  • Use a synchronized thread-list ref so concurrent delete completions operate on the latest list.
  • Guard duplicate in-flight delete requests per row.
  • Avoid triggering a saved-history GET when deleting the final active chat; create an empty local draft instead.
  • Guard asynchronous open-thread requests so a deleted or stale chat cannot become active after its message fetch completes.
  • Scope delete-triggered history invalidation to the affected asset.
  • Restore the next saved chat's message state when deleting the active row.

2. Make latency profiling measurable and non-polluting

  • Record conversation-creation duration, time to first SSE event, time to final result, stream end-to-end duration, and whole-turn duration.
  • Record BGE/dense, sparse, fusion, V5, Qwen, evidence-validation and overall pipeline stage statuses/durations when the stream reports them.
  • Report median, nearest-rank p90 and max for observed timings; missing stages remain absent rather than being fabricated.
  • Soft-delete only conversation UUIDs returned by this profiling run, retry cleanup failures in a finally path, and never enumerate or delete existing user history.

Tests and CI

  • Added Node tests for stale-history merges, preserving local drafts, refreshed row replacement, sequential removals and asset isolation.
  • Added Python tests for timing summaries and profiler-owned conversation cleanup.
  • Added both suites to .github/workflows/ci.yml.
  • GitHub Actions frontend job passed: lint, customer chat state tests, technician-instance test and production build.
  • GitHub Actions MySQL backend job is still running; this PR is not marked ready for review until it completes.

Safety

No production database, approved manuals, embeddings, Chroma collections, access codes or existing conversation records were changed by these edits. The profiler soft-deletes only UUIDs it created itself.

Local validation still required

The profiler has not been run against the local servy_dev gateway from this GitHub-only change. After CI passes, run it locally using the existing private access-file path; do not share the access code.

@yashaskn8
yashaskn8 marked this pull request as ready for review November 16, 2026 10:14
@yashaskn8
yashaskn8 merged commit e974f45 into main Nov 16, 2026
1 of 2 checks passed
@yashaskn8
yashaskn8 deleted the fix/servy-delete-races-latency-profiler branch November 16, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant