Skip to content

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

Open

Description

@mrveiss

Summary

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

  1. Choose one canonical list endpoint and one response envelope.
  2. Reduce /api/chat/chats (or /api/chats) to a deprecated alias/redirect of the other; do not keep two live copies of list_chats.
  3. 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.
  4. 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

  1. modified the milestones: Backlog, v0.12.0 on Sep 12, 2026
  2. added
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Oct 28, 2026
  3. github-actions commented on Oct 28, 2026

    @github-actions
    Contributor

    needs-structure cleared: goal milestone, matching phase label and native parent (or sub-issues) are all present (#19522).

  4. removed
    needs-structureMissing goal milestone, matching phase label or native parent (#19522)
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions