Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use persistable sessions instead of context #1513

Open
dokterbob opened this issue Nov 11, 2024 · 0 comments
Open

Use persistable sessions instead of context #1513

dokterbob opened this issue Nov 11, 2024 · 0 comments
Labels
architecture Overall project architecture. auth Pertaining to authentication. backend Pertains to the Python backend. enhancement New feature or request frontend Pertains to the frontend. needs-triage

Comments

@dokterbob
Copy link
Collaborator

dokterbob commented Nov 11, 2024

Is your feature request related to a problem? Please describe.
A lot of information regarding the user's session is currently stored in context variables. This means that all of this information is currently stored on a smaller-than thread level. That means that our chainlit daemon is stateful -- it's basically stored 'on the websocket'.

This effectively prohibits running multiple instances of chainlit behind a load balancer, as any reconnect will cause the session to be lost.

Describe the solution you'd like
Maintaining state explicitly and reduce state wherever possible.

  1. Reduce state in API: Some parts of our API are stateful (actually, it seems, quite a few). Perhaps some of them don't need to be.
  2. Switch chainlit context to use 'proper' sessions, e.g. as they're normally used in a web context. Perhaps something like fastapi-sessions.
  3. Bonus; strict typing for context's properties.

Describe alternatives you've considered
The alternative is to maintain state fully on the client side and remove all state server-side -- so each request sends the full state to the server. This is more REST-ful but it's a huge leap and requires careful assessment of security implications.

Something like a cookie signed by the JWT.

Additional context

Related issues:

Related resources

@dokterbob dokterbob added enhancement New feature or request needs-triage frontend Pertains to the frontend. auth Pertaining to authentication. backend Pertains to the Python backend. architecture Overall project architecture. labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Overall project architecture. auth Pertaining to authentication. backend Pertains to the Python backend. enhancement New feature or request frontend Pertains to the frontend. needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant