calm-artist-7206
10/06/2025, 8:09 PMwooden-umbrella-84098
10/06/2025, 8:28 PMstraight-sundown-84319
10/06/2025, 8:48 PMif shared_instance filter_by_user on each call to a service. For single user cases, we create a root user and use the same logic.
This works quite well for cases like app_conversation_router.py - we list conversations owned by the user, (And we are able to do the filtering in sql rather than pulling everything from storage and doing it on the app server). When we created a conversation it is associated with the current user. It meant I was able to use our existing authentication mechanism transparently without altering anything.
Quite rapidly after this, it became apparent that there are cases where unconstrained data is also required. (For example, the webhook_router.py needs to grab a sandbox to see if the session_api_key given matches it. This is where the unsecured resolvers come in.
Now that I think of it though - this case is unique to authentication, so I can probably remove unsecured resolvers for everything except sandboxes.straight-sundown-84319
10/06/2025, 8:49 PMstraight-sundown-84319
10/06/2025, 8:56 PMroot.straight-sundown-84319
10/06/2025, 9:06 PMstraight-sundown-84319
10/06/2025, 9:15 PMcalm-artist-7206
10/06/2025, 9:44 PMUserContext that will encapsulate "user_id" and other user-specific things, maybe paths in V0, maybe containing tokens or a class that does something similar for tokens. The idea underlying these is really the same idea you already implemented with TokenSource 🙏
I think you said you liked it 😊 I am hoping we can apply it here! Because I do think it would work on V0, I even drafted some initial PR to look at the code and make sure I'm not missing things, and if that is so, idk, is there a reason why something like that wouldn't work on V1?
It was this stuff (sorry it's a lot of stuffs): https://github.com/All-Hands-AI/OpenHands/issues/10850straight-sundown-84319
10/06/2025, 9:47 PMcalm-artist-7206
10/06/2025, 10:13 PMwooden-umbrella-84098
10/06/2025, 10:17 PMcalm-artist-7206
10/06/2025, 10:26 PMuser_id lolsobstraight-sundown-84319
10/06/2025, 10:39 PMstraight-sundown-84319
10/06/2025, 10:41 PMcalm-artist-7206
10/06/2025, 11:13 PMcalm-artist-7206
10/07/2025, 1:06 AMif self.host:
url = f'postgresql+asyncpg://{self.user}:{self.password}@{self.host}:{self.port}/{self.name}'straight-sundown-84319
10/07/2025, 1:07 AMstraight-sundown-84319
10/07/2025, 1:07 AMstraight-sundown-84319
10/07/2025, 1:08 AMstraight-sundown-84319
10/07/2025, 1:08 AMstraight-sundown-84319
10/07/2025, 1:17 AMstraight-sundown-84319
10/07/2025, 1:26 AMcalm-artist-7206
10/07/2025, 1:29 AMstraight-sundown-84319
10/07/2025, 1:31 AMstraight-sundown-84319
10/07/2025, 1:32 AMcalm-artist-7206
10/07/2025, 1:41 AMstraight-sundown-84319
10/07/2025, 1:43 AMstraight-sundown-84319
10/07/2025, 1:43 AMcalm-artist-7206
10/07/2025, 1:45 AMBut putting the service criteria in a user info / user context means that object needs to know about every service - which feels more complex rather than less so.Isn’t it the other way around maybe, the service needs to get / know user info / user context, rather than getting a primitive?
calm-artist-7206
10/07/2025, 1:45 AMstraight-sundown-84319
10/07/2025, 2:12 AMstraight-sundown-84319
10/07/2025, 2:12 AMstraight-sundown-84319
10/07/2025, 2:12 AMstraight-sundown-84319
10/07/2025, 2:14 AMdef my_fastapi_endpoint(user_service = Depends(user_service_injector)):
... Do something with the servicestraight-sundown-84319
10/07/2025, 2:16 AMUserServiceManager becomes UserServiceIniector)straight-sundown-84319
10/07/2025, 2:18 AMstraight-sundown-84319
10/07/2025, 2:19 AMstraight-sundown-84319
10/07/2025, 2:19 AMstraight-sundown-84319
10/07/2025, 2:20 AMstraight-sundown-84319
10/07/2025, 2:20 AMstraight-sundown-84319
10/07/2025, 2:21 AMstraight-sundown-84319
10/07/2025, 2:21 AMcalm-artist-7206
10/07/2025, 2:21 AMstraight-sundown-84319
10/07/2025, 2:21 AMstraight-sundown-84319
10/07/2025, 2:21 AMcalm-artist-7206
10/07/2025, 2:21 AMstraight-sundown-84319
10/07/2025, 2:22 AMcalm-artist-7206
10/07/2025, 2:22 AMstraight-sundown-84319
10/07/2025, 2:22 AMstraight-sundown-84319
10/07/2025, 2:22 AMstraight-sundown-84319
10/07/2025, 2:22 AMcalm-artist-7206
10/07/2025, 2:23 AMstraight-sundown-84319
10/07/2025, 2:23 AMstraight-sundown-84319
10/07/2025, 2:23 AM