fix(chat): keep chat history per visitor, not per agent owner #64
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 423 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #64"
general
weight: 0.35
mangeshraut712
Problem (privacy)
/api/v1/chatstored history insessions.get(userId).userId: owner.idandconversationId: agentId.So every visitor talking to any of an owner's agents was appended to one shared transcript. A visitor's messages were sent to the model along with every earlier visitor's messages, which leaks one customer's context to the next and mixes agents together.
Fix
userId:conversationIdwhen a conversation id is given. It still falls back touserId, so existing callers and tests are unchanged.conversationIdis now${agentId}:${visitorId}.visitorIdcomes from the request and must match^[A-Za-z0-9_-]{8,64}$. A missing or malformed id gets a freshcrypto.randomUUID(), so the fallback is "no history", never "shared history".localStorageand sends it.data.data?.response, but the route returns{ reply }, so the widget always showed its fallback text instead of the agent's answer.Tests
Both fail on
main.<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/mangeshraut712/gravity-saas-agent/pull/64" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
<!-- CURSOR_SUMMARY -->
---
<!-- /CURSOR_SUMMARY -->