umanggarg Claude Sonnet 4.6 commited on
Commit
a4e0cd4
·
1 Parent(s): 5bd72c7

fix: three bugs from re-index logs

Browse files

1. UUID format mismatch in delete_stale_chunks: _stable_id() returns
MD5 hex without dashes, but Qdrant returns scrolled IDs in UUID format
with dashes. Normalize both sides by stripping dashes before comparing,
so freshly-upserted chunks are never incorrectly classified as stale.
(Root cause of '625 upserted → 622 deleted → 0 stored' in logs.)

2. Cerebras model name: 'llama-3.3-70b' → 'llama3.3-70b' (matching
Cerebras API slug format, consistent with old 'llama3.1-8b').

3. Re-index button glow: add 'done-glow' CSS class with a 3s blue pulse
animation on the ⟳ icon when re-index completes successfully.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

backend/services/generation.py CHANGED
@@ -287,7 +287,7 @@ class GenerationService:
287
  # llama-3.3-70b produces dramatically better context sentences than
288
  # llama3.1-8b for structured tasks like "describe what this chunk does in
289
  # one sentence". Both are on Cerebras free tier.
290
- self._model = "llama-3.3-70b"
291
  print("Generation: using Cerebras (llama-3.3-70b) — fast free tier")
292
  return "cerebras"
293
  elif settings.anthropic_api_key:
@@ -336,7 +336,7 @@ class GenerationService:
336
  api_key=settings.cerebras_api_key,
337
  base_url="https://api.cerebras.ai/v1",
338
  )
339
- self._model = "llama-3.3-70b"
340
  self.provider = "cerebras"
341
  print("Generation: Gemma 4 limit hit — switched to Cerebras (llama-3.3-70b)")
342
  return True
 
287
  # llama-3.3-70b produces dramatically better context sentences than
288
  # llama3.1-8b for structured tasks like "describe what this chunk does in
289
  # one sentence". Both are on Cerebras free tier.
290
+ self._model = "llama3.3-70b"
291
  print("Generation: using Cerebras (llama-3.3-70b) — fast free tier")
292
  return "cerebras"
293
  elif settings.anthropic_api_key:
 
336
  api_key=settings.cerebras_api_key,
337
  base_url="https://api.cerebras.ai/v1",
338
  )
339
+ self._model = "llama3.3-70b"
340
  self.provider = "cerebras"
341
  print("Generation: Gemma 4 limit hit — switched to Cerebras (llama-3.3-70b)")
342
  return True
ingestion/qdrant_store.py CHANGED
@@ -483,8 +483,13 @@ class QdrantStore:
483
  if offset is None:
484
  break
485
 
486
- # Stale = in old index but not in new set
487
- stale = [id_ for id_ in old_ids if id_ not in keep_ids]
 
 
 
 
 
488
  if not stale:
489
  return 0
490
 
 
483
  if offset is None:
484
  break
485
 
486
+ # Normalize both sides before comparing.
487
+ # _stable_id() returns a 32-char MD5 hex string (no dashes).
488
+ # Qdrant stores UUIDs internally and returns them with dashes when scrolled
489
+ # (e.g. "a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6"). Strip dashes on both
490
+ # sides so the comparison works regardless of formatting.
491
+ normalized_keep = {k.replace("-", "") for k in keep_ids}
492
+ stale = [id_ for id_ in old_ids if id_.replace("-", "") not in normalized_keep]
493
  if not stale:
494
  return 0
495
 
ui/src/components/Sidebar.jsx CHANGED
@@ -566,7 +566,7 @@ export default function Sidebar({ repos, reposLoading, activeRepo, onSelectRepo,
566
  )}
567
  {/* Re-index button — one click re-ingests from scratch */}
568
  <button
569
- className={`repo-reindex${isReindexingThis ? " spinning" : ""}`}
570
  onClick={(e) => handleReindex(e, r.slug)}
571
  disabled={!!reindexing}
572
  title={isReindexingThis ? "Re-indexing…" : "Re-index with contextual retrieval — adds AI-generated descriptions to key chunks before embedding, improving search precision"}
 
566
  )}
567
  {/* Re-index button — one click re-ingests from scratch */}
568
  <button
569
+ className={`repo-reindex${isReindexingThis ? " spinning" : ""}${justDone ? " done-glow" : ""}`}
570
  onClick={(e) => handleReindex(e, r.slug)}
571
  disabled={!!reindexing}
572
  title={isReindexingThis ? "Re-indexing…" : "Re-index with contextual retrieval — adds AI-generated descriptions to key chunks before embedding, improving search precision"}
ui/src/index.css CHANGED
@@ -3353,6 +3353,17 @@ textarea:focus-visible {
3353
  from { transform: rotate(0deg); }
3354
  to { transform: rotate(360deg); }
3355
  }
 
 
 
 
 
 
 
 
 
 
 
3356
 
3357
  /* Re-index progress bar — sits flush at the bottom of the repo card */
3358
  .repo-reindex-progress {
 
3353
  from { transform: rotate(0deg); }
3354
  to { transform: rotate(360deg); }
3355
  }
3356
+ /* Glow pulse on the re-index button after a successful re-index.
3357
+ Fades over 3s (matching the reindexDone timeout in Sidebar.jsx). */
3358
+ .repo-reindex.done-glow {
3359
+ color: var(--accent-soft);
3360
+ animation: reindex-done-pulse 3s ease-out forwards;
3361
+ }
3362
+ @keyframes reindex-done-pulse {
3363
+ 0% { color: var(--accent-soft); text-shadow: 0 0 8px var(--accent), 0 0 16px var(--accent-glow); }
3364
+ 40% { color: #fff; text-shadow: 0 0 12px var(--accent), 0 0 24px var(--accent-glow); }
3365
+ 100% { color: var(--muted); text-shadow: none; }
3366
+ }
3367
 
3368
  /* Re-index progress bar — sits flush at the bottom of the repo card */
3369
  .repo-reindex-progress {