Spaces:
Sleeping
Sleeping
Commit History
-
feat(upload): wait-for-extraction flow + status endpoint + extended voice guardβ
User directives integrated: 1. "generate the card inline ONLY after full data extraction" β card no longer renders on the partial heuristic record; we wait for the LLM pass to complete first. 2. "ensure re-grading actually happens" β new /api/upload/extraction-status/{policy_id} exposes real-time in-memory state of the background LLM extraction. 3. "kill the unprompted 'Could you please upload' message" β voice auto-submit now blocked for the ENTIRE extraction window (extractionInFlight state), not just the 8s upload-status window. 4. "same level of usability as the 148 catalogued, no less" β no user-upload__ branches in PolicyPremiumWidget / PerPolicyPremiumEstimator β parity by construction once LLM extraction lands and HealthPolicy fields populate. BACKEND βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ - _UPLOAD_EXTRACTION_STATUS dict (in-process) tracks per-upload extraction lifecycle: pending β running β¦dfaa4d6 -
feat: uploaded-PDF parity with catalogued 148 (ADR-044)β
User-uploaded PDFs now go through the IDENTICAL pipeline as the 148 catalogued policies β same LLM extractor, same scorecard, same review data flow, same card UI. No "user-upload" carve-outs. CHANGES βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ A. Insurer detection (backend/uploaded_docs.py) detect_insurer_slug() scans the first ~6000 chars of PDF text for the legal name of any of the 21 insurers we have reviews data for (Acko, Bajaj Allianz, HDFC ERGO, ICICI Lombard, ManipalCigna, Niva Bupa, Star Health, Tata AIG, β¦). On a match, the persisted record + chunk metadata + Chroma metadata are stamped with the REAL insurer_slug β the scorecard's Claim Experience sub-score reads 40-data/reviews/<slug>.json and gets real claim-ratio + complaint-volume + NPS data, same as a catalogued card. Fail-closed: no match β insurer_slug stays "user-upload". B. LLM-assisted extraction on upload (backend/uploaded_docs.py + backend/main.py) New β¦4bb66dd -
fix(frontend): PDF upload β in-chat ack + inline scorecard card + proceed-choice promptβ
Reported symptom: user uploaded a PDF and saw no acknowledgment in chat β only a transient 8-second banner above the composer, which is easy to miss. The chat transcript itself showed no trace of the upload, so the user had no signal the indexing succeeded or that they could now ask the bot about the document. CHANGES βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ handleFile (frontend/src/app/page.tsx): 1. pushUser("π Uploaded: <filename>") β breadcrumb so the chat transcript records the action AND so the next /api/chat turn's chat_history includes it (helps the brain disambiguate "this policy" references). 2. On success: pushAssistant with the upload-ack text AND a `citations` array carrying the uploaded policy_id. The existing chat renderer reads citations from an assistant message and fires getScorecard(policy_id, session_id) per cited policy, so the scorecard card now appears INLINE under the bubble β same treatβ¦de473cb -
feat!: remove cross-session profile recall (ADR-043) β net β3700 LOCβ
Sessions are now in-memory only. ADR-041's name-slug + persona_id two-tier on-disk store and ADR-042 v3+v4's two-fact gate + extended extractors are removed entirely. Closing the tab discards the profile. CONTEXT βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Two-week arc of recall hardening (ADR-041 β KI-196 β Bug #25 β Bug #26 β ADR-042 v1 β v2 β v3 β v4) kept exposing new failure modes. Each pass was a real bug class, but after v4 the live audit still showed seeded-test failures because the name-slug pointer was being overwritten between tests β the structural truth a name-only key cannot safely disambiguate two visitors who share a name. The workarounds were accumulating without converging. Cost/benefit was wrong for an insurance-shopping product (rare- purchase, return sessions uncommon): ~1500 LOC + 100+ profile JSONs + 2 ADRs + 5 test files + ongoing audit-time state drift, for a feature whose value is "the bot remembers you next visit." Minimum-data- reβ¦6d5684e
-
feat(#31): deterministic profile-aware {strengths,caveat} policy summary on all 3 surfacesβ
Replaces the generic grade one-liner with a per-(profileΓpolicy) ProfileSummary{strengths[], caveat} computed on the SAME pass as the marketplace grade (scorecard.build_profile_summary): deterministic, no LLM, no fabricated numbers, no /100 or A/B in prose; ~4-5 most-material strengths for THIS profile + the one honest grade-capping caveat; fallback to one_liner when facts-sparse/insufficient-data. Rendered at the TOP of CitedPolicyCards, PolicyDetailModal, marketplace PolicyCard, and PolicyScorecardWidget. Β§4c: /api/policies/{id}/scorecard now takes session_id and resolves the profile via brain_tools.union_snapshot identically to /api/policies/all; single-endpoint defers to the catalogue (single source of truth) so profile_summary+grade are byte-identical across surfaces for all 148 (new parity test). Verified: full pytest suite exit 0 (no regression); test_profile_ summary + parity + endpoint_catalogue 21/21 (incl. 148Γ6-profile invariants, deductible-gate, non-fabrication, caveat-tβ¦d486a56 -
fix: deductible gating (#29), existing-cover steering + dangling-turn guard (#30), compare-modal full reviews (#32)β
#29 β deductible selector/discount was applied to all 148 though only 2 truly offer a voluntary deductible. New premium_calculator.policy_ deductible_support() (deductible_amount>0 AND not top-up β exactly bajaj-allianz__health-guard, star-health__star-assure); estimate + bulk gate the discount (defense-in-depth); PremiumEstimateResponse echoes supports_voluntary_deductible/allowed_deductibles; widget renders the deductible row only when supported. tests/test_deductible_ eligibility.py sweeps all 148. #30 β existing_cover_inr drove neither ranking, retrieval phrasing, nor framing; bot promised 're-evaluate' then stopped; re-eval recycled 2/3. Decisive fix B1-c: +22 existing-cover term in _fit_score for top-ups + seed out-of-window top-ups in _quality_seed_candidates. B1-a: RULE 2 mandatory existing-cover phrasing + Worked example C + RULE 2.6 framing mandate. B2: RULE 3.7 never-promise + _is_promissory_ no_action + one-shot loop guard that forces the promised tool call. B3: RULE 3 matβ¦3fcae97
-
fix(#63): header premium pill is the TYPICAL cohort range, labelled as suchβ
The header pill showed a bare 'βΉXββΉY/yr' while the LIVE PREMIUM panel showed a different (often higher) per-plan number β read as 'random different numbers'. Per estimate_premium_band's KI-278 contract this is DELIBERATE: the pill is the p25-p75 typical-cohort band; the panel is ONE specific plan's estimate (may sit outside the typical band β expected, not a contradiction). NO pricing math changed (so #44's 0-violation engine is untouched β gate rc=0). Fix is purely clarity: - PredictedPremiumBandResponse now surfaces sum_insured_used (the model was silently dropping the value the contract already returns) - api.ts type + page.tsx: pill reads 'Typically βΉXββΉY/yr'; tooltip explains it's the typical range similar buyers pay (at βΉN cover) and that a specific plan's live premium can sit above/below it β expected. Backend import OK; full pytest rc=0; tsc/build green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>e21c985 -
fix(#64): preserve EXACT budget βΉ β slider shows what the user saidβ
The annual-budget slider is continuous, but budget round-tripped through a lossy 4-band enum: budgetBandToInr() could only ever return 12k/22k/45k/75k, so 'I don't want to spend more than 15000 a year' showed as βΉ12k. Added a lossless exact field end-to-end: - needs_finder.Profile.budget_inr; brain_tools SLOT_UNION + _ACCEPTED_FIELDS - save_profile_field: when budget_band is captured, also parse + store the EXACT βΉ (numeric, or strip per-annum qualifiers then _parse_inr_amount β same KI-161 guard _coerce_budget_band uses; verified '15000'/'βΉ15,000/yr'/ '15000 a year'/'more than 15000 a year'/'around 25k per year' β 15000/25000) - main.py ProfileUpdateRequest + apply tuple accept budget_inr - api.ts UserProfile (+nullable) gains budget_inr - page.tsx: slider seeds from budget_inr ?? band-fallback; reseed effect same; handleSave sends budget_inr (exact) alongside the derived budget_band (pricing contract unchanged). Band stays the pricing contract; budget_inr is the display trβ¦06c7cbc -
fix(#55+#56+#53/#54-engine): TTS full natural readout + voice warm-stream/pre-rollβ
#55 TTS 10s truncation: voice_format._truncate_for_voice(max_words=55) chopped every advisor reply to ~55 words (~10s) before it reached Sarvam. Cap removed (max_words now ignored unless >=100000). Latent Sarvam Bulbul v2 1500-char cap covered: sarvam_tts now char-ceiling chunks at item/sentence/comma seams, synthesizes sequentially, gapless WAV concat, propagates any chunk error (no silent partial) β STT-style. #56 TTS normalization: _normalize_abbreviations + _normalize_ranges β e.g./i.e./etc. spoken as words; '/' β 'or'; βΉ/L/Cr/K/% and en-dash ranges expanded; markdown/list numbering stripped. Verified on the exact 6-question pricing message (all 6 questions present, artifacts gone). #53/#54 ENGINE: useStreamingVoice warm pre-armed mic + 800ms PreRollRing + 200ms deliberate-hold gate + beginPushToTalk/endPushToTalk/ consumePreRollChunks API. Keeps the OS mic hot so page.tsx getUserMedia is ~10-50ms not 200-700ms (latency #54) and the first word is captured (head-clip #53). page.tsβ¦7d87d62
-
fix(#40+voice+upload): SSOT scorecard parity + Sarvam 30s-truncation + uploaded-PDF retrieval gateβ
#40 SINGLE SOURCE OF TRUTH: extract the marketplace catalogue into backend.main._marketplace_catalogue + marketplace_grade(); brain_tools ._scorecard_signal now delegates (deleted the parallel doctype-rank/_merge re-implementation). Rec-card grade == marketplace grade for all 148 by construction β deterministic oracle 790 ids / 0 mismatches; parity test rewritten to assert the full id universe + alias/doctype edges. VOICE: Sarvam saarika REST has a hard ~30s limit and silently returns only the first 30s (HTTP 200). sarvam_stt now decodes to 16k mono and splits >25s audio on silence, transcribes sequentially, concatenates, raises on error (no silent failure). Frontend POST timeout scales with blob size. Regression test: 92s utterance -> all 92 words. UPLOAD: brain_tools profile-gate silently returned 0 chunks for a freshly uploaded PDF asked about before fact-find (contradicted the 'searchable now' UI promise). Added session-scoped quarantine bypass + single_brain UPLOADED-DOC prompt β¦a5d9bfd -
fix(pricing+scoring): rebuild premium engine to 0 logical violations + classification, faithfulness, links, writingβ
Claude Code +1: Claude Opus 4.7 (1M context)Pricing: rebuilt sampleβpremium as median-of-normalized-bases (monotone by construction) + real-fact product-type classifier + age-bucket-key fix + type-aware abs/low caps + P7 capped vs cheapest real comprehensive + Sanjeevani rel-cap. Exhaustive harness 3,316β0 (P1-P8=0, 104,760 checks); 5 monotonicity + 4 strict all-148 seeds clean. Deep-research harvest (6 agents, integrity-gated): 93/148 now real-quote-anchored, rest typeΓprofile-modelled w/ honest provenance labels. Classification: fixed Health Guard/Star Assure (voluntary-deductible comprehensive mislabelled topup β dedβ₯βΉ2L threshold), Criti Care/Medicareβdisease, Energyβcomprehensive, Health Protector Plusβtopup. Scoring: parity-by-construction (_scorecard_signal mirrors marketplace doctype-rank + merge); harness S3=0, test_scorecard_parity green. Reviews source-map + 148 confirm. Weighted-avg math audited PASS. Faithfulness: _verify_prose_grounding β UINs in reply prose must be retrieved-grounded (faithfulness_passed now coβ¦f266901 -
chore(cleanup): frontend β drop stale narrative comments (current-standard)β
Comment-only: removed a dated KI mistake-narrative on the tts_error_code type and trimmed a few "old hack / used to" history parentheticals in page.tsx / globals.css to clean current-behaviour wording. No TS/JSX/CSS behaviour change. Completes the codebase-wide stale-content purge (history of record stays in ADR/KI/README only). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>3a0fde4
-
recovery: integrate stalled-session work + de-stale/cleanup (pytest 215 green) [build-fix]β
Resumes the session whose 3 background agents stalled on the 600s watchdog; captures the prior session's uncommitted #42β#110 work + data exercise plus this session's verified recovery changes. (Rebuilt from the first attempt to store frontend/public/insurer-logos/*.png via Git LFS β HF Spaces' pre-receive hook requires it; .gitattributes updated, tools/.pdf_text_cache gitignored.) Prior-session work captured (was uncommitted, behaviourally live-tested): - single_brain rewrite, full frontend rebuild, compare/scorecard/premium UI, ~77 40-data/policy_facts sourced-data edits, new tests/tools, render.yaml drop. This session's recovery (surgical, verified, behaviour-preserving): - Fix app-wide HTTP 500: a `*/` inside a CSS comment killed the stylesheet. - Remove dead get_judge_llm everywhere (judge retired in single-brain rewrite). - eval/run.py: repair imports + hard-guard against stale results.json. - Centralize ~13 hardcoded "40-data" literals to one settings.DATA_DIR (resolves idβ¦b87bd2d -
deploy#2: unified reco-fit gate + session-privacy fix + profile-completeness + full UI rebuildβ
- Reco-fit gate (absorbs #10/#26): product-type + hard-eligibility(entry-age) + required-feature(maternity) + fit-rank + UIN dedup; new policy_identity.py; fixes overall_score rank-inversion. 7-persona audit failures resolved. - Profile session-persistence privacy leak closed (name-keyed directory scan removed; recall now staged + confirmation-gated, fails closed) + single_brain "Are you <name>? yes/no" confirm-prompt. - Profile-form completeness: + desired_sum_insured_inr/smoker/copay_pct/ family_medical_history; ProfileUpdateRequest silent-drop closed. - Full premium UI rebuild (front-page design system): profile panel, chat/AI replies, cited cards, marketplace, compare modal, scorecard/premium widgets; Live(BETA) real warning modal; front-page proseβbullets. - 117 backend tests pass; frontend production build clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>b134f5b -
data+scoring: verbatim-source all policy_facts, recalibrate scorecard, fix recommendationβ
- Re-sourced ~2900 cells to verbatim PDF clauses (v1/v2/v3 fleets); 0 fabrication, 0 legacy-provenance, ~250 wrong values corrected; image-only Acko cells dropped. - Removed max_renewal_age from scoring (IRDAI lifelong is universal); root-caused 999. - Recalibrated 6 sub-scores + thresholds: real A/B/C/D/F spread (was ~90% B); fixed-benefit N/A reweight. - #9 citations = exactly the prose-named policies (no slice cap). - #10 eligibility gates (no top-up for first-timers, zero-copay, SI floor) + profile-fit rank. - Voice TTS silent-failure surfaced + codec fix; 14 dead source URLs replaced. - scorecard/compare/bulk now merge corrected policy_facts (divergence fix). - 62/62 tests; two-part verify: 4113 verbatim-verified, 66 documented residual, 0 fabrication. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>7081aaa
-
feat(profile+pricing+voice): KI-275 β F-bundle: smoker + recap-verify + premium scope + price consolidationβ
F2 β Smoker slot end-to-end (KI-275): - needs_finder.Profile: smoker: Optional[bool] field - brain_tools._ACCEPTED_FIELDS + SLOT_UNION extended (now 16 slots). _coerce_smoker accepts yes/true/smoker/tobaccoβTrue, no/non-smokerβFalse, empty/unclearβNone. - single_brain SYSTEM_PROMPT RULE 2.5 item 7: ask "Do you smoke or use tobacco?" Save smoker: save_profile_field(field="smoker", value="yes"/"no"). - premium_calculator bulk_estimate threads smoker_mult (1.4Γ when True) through both curated-anchor + flat-base paths. Surfaces smoker_loading_x + smoker_loading_reason in breakdown when !=1.0. - Premium delta: 35yo metro 10L SI no-PED β βΉ11,500 β βΉ14,300 (+24% via curated 1.35Γ) / βΉ9,000 β βΉ12,600 (+40% flat fallback). F3 β Recap-vs-reality fix: - single_brain RULE 4 new "RECAP VERIFY" sub-section: forbids recapping slots not actually saved via save_profile_field. Worked example for the diabetes/family_medical_history split (don't conflate them). - main.py post-turn confirmβ¦a7d8209 -
fix(ux+voice): KI-274 β landing page enterprise redesign + Sarvam 429 friendly errorβ
Two parallel bundles committed together: A β Landing page enterprise 3-section redesign (frontend/src/app/page.tsx): - Removed: 4 example suggestion chips ("nonsense"), yellow standalone callout "Tell me the truth", "You can type below" narrative, "166 policies" standalone line, header EN/HI lang toggle (already removed in KI-257). - Section 1 "How this works": 3-step grid with numbered teal circles β (1) ask Qs β profile, (2) match 150+ policies, (3) customised premium estimate. Lightbulb icon header. - Section 2 "Using the bot": 4-mode card grid β Type / Push-to-talk / Hold SPACE / Live (BETA). Mic icon header. Note about Sarvam TTS + Hindi. - Section 3 "Two things before we start": 2 callouts side-by-side β Left (amber/teal): "Tell me the truth, even on hard things" (absorbed yellow callout). Right (muted): "Speaking to the bot" β speak slowly, English OR Hindi, the bot mirrors. Shield icon header. - Visual: rounded cards with subtle borders + shadows, hero gradientβ¦ce7f6d0 -
fix(types): KI-270 β Frontend UserProfile schema add 3 missing slotsβ
Closes the typing gap D1 flagged after KI-269: backend added desired_sum_insured_inr (B5), copay_pct (D2), family_medical_history (D2) to the Profile dataclass, but the frontend TS type was lagging. frontend/src/lib/api.ts: - UserProfile.desired_sum_insured_inr?: number (B5/KI-258) - UserProfile.copay_pct?: number (D2/KI-269) - UserProfile.family_medical_history?: string[](D2/KI-269) frontend/src/app/page.tsx::PremiumCalculatorPanel: - SI prefill now prefers desired_sum_insured_inr (the canonical target) over existing_cover_inr (D1's typed-proxy fallback), with 1_000_000 ultimate fallback. Closes the typed-proxy workaround. Verification: - npx tsc --noEmit: clean - npx next build: Compiled successfully, 4/4 static pages generated - desired_sum_insured_inr now referenced in both api.ts type + page.tsx prefill Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>dab7341 -
feat(profile+pricing): KI-259..KI-266 β B-bundle (compare modal + per-policy + scorecard + premium band + budget/SI + union + persistence + recall)β
B1 β Structured recommendation cards + Compare modal - NEW frontend/src/components/PolicyCompareModal.tsx: side-by-side compare for up to 3 cited policies. Each column = insurer logo + policy name + premium-calc slot + scorecard slot + policy details expandable + PDF. - page.tsx Message renderer now uses CitedPolicyCards (replaces flat PolicyChipsFromCitations). "Compare all" pill opens the modal when >=2 cited policies present. Removed dead PolicyChipsFromCitations (-67 LOC). B2 β Per-policy premium widget with sliders + profile defaults - NEW frontend/src/components/PolicyPremiumWidget.tsx: SI/tenure/deductible sliders, 300ms debounced fetch, AbortController cleanup, profile-summary line, "Estimate" badge when assumed=true, breakdown bullets. - backend/premium_calculator.py + main.py /api/premium/bulk: multiplicative model (base x SI x age-band x location x family x tenure x deductible). Anchors to illustrative_premiums.json when available (assumed=false); flat heuβ¦f6901d8 -
fix(closure+voice+latency): KI-253 β P-bundle from U1 fails (P2 watchdog + P3 mark_rec gate + P4 instrumentation)β
U1 Playwright re-test surfaced 4 remaining bugs after V-bundle landed. P-agents diagnosed + fixed: P1 β React #418 hydration: NO CODE CHANGE. V3 fix at page.tsx:229-232 + 357-363 (mounted flag gating micPermissionDenied) is correct + committed (52e5881). P1 local rebuild + serve produces zero #418 errors. U1's failure was a stale Next.js cache on HF Space β KI-252 redeploy will refresh. P2 β Voice "green pill, zero audio" silent failure (V4 incomplete): V4's catch worked for hard rejections (NotAllowedError), but TWO silent paths bypassed it: (a) Fake / silent stream β getUserMedia resolves but recorder.state never reaches "recording" (Playwright fake-mic, Android WebView, codec rejection). No error thrown, pill flipped to "Voice on" over dead stream. (b) OS-stalled getUserMedia β locked-down Chromium / mic-busy / WebViews leave getUserMedia pending forever instead of rejecting. V4's catch never fires; user sits in limbo. (c) PTT path bypassed the banner entirely β stβ¦8a7350c -
fix(ux+voice): KI-252 β align profile bar with Path B 7-slot ready gate + RULE 4 implicit confirmation + ZCR scalingβ
Root-cause of "70% DONE despite all data" + "Let me pause for a second": 1. Profile completeness bar mismatch (Q2 from user screenshot 59): - scorecard.py:profile_completeness checked 9 weighted fields: age 20% + dependents 15% + budget_band 15% + existing_cover_inr 10% + primary_goal 10% + location_tier 10% + health_conditions 10% + income_band 5% + parents_age_max 5% = 100%. - Path B's _REQUIRED_FOR_READY = (name, age, dependents, location_tier, income_band, primary_goal, health_conditions) β 7 slots. - So a fully captured Path B profile (Priya) shows only 70%: age (20) + dependents (15) + primary_goal (10) + location_tier (10) + health_conditions (10) + income_band (5) = 70%. The 30% gap is budget_band/existing_cover_inr/parents_age_max that Path B doesn't gather (intentionally β budget can be inferred from income). - FIX: re-weighted scorecard.profile_completeness to the 7 Path B slots: age 20% + dependents 17% + income_bandβ¦bcf9753 -
fix(closure+hydration+voice+admin): KI-248..KI-251 β V1-V4 bundle from Playwright smokeβ
V1 β recommendation closure ("I lost my train of thought"): ROOT CAUSE was a coercer/null-guard collision, NOT MAX_ITERATIONS or prompt length. Z6 prompt told Gemini β save_profile_field(health_conditions, "none"), _coerce_health_conditions stripped "none" β [], save_profile_field's KI-091 null-overwrite guard rejected [] as normalized_empty, profile stayed incomplete forever, retrieve looped, MAX_ITERATIONS=5 exhausted, defensive "lost my train of thought" fired. Three-angle fix: - (D primary) brain_tools._coerce_health_conditions: pure-negation tokens ("none", "no", "healthy", "n/a") now collapse to sentinel ["none"] (non-empty list) instead of []. Mixed input ("diabetes, none") still drops the negation noise. Downstream consumers verified safe. - (C) brain_tools.retrieve_policies profile_incomplete return now includes action_required="ask_user_for" + field=<first_missing> + exact_question so Gemini relays the question verbatim instead of looping. - (A) single_brain MAX_ITEβ¦52e5881 -
fix(arch+robustness): KI-225..KI-235 β Path B single-LLM rewrite + audit bundleβ
Architectural simplification (KI-225, Path B) β replaces the two-brain sales_brain/qa_brain handoff with a single Gemini Flash call per turn using native function-calling. Kills 40+ scaffolding failure modes at once: - No fact_find vs QA routing boundary (every confirmation/knowledge edge case in should_route_to_fact_find disappears). - No faithfulness gate rejecting natural phrasing ("yes, that sounds correct"). - No separate profile_extractor pass overwriting captured slots with null (KI-091/094 root cause permanently fixed via save_profile_field tool guard). - No rigid normalizer enum β accepts what Gemini emits, light coerce only. - No 700-token JSON contract β Gemini function-calling separates tool calls from prose, no truncation trade-off. Feature-flagged: USE_SINGLE_BRAIN=true activates the new path; default off, legacy orchestrator preserved as fallback. SingleBrainError falls back to orchestrator transparently. New files: - backend/single_brain.py β Gemini function-calβ¦f15911b -
fix(voice+recall): KI-214 + KI-217 + KI-218 bundleβ
KI-214 β Block recognition for ENTIRE request-in-flight window. Previously dropResultsRef only blocked during <audio> playback (KI-203), leaving a 1-3s gap between send() firing and bot audio rendering+playing where mic captured bot voice from speakers. Now onresult also early- returns when isTextRequestPendingRef is true. Eliminates the entire echo-leak window from user submit until bot finishes speaking. KI-217 β Fix first-phrase cutoff in utterance batching. User showed "My name is Rohit Sarma" reduced to "last name" β start of utterance dropped. Root cause: rec.onend reset finalsRef.current=[] on every restart cycle. Chrome occasionally delivers buffered isFinal=true events for the early speech AFTER onend (same dirty- window quirk that motivated KI-203). Eager wipe meant late finals landed in a freshly emptied ref, then got wiped again before submit. Fix: introduced finalsConsumedRef monotonic cursor. onend reads finalsRef.current.slice(consumed), appenβ¦7fdaa57 -
fix(voice+slots+routing): KI-212 + KI-213 + KI-215 + KI-216 bundleβ
KI-212 β Aggressive barge-in thresholds for reliable trigger. BARGE_IN_RMS_THRESHOLD 0.025 β 0.008. BASE 0.005 β 0.002. MULTIPLIER 2.0 β 1.5. SUSTAINED_FRAMES 18 β 6 (~100ms vs ~300ms). Barge-in fires on much softer speech without requiring calibration. KI-213 β Push-to-talk shows live interim transcript. Added SpeechRecognition in parallel with MediaRecorder during PTT. Interim words stream into chat input as user speaks. On release, Sarvam transcript replaces interim text. Falls back to browser final if Sarvam fails. Self-contained in page.tsx. KI-215 β Don't prematurely flip free_form_session. Bug: once all 6 required slots captured + ready_for_recommendations =true, orchestrator immediately flipped free_form_session=True. User's confirmation reply ("Yes, that sounds correct") then routed to QA β faithfulness rejected with "I'd rather not answer that without stronger evidence." Now require the user's text to explicitly contain a recommendation keyword (shβ¦9a617cc -
fix(voice+llm+admin): KI-200/201/202/203/204/205/206/207/208/210/211 bundleβ
THE LAST OPERATIONAL FIX BUNDLE β voice + recommendation routing + LLM election + admin clarity. Docs cascade held for post-test confirmation. KI-200 β Admin LLM Chain redesigned to 2 clean tables. Table 1 "Currently In Use" (per use case + provider + tier). Table 2 "All Eligible Models" with explicit Primary / 1st backup / Last resort labels. Provider column color-coded (Google blue / NVIDIA green / OpenRouter orange). KI-201 β Election by chain order (not latency score). backend/llm_health.py get_primary + get_backup now walk the chain definition in priority order. Returns first eligible model. nemotron only serves as last resort. Resolves "maverick elected over qwen when all healthy" bug. KI-202 β Utterance batching with 1.5s grace. Mid-sentence pauses < 1.5s accumulate into one submission. pendingUtteranceRef + pendingChunksRef + grace timer per onend. KI-203 β Block recognition transcripts during TTS. dropResultsRef gates onresult while audio plays + 300mβ¦e9cfc9f -
feat(voice+session+llm): KI-195 + KI-196 + KI-197 + KI-199 bundleβ
THE "ONE LAST REBUILD" β adaptive voice calibration + clean session lifecycle + 3 latency cheap wins + Gemini context caching. KI-195 β Adaptive TTS volume calibration vs user speech level. Per user idea: bot TTS should ALWAYS be quieter than user speech at the mic so echo loop is mathematically impossible and barge-in always wins. Implementation: - userSpeechRmsRef: rolling EMA of peak mic RMS while user speaks (recording active, not TTS); rAF loop tracks samples > 0.02 floor. - calibrateBotVolume: every 300ms during TTS, if bot_rms_at_mic > userSpeechRms Γ 0.35, multiply el.volume by 0.8 (floor 0.15). - calibratedVolumes Map persists final levels across turns. KI-196 β Clean session/profile lifecycle (ADR-041). CRITICAL UX fix: silent KI-040 name-based profile recall confused users into thinking the bot was "remembering" them from a prior session. Implementation: - clear_session() in session_state.py (in-memory evict only; on-disk profile JSON untouched). - β¦96ddaab -
fix(critical): KI-194 + KI-192 + KI-191 reinforce β voice + fact-findβ
KI-194 (CRITICAL) β Fact-find routing regression after KI-167. When KI-167 ripped out fact_find_brain, the set_awaiting() machinery went with it. session.awaiting_question_id is now permanently None, which made `in_fact_find_continuation` permanently False at orchestrator.py:469. Result: mid-fact-find answers like "29" (bare number, no fact_find trigger keyword) routed to QA β faithfulness gate fired β bot replied "I'd rather not answer that without stronger evidence in the policy documents I have." with random policy citations. Completely broken conversation. Fix: derive in_fact_find_continuation from profile state directly. We're still in fact-find when free_form_session=False AND any of the 6 required slots (name/age/dependents/location_tier/income_band/ primary_goal) is missing. No need to restore set_awaiting. Verified: empty profile, ff=False β in_continuation=True (route to fact_find) Rohit+age=29, ff=False β in_continuation=True (KI-194 catches this) all 6 slotβ¦e191b1d -
feat(voice): KI-189 + KI-190 + KI-191 β full DIY barge-in stackβ
End-state: live-speak barge-in works WITHOUT echo loop. Bundle of three: KI-189 β Basic VAD barge-in on AEC'd MediaRecorder stream. While TTS is playing (KI-188 paused SpeechRecognition for echo immunity), monitor the MediaRecorder mic stream via Web Audio AnalyserNode + requestAnimationFrame loop. When RMS exceeds the threshold for β₯18 sustained frames (~300ms), pause + reset every bot <audio>; MutationObserver pause listener clears isTtsPlayingRef and the existing heartbeat resumes SpeechRecognition. KI-190 β Adaptive threshold tied to bot audio level. Static threshold (0.025) failed when bot TTS was loud β AEC residual bleed crossed the threshold and barge-in fired falsely. Now per-<audio> MediaElementAudioSourceNode + AnalyserNode reads bot's instantaneous RMS. Threshold = max(BARGE_IN_BASE, bot_rms * 2.0 + 0.005). Loud bot β high bar (you must speak loudly); quiet bot β low bar (soft speech wins). Bot analyser routes source β analyser β ctx.destination soβ¦e84f6a4 -
fix(voice): KI-188 β pause SpeechRecognition during TTS to kill echoβ
User report (persistent across KI-185): bot's TTS still being transcribed as user input ("perfect days to get started Rohit" was echo of bot's "perfect age to get started, Rohit"). Why KI-185 (AEC constraints on getUserMedia) didn't fix it: SpeechRecognition uses its OWN internal mic pipeline that bypasses JS-configured constraints on other getUserMedia streams. AEC applied to MediaRecorder doesn't help SpeechRecognition's interim transcripts that drive the visible input + auto-submit. Fix: MutationObserver on document.body watches for <audio> elements; when ANY <audio> is playing, set isTtsPlayingRef=true and call recognition.abort(). Heartbeat (KI-173) + visibility revival (KI-174) now check !isTtsPlayingRef.current before starting. When TTS ends, trigger immediate safeStart() so recognition resumes within ~50ms. Trade-off: live "barge-in by just speaking" disabled during TTS. Push-to-talk button still works (uses MediaRecorder, not Speech- Recognition). KI-189 follow-up will add β¦52ecbc9 -
fix(voice+admin): KI-185 + KI-186 β AEC echo cancellation + 3-tier adminβ
KI-185 β Browser AEC + noise suppression on every getUserMedia call. User report: mic transcribing bot's own TTS audio as user input. Root cause: our getUserMedia calls used default `{audio: true}` which does NOT force AEC. Production voice agents (Zoom, Meet, ChatGPT voice) all pass explicit AEC + noiseSuppression + autoGainControl constraints. Updated both getUserMedia call sites: - frontend/src/lib/useStreamingVoice.ts (live-voice path) - frontend/src/app/page.tsx (PTT path) Effect: headphone users β near-perfect echo cancellation. Speaker users β 70-90% echo reduction. Live barge-in PRESERVED (no recognition gating on TTS playback). Sarvam STT untouched β the echo was in the Web Speech interim layer, not in Sarvam. KI-186 β Admin "What's Available" now shows all 3 tiers. User: "Both Gemini and OpenRouter need to be captured in this. Whatever is your entire LLM chain, the models you have shortlisted as being eligible, they need to be here." Previously the table only showedβ¦792acb1 -
fix(voice): KI-174 β revive on visibilitychange + window focusβ
User report: "sometimes when I go away from clicking the text box, it seems to not input my voice anymore. I have to restart the whole voice thing." Root cause: Chrome's SpeechRecognition auto-stops when the document loses visibility (tab switch, app switch, screenshot tool, OS modal, notification overlay). The KI-173 heartbeat is throttled to ~1Hz when the tab is hidden, so revival takes 4-8s after returning. Fix: added two immediate-revival event listeners: - document.visibilitychange β visible - window.focus When fired, both call safeStart() if wantRunningRef.current AND no text turn is pending AND document.visibilityState === "visible". InvalidStateError swallowed by safeStart if recognition is already running. Combined with KI-173 heartbeat as a safety net, the mic should stay alive across: - Tab switches β visibilitychange fires - App switches β window.focus fires - Screenshot tool grabbing focus β window.focus fires - Notification overlays clearing β window.focus fires -β¦94aeb46 -
fix(voice): KI-173 β heartbeat watchdog revives stalled SpeechRecognitionβ
User report (verbatim): "voice stopped taking input suddenly until I turned it off and on again." Root cause: browser Web Speech API's SpeechRecognition occasionally enters a stopped state WITHOUT firing the `onend` event. Known triggers include certain network errors, transient OS audio interruptions, and tab-visibility transitions. The KI-168 auto-restart loop lives inside `onend`, so when `onend` doesn't fire, the restart never runs, and the mic stays silently dead until the user toggles voice off+on. Fix: added a 4s heartbeat effect inside useStreamingVoice. While `enabled` is true and no text turn is racing and no restart is already scheduled, call `safeStart()` unconditionally. If recognition is already running, the InvalidStateError is swallowed (per safeStart's existing catch). If it's dead, this revives it within ~4s. KI-165 race guard preserved (isTextRequestPendingRef check) so the heartbeat doesn't fight the text-in-flight path. Verification: `npx tsc --noEmit` clean (eβ¦f84acc7 -
fix(voice+brain+timeout): KI-168 + KI-169 + KI-170 bundleβ
KI-168 β Voice input rebuilt as hybrid streaming flow. + frontend/src/lib/useStreamingVoice.ts (NEW) Web Speech API streams interim transcripts to chat input in real time (ChatGPT/Claude-voice UX). MediaRecorder runs in parallel; on browser silence-detect, audio blob POSTs to Sarvam /api/transcribe for the authoritative final transcript. Replaces input text + auto-submits. Falls back to Web Speech transcript if Sarvam errors. KI-165 race guards preserved (isTextRequestPendingRef + skip-if-tiny-blob). M frontend/src/app/page.tsx Swapped useLiveConversation β useStreamingVoice. interim β setInput, final β send(). Voice OFF by default (KI-131) preserved. Old useLiveConversation.ts left on disk as graveyard. KI-169 β Sales brain <think>-tag empty-reply retry. M backend/sales_brain.py qwen3-next-80b occasionally emits all reasoning inside <think>...</think> in the JSON reply field, leaving nothing after strip β orchestrator fell back to pβ¦1b6d24d -
fix(parser+admin+voice): KI-161 + KI-164 + KI-165 bundleβ
KI-161 β _parse_inr_amount no longer interprets bare digits below βΉ1000 as currency, and rejects any text with age context ("29 years old", "age 25", "I am 35"). Origin: user answered the age question with "I am 29 years old" and the parser wrote βΉ29 into both budget_band and income_band. 10/10 test cases pass (bare-age + real-budget). KI-164 β LLM Chain admin tab radically stripped to ONLY the two simple tables. Removed: Candidate health grid (8 cols Γ N rows of retired models), Recent turns table, Health snapshot card with counters, chains-grid legacy. Restructured "What's Available" Table 2 with per-role columns (Brain Fast / Brain Main / Judge) instead of free-form "Used By" text. refreshChain() now only feeds the 2-table renderer; the legacy fetch* + render* funcs are dead but intentionally left in place (their target elements no longer exist so they're never called). KI-165 β Voice/text crossfire fixed. - useLiveConversation.ts: minVoicedFrames=8 floor (~130ms), voicedFraβ¦0a02616 -
fix(voice+chat+llm+docs): KI-155 + KI-156 + KI-157 + KI-158 + KI-159 + KI-160 bundleβ
Six conversation-pipeline + LLM-chain fixes addressing every live-test defect surfaced today, plus the documentation cascade. KI-155 β enforce <FF> trailer emission. Strengthened fact_find_brain system prompt with absolute final-instruction block + edge-case few-shots ('Hi' β still emit trailer, 'ok' β still emit trailer) so Groq Llama-3.3 (was elected as cross-provider fallback, was silently dropping the trailer) now complies. Smoke: My name is Rohit / I am 29 years old / to buy a health insurance policy β all three return fact_find_brain:: continue, no more ::fallback:no_trailer. KI-156 β fix bot non-response + 'not having any policy' uncaptured. Three sub-fixes: Fix A: extend negation regex in fact_find_normalizer._parse_existing_cover to cover 'not having', 'not got', 'not have', 'without (any|a)'. Fix B: stop-list in fact_find_brain._validate_capture for name field β reject hallucinated names that start with 'currently', 'not', 'no', 'looking', etc. (live bug: LLβ¦1c5baae -
fix(marketplace+voice+routing): KI-136 + KI-141 + KI-142 + KI-143 + KI-144 β full bundleβ
Five distinct fixes shipped together for a single rebuild cycle: KI-141 β hybrid alias dedup. /api/coverage + /api/policies/all now collapse curated marketing-rename entries (Activ One, Optima Secure, etc.) under their PDF-backed parent card, with aliases surfaced as 'Also marketed as:' on the marketplace cards. Frontend page.tsx + api.ts add aliases[] field on MarketplacePolicy. Card count went 158 -> ~137. KI-142 β UIN-primary merge rule. /api/coverage and /api/policies/all now build uin_to_parent maps from extracted JSONs and merge curated entries based on UIN equality. Falls back to source_pdf gate when UIN matches fail. 1 UIN = 1 marketplace card invariant. KI-136 β named-SKU comparison routing. orchestrator.py should_route_to_fact_find now accepts query and exempts intent=comparison when the question mentions >=2 named insurers/SKUs. Empty profile no longer traps SKU-specific compare questions in fact_find_brain. Verified: 'Compare HDFC ERGO Optima Secure and Niva Bupa Aspire β¦63290a7 -
fix(rag+voice): KI-137 + KI-138 + KI-139 β ingest 21 curated policies into Chroma, canonicalize 84 policy names, fix voice VAD thresholds
9c01288 -
fix(voice): KI-134 β 5 blind fixes for silent-fail mic captureβ
Diagnosis agent (run after KI-131's green-pill-on-broken-worklet patch) ranked 5 high-probability additional silent-failure modes. All five patched in one commit since they're all in the same path. 1. AudioContext.resume() β Chrome/Safari autoplay policy starts new AudioContexts in state='suspended' when the click that toggled Voice on has already been consumed by React state propagation. Without resume(), worklet.process() never runs, no PCM frames arrive, green pill renders forever. Patch: explicit ctx.resume() before VAD start; on failure, flip setMicPermissionDenied(true) + setLive(false). (useLiveConversation.ts) 2. PTT silent-recording UX β pre-fix, blob.size < 1000 returned silently with zero user feedback. Now surfaces 'Didn't catch any audio β try holding the mic button while speaking.' (page.tsx) 3. PTT teardown race β 120ms wait between setLive(false) and getUserMedia isn't enough on HF Space's cpu-basic hardware to let AudioContext.close() (β¦e5b5e6c -
fix(voice): KI-131 β voice OFF by default + surface AudioWorklet failureβ
Two bugs reported on live HF Space after KI-130 deploy: Issue A β voice mode shows green 'Voice on β just speak' pill at page load even for users who never opted in. Root cause: the useEffect in page.tsx rehydrated insurance_live_pref from localStorage and flipped userPrefersLive to true if a prior session had set it 'on'. Combined with ADR-028's 'Default ON' decision, anyone who'd ever visited had a sticky-green pill. Fix: remove the rehydration entirely + wipe the stale key on every load. Voice is now strictly opt-in per visit until the user clicks the pill. The persist-on-toggle effect at L210 still writes the user's *current* choice, but no one starts green. NOTE: this amends ADR-028; an ADR-033 should be written to record the new default β flagging as a follow-up. Issue B β voice was on but the mic captured nothing. Root cause (most likely per voice-diagnosis agent): AudioWorklet.addModule() can fail silently on some browsers/devices; the previous catch block at useLiveConversaβ¦a6115b2
-
fix(voice): KI-113 + KI-114 + KI-115 β reject background noise, distant speech, mid-thought pausesβ
User reported Live mode triggering on background noise + cutting off mid-thought when pausing to think. Tightened all four VAD knobs: KI-113 (background noise rejection): - rmsThreshold 18 β 26 (~44% higher floor) - speechStartFrames 3 β 5 (~80ms sustained, no single-spike opens) - voiceBandMinProp 0.35 β 0.50 (FFT energy must be clearly voiced; HVAC/traffic scores 0.20-0.30, speech scores 0.40-0.70) KI-114 (proximity gate / distant speech rejection): - adaptive multiplier 2.0+4 β 2.5+6 - Distant speech rides just above ambient (high frequencies attenuate with distance). Close-in speech is 10-20Γ ambient so it still clears the wider gap; distant conversation gets rejected. KI-115 (pause tolerance / don't submit mid-thought): - silenceEndFrames 120 β 180 (~2s β ~3s) - Tradeoff: +1s tail latency before bot responds. Accepted to kill the "submit when I pause to think" UX bug. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>cdf5ea5 -
feat(profile): KI-077 β Name field + show current captured profile in Build-your-profile panelβ
User screenshot: the "Build your profile" sheet showed empty defaults (Just me / None / etc) even when the chat had captured the user's name, age, dependents, city, etc. Also no name input β user can't introduce themselves through the UI, only through chat. Fix: - backend/main.py β added `name` to `profile_dict` in BOTH /api/profile/ completeness AND /api/profile (POST) so the captured name flows to the UI + the panel can save a new name. Added `name` to ProfileUpdateRequest + in the loop that applies request fields. On name set, also persists to the named-profile JSON store (40-data/profiles/<persona_id>.json) so a returning visitor's profile auto-loads next time. - frontend/src/lib/api.ts β added `name` to UserProfile type. - frontend/src/app/page.tsx β ProfileBuilderPanel: β’ New `name` state + text input at top of the form with "captured from chat" badge when initialProfile.name is set. β’ useEffect to keep state in sync if initialProfilβ¦2bb3898 -
docs: KI-071 β reconcile docs with code reality (Qwen 80B / Nemotron 30B / Mistral 675B as current primaries)β
Source-of-truth audit found the production code on `main` runs Qwen 3-Next 80B (brain primary) + Nemotron Nano 30B (fast brain primary) + Mistral Large 3 675B (judge primary) per the D-022 inline brain swap on 2026-05-14 (NIM DeepSeek + Llama-4 Maverick pools were timing out for hours). The ADR-019 decision text + multiple docs still referenced DeepSeek V4-Pro / V4-Flash + Llama-4 Maverick as primaries. This commit aligns 12 files with the actual chain definitions in `backend/providers/nvidia_nim_llm.py`. DeepSeek V4-Pro / V4-Flash + Llama-4 Maverick are correctly documented now as **fallback chain entries** that re-enter rotation when NIM's pools recover. Files reconciled (+64 / -45): - `README.md` β Β§1.2 "Honest model picks" paragraph + Β§4.3 Model stack table rewritten. Heavy brain row now: "Qwen 3-Next 80B *or* Groq Llama-3.3-70B (50/50 rotation)". Fast brain: "Nemotron Nano 30B". Judge: "Mistral Large 3 675B". Full fallback chains documented. - `70-docs/60-decisioβ¦2e60476 -
fix(voice): KI-064 β silence-end window 90 β 120 (~1.5 s β ~2 s)β
User: "cut off and submitted before the last word" after saying "Hi, I'm looking to buy a new insurance ...". KI-060's 1.5 s was still tight enough to swallow the natural thinking pause before "policy" / "plan". Bump to 120 frames (~2 s). Trade: ~0.5 s extra tail latency before the bot starts responding, but no more dropped tail words. Single config change in DEFAULTS; opt-overridable via opts.silenceEndFrames. History of this knob: v1 (KI-057, 2026-05-15): 40 frames (~640 ms) β too tight. v2 (KI-060, 2026-05-15): 90 frames (~1.5 s) β still cut "insurance .. policy". v3 (KI-064, 2026-05-15): 120 frames (~2 s) β covers normal thinking pauses. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>4c6215a -
feat(profile + voice): KI-059 / KI-060 / KI-061 / KI-062 β opening-turn name capture, looser VAD silence, personalized welcome-back, unique persona IDβ
Four user-testing fixes landed in one commit. KI-059 β Catch name disclosed in opening message βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ User typed "Hi this is Rohit" as the very first message; bot still asked "what should I call you?". Now an opening turn that contains a self- introduction routes straight into the name-slot handler. - New `_contains_self_introduction(text)` helper. Strips leading greetings ("hi", "hello", "hey", "namaste", "yo") then matches "I'm X" / "I am X" / "this is X" / "my name is X" / "name is X" / "call me X" / "name's X". - Tested 10/10 (positive + negative cases pass). - When detected on turn 0, orchestrator synthesises `session.awaiting_question_id = "name"` so the existing name-slot pipeline (extract, save, welcome-back lookup) runs. - Name-handler prefix loop widened: now strips leading "hi[,]? " / "hello[,]? " / "hey[,]? " / etc. BEFORE the "this is " / "i'm " / etc. loop, so "Hi, this is Rohitβ¦e610ee9 -
feat(voice): KI-057 β noise-robust Live VAD + flush-on-stop; KI-058 β scope lib/ ignore to venvsβ
KI-057 β Live mode VAD hardening (useLiveConversation.ts) βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ User report: "Background noise continues to play a big issue, even random noise without people speaking or just ambient noise keeps the live listening on, and it keeps processing on something and not moving on. Also, if an entire series of things have been said and I turn off the live chat, should that not auto submit?" Root causes: - Static rmsThreshold: 18 triggered on HVAC / fan / traffic noise. - Once triggered, silenceEndFrames: 40 never accumulated because ambient kept the meter above threshold β segment never closed. - tearDown() silently dropped speechBufferRef when Live was toggled off mid-utterance. Six layered fixes (all overridable via opts; tuned defaults shipped): A. Adaptive noise floor β EMA of ambient avg while idle. Effective threshold = max(rmsThreshold, noise_floor * 2 + 4). HVAC keeps the bar high. B. Voice-band spectraβ¦23a6d29 -
feat: KI-044 PCM pre-roll via AudioWorklet + 11 folder READMEsβ
KI-044 β Proper first-word capture in Live mode. Previous MediaRecorder approach started recording only AFTER VAD declared speech-start, missing the first 50-100 ms of the opening word. User report: "ensure that the first word uttered is also captured, especially in live." New approach (frontend/src/lib/useLiveConversation.ts): β’ Inline AudioWorkletProcessor (Blob-URL registered, no static asset routing) taps the raw PCM from the mic source. Every render quantum (128 samples) is posted to the main thread as Float32. β’ Main thread maintains a circular preroll buffer (~300 ms at the AudioContext sample rate) while no utterance is in progress. β’ When VAD fires speech-start: snapshot the preroll into the active utterance buffer; continue accumulating subsequent samples. β’ When VAD fires silence-end: encode utterance as 16-bit PCM WAV (Sarvam Saarika native format) and post to onUtterance. β’ Worklet stays running via source β workletNode β silentSink (zeroβ¦86fcc31 -
fix(voice): KI-041/042 β VAD sensitivity + Live OFF by default + dots on first turnβ
KI-041 β VAD threshold tuned for real-world barge-in. User reported "speaking over the bot doesn't interrupt" despite KI-030's in-DOM audio fix. Root cause was VAD insensitivity: rmsThreshold 28 (0-255 byte scale) was too high for typical conversational volume β VAD didn't fire, so interruptBotAudio() never ran. Lowered to 18 (catches normal speech, still rejects breathing / keyboard / room hum) and speechStartFrames from 5 β 3 (~48ms vs ~80ms; cuts barge-in latency). KI-042 β Live is OFF by default. User feedback: always-on mic was "a huge problem β user can't control when to speak, can't control background noise." Initial state is now grey pill "Voice off β click to enable always-on". Preference still persists in localStorage("insurance_live_pref") so returning users who DID opt in see Live on. Only "on" persists explicitly; default and "off" both render grey. Updated copy: β’ Pill: "Voice off β click to enable always-on" (was "click to turn on, or use π€") β’ Empty-state herβ¦748ce54 -
fix: KI-018..022 β routing, profile telemetry, NIM timeouts, judge JSON, chat clearβ
Five interlocking enterprise-readiness fixes plus a master audit report. KI-018 β orchestrator.py: stop force-routing QA intent to fact-find when the session profile is empty. The KI-013 guard was over-correcting: every QA question ("What's the waiting period for PED in Activ Assure?") was being answered with "Happy to help. First, your age?". Restrict the empty-profile guard to {recommendation, comparison} intents only. 5-Q post-fix smoke: factual accuracy 0% β 60%; nim-chain serving 100% of QA (was 0%). Full re-eval owed. KI-019 β orchestrator.py: populate TurnResult.profile_updates from the fact-find branch (previously only the free-form branch populated it). The 100-persona audit appeared to show age captured for only 12/100 personas when the slot-filler was actually working β confirmed by the fact_find_complete readback "42 years old; covering self+spouse+kids+ parents; income 25L+". This was a telemetry bug, not a slot-filler bug. KI-020 β main.py / session_state.py / frontendβ¦bcb7079 -
fix(ux): cold-start retries + retry-intent handling + insurer-prefixed citationsβ
Three bugs visible in the 2026-05-14 mobile screenshot: Bug A β "Sorry β backend error: Load failed" HF Space cold-starts after ~15min idle take ~50s; Safari's fetch surfaces this as a generic TypeError. Fix: api.ts adds _fetchWithRetry with exponential backoff (1.5s, 3.5s, 7s). 502/503 and network errors retry up to 3x; AbortError (Live-mode barge-in) is NOT retried. onRetry callback surfaces "Connection slow β retryingβ¦" status. Final chat message on failure now suggests "say 'try again'" instead of "Load failed". Bug B β "Sarvah Param" rendered as unattributed citation ManipalCigna Sarvah-Param is a real policy; chip showed only policy_name. Fix: PolicyChipsFromCitations renders insurer_slug as kicker above the name. "MANIPALCIGNA / Sarvah Param" β clear provenance, mobile-friendly. Bug C β "Try again" got refused by Gate 1 "Try again" has no policy context so retrieval found nothing β Gate 1 refused. Fix: page.tsx tracks lastSubmittedTextRef and _isRetryIntβ¦f81328f