Skip to content

NOREF: Conversation storage updates#1013

Open
jackiequach wants to merge 17 commits intomainfrom
NOREF/conversation-id-feature-branch
Open

NOREF: Conversation storage updates#1013
jackiequach wants to merge 17 commits intomainfrom
NOREF/conversation-id-feature-branch

Conversation

@jackiequach
Copy link
Copy Markdown
Contributor

@jackiequach jackiequach commented Mar 16, 2026

SCHOL-453

Describe your changes

Frontend

  • Updates to send single message in the payload for the /chat request.
  • Updates /chat header to forward session cookie.

Backend

  • add agents sdk sqlalchemy session https://openai.github.io/openai-agents-python/sessions/sqlalchemy_session/
  • set up async sqlalchemy session to not share connections btw event loops
  • convert update chat into async container (this allows the natively async agents SDK methods/functions to be used seamlessly in this container)
  • make timer async compatible
  • Adds require_session_jwt decorator that reads the session cookie on each request, verifies the JWT, or issues a new signed session on first visit.
  • Adds session_jwt.py with helper methods to sign and verify sessions.

How to test

Will require updates to end to end smoke tests @jdohan

Frontend/End-to-end

Run the backend locally pointing to the prod db:

cd etl-pipeline
STAGE="development" LOG_LEVEL="debug" DRB_API_HOST=localhost python main.py -p APIProcess -e production

Run the frontend:

cd web
npm run dev

Go to localhost:3000/research-assistant
Send a message and ensure the vraSessionId is created in the browser's session storage.

Check the agent_messages table to make sure the messages associated with the test session ID and agent_sessions

Backend only

from api.assistant.agent import  update_chat
import asyncio

message='I am interested in the nile river'
conversation_type='catalogSearch'
session_id='test'
edition_id = None

r = asyncio.run(update_chat(message, conversation_type=conversation_type, edition_id=edition_id, session_id=session_id))

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
digital-research-books Ready Ready Preview, Comment Mar 27, 2026 6:34pm

Request Review

@bantucaravan bantucaravan mentioned this pull request Mar 17, 2026
@jackiequach
Copy link
Copy Markdown
Contributor Author

Playwright tests will fail on this PR since the backend changes are not yet available on the QA env.

to see if it is causing the test failures
to allow running diagnostic without asyncpg installed

also code comment updates
@bantucaravan bantucaravan marked this pull request as ready for review March 19, 2026 19:28
@alea12
Copy link
Copy Markdown
Member

alea12 commented Mar 27, 2026

@jackiequach could you please resolve the conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants