Re: Sqlite/Postgres in the OH-app-server Do I und...
# proj-sdk
c
Re: Sqlite/Postgres in the OH-app-server Do I understand correctly, is the intention here to have, for conversations metadata: • sqlite persistence in OH-app-server • postgresql in enterprise-app-server • no file-based persistence for OH-app-server => same persistence interface / code ? • exception: first migration • next migrations would be the same OpenHands review about postgres in OH-app-server: • Missing drivers in the main app package and image ◦ Root pyproject.toml (openhands) does not depend on asyncpg or pg8000, and the app container (containers/app/Dockerfile) doesn’t install them. With DB_HOST set, create_engine/create_async_engine will try postgresql+pg8000 / postgresql+asyncpg and fail at runtime due to missing modules. • Password handling bug in connection URLs • openhands/app_server/services/db_service.py builds URLs with f'...:{self.password}@...', but password is a pydantic SecretStr. This formats into "SecretStr('**********')" instead of the real password, so connections will fail. • Affected in: • get_async_db_engine: postgresql+asyncpg//{self.user}{self.password}@... ◦ get_db_engine: postgresql+pg8000//{self.user}{self.password}@... • Broken GCP Cloud SQL async path ◦ _create_async_gcp_engine passes creator=self._create_async_gcp_creator(), but _create_async_gcp_creator is async. Passing a coroutine to creator is incorrect; SQLAlchemy expects a callable returning a DB-API connection (see the working pattern in enterprise/storage/database.py which wraps with await_only and uses a sync creator). • Potential event-loop pooling issue ◦ The enterprise implementation uses NullPool for async to avoid loop issues; the app server’s async engine doesn’t, which can cause “Task got Future attached to a different loop” in some setups. What does appear ready: • The enterprise service (enterprise/*) does include dependencies (asyncpg, pg8000, psycopg2-binary) and a correct Cloud SQL integration pattern. That part looks wired for PostgreSQL. Summary: Enterprise-side PostgreSQL likely works; the OpenHands app server’s PostgreSQL path is not ready due to missing dependencies, incorrect password interpolation, and a broken GCP async creator.
But that wouldn't work this way, because it actually means Postgresql will work in OH
On the other hand, there's a little strange thing here: people have occasionally asked for database in OH, but I'm pretty sure that what they was asking about was events, not metadata 🫠
Cc: @straight-sundown-84319 I propose a few fixes for postgres here, maybe something like this https://github.com/All-Hands-AI/OpenHands/pull/11267 And
conversation metadata
, idk, it seems like the migration doesn't have it? https://github.com/All-Hands-AI/OpenHands/pull/11266