You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
canonical(chat): 'list chats' served by 3 overlapping endpoints — list_chats mounted at both /api/chats and /api/chat/chats, plus /api/chat/sessions as a 3rd envelope #12371
Listing a user's chats is served by three overlapping endpoints, two of which are the same handler registered at two paths. This is a canonical duplication — one concept ("list my chats") with multiple public representations — not a functional break, but it is the kind of drift that produces frontend/backend confusion and inconsistent behaviour over time.
Evidence (live)
GET /api/chats -> operationId list_chats_api_chats_get 4813 B, data:[{id:48ff124d…}]
GET /api/chat/chats -> operationId list_chats_api_chat_chats_get 4813 B, data:[{id:48ff124d…}]
GET /api/chat/sessions-> operationId list_sessions_api_chat_sessions 1711 B, {sessions:[{id:48ff124d…}]}
/api/chats and /api/chat/chats are the same list_chats logic mounted twice — identical payload shape and size, same underlying IDs. (Body hashes differ only by an embedded timestamp field.)
/api/chat/sessions returns the same underlying objects (same IDs) in a different envelope ({sessions:[…]} vs {data:[…]}) and a reduced field set.
So the same data is reachable three ways, with two different response contracts. A frontend author has to guess which is canonical; #12317 already showed the frontend calling chat paths inconsistently.
Why it matters
Ambiguous contract. Two envelopes for one concept means every consumer picks one arbitrarily, and a change to "the chat list" must be made in two-to-three places or they silently diverge.
Maintenance surface.list_chats mounted at two routes doubles the auth/pagination/filtering surface that must stay in sync.
Per the canonical rule (one concept, one endpoint): pick the authoritative representation, redirect or deprecate the aliases, and converge the sessions vs chats envelopes.
Recommendation
Choose one canonical list endpoint and one response envelope.
Reduce /api/chat/chats (or /api/chats) to a deprecated alias/redirect of the other; do not keep two live copies of list_chats.
Decide whether "session" and "chat" are genuinely distinct concepts or two names for one; if one, unify the endpoints and models. If distinct, document the difference so the overlap in IDs is not mistaken for duplication.
Regenerate the frontend types against the chosen contract.
Scope note — chat is otherwise healthy
Unlike the analytics surface, chat has no dual-store / empty-cache / slow-compute pathology: /api/chat/sessions and /api/chat/stats respond in <0.25 s, /api/chat/health is healthy, and session CRUD works. The known chat-affecting defects are the cross-cutting ones already filed — #12313 (:8443/CSP blocking chat creation and voice), #12340 (global WebSocket dead path), #12327 (failed-delete divergence) — not chat-module logic. This issue is the one chat-local finding, and it is hygiene, not breakage.
Environment
install.sh deploy at /opt/autobot; deployed tree matches origin/Dev_new_gui. Endpoints verified live.
Activity
github-actions commentedon Oct 28, 2026
needs-structurecleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).