Support external_ref get-or-create on POST /chat/create
From the PR description
Summary
- Adds an optional
external_reffield toPOST /chat/create. When provided, a repeat call with the same(user_id, external_ref)pair returns the existing chat's id instead of creating a new one. - Lets an external integration (e.g. a Slack thread bridge) key a chat by a stable external identifier without tracking
chat_iditself. - No behavior change when
external_refis omitted.
Test plan
- New tests: get-or-create returns the same id on repeat calls with the same external_ref; a fresh external_ref creates a new chat; omitting external_ref entirely is unaffected (regression check)
-
npx vitest run src/routes/__tests__/chat.test.ts- 3/3 passing - Full backend suite run with no regressions
🤖 Generated with Claude Code
Our analysis
Add idempotent external chat references — read the full analysis →
Think the analysis missed something the PR description covers?
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-371.md from
inside the repo you want the changes in.