Session filters by user
Problem: When multiple people colaborate on open-inspect it's easy to loose your sessions.
Solution: Allow to filter sessions by user.
By default show current user sessions, and allow to toggle 'all' / filter by user.
@ColeMurray I think it would be nicer if we would show in my sessions, all sessions the user participated in, but this info is in DO. Wdyt about adding a table which would be an index of user-session that we can easily retrieve there?
If you sent 1 message to a session it will be shown as "My sessions"
hey @ColeMurray, @Bnowako. I am interested in working on this, I did notice that both prior PRs (#599, #600) went creator only and closed silently. want to confirm the design before opening another one. @Bnowako's proposal on this issue is participation based and I think that's the right call.
Proposed design
-
New D1 table
session_participants(user_id, session_id, scm_login, first_seen_at). Composite PK(user_id, session_id), index on(user_id, first_seen_at DESC). Backfilled from existingsessionsrows whereuser_id IS NOT NULL. -
"Participation" means any of: created the session, explicitly added via
POST /participants, or sent ≥1 prompt (WS or API). The prompt case is the load bearing one per @Bnowako's wording. Writes are idempotent (INSERT OR IGNORE) frominitialize.tsand the prompt enqueue paths inmessage-queue.ts. All keyed on canonicalusers.id, resolved viaUserStore.getIdentityfor both botprovider:idprefixes and raw web ids. Read only, never auto creates. -
API:
GET /sessions?mineScmUserId=<id>&mineProvider=<github|slack|linear>plus optional?scmLogin=fallback for pre migration rows wheresessions.user_id IS NULL. Control plane resolves(provider, providerUserId)to canonicalusers.idand JOINssession_participants. Unresolved identity returns an empty page. 400s on empty values or asymmetric params. -
BFF identity flow (the bit #600 got wrong):
sign-in: session.user.id = <github numeric> create: resolveOrCreateUser(github, <num>) = <canonical UUID> → session_participants(user_id=<UUID>, session_id=X) list: BFF /api/sessions?mine=true injects mineScmUserId=<num>&mineProvider=github → getIdentity(github, <num>) = <same UUID> → JOIN matchesBFF strips client supplied identity claims before forwarding. Fails closed (empty page, no upstream call) when
session.user?.idis missing. Fresh session with zero prompts still shows up in "Mine" because the create time write already landed. -
Cross user safety on the scmLogin fallback: legacy branch is gated on
sessions.user_id IS NULL, so a session owned by user A with a typo'dscm_loginof user B never leaks.
Want to confirm a couple of things
- @Bnowako, does "sent ≥1 prompt → My sessions" match what you meant, or did you mean only the explicit add path?
- @ColeMurray, OK with empty page for unresolved identities vs. 404? Felt right since "no sessions for this user" and "user not registered" are both legitimately empty, but want to confirm.
- Worth keeping the
scmLoginfallback at all? Only matters for sessions created before this migration. Happy to drop it if you'd rather not carry that complexity.
@Krishnachaitanyakc I shipped the "sessions started by me" in https://github.com/ColeMurray/background-agents/pull/688.
Sessions I am a part of is a bit more involved as it requires moving some of the properties currently only stored in the DO into D1.
@ColeMurray can I help with "Sessions I am a part of"? Happy to pick up any other issues as well.
Handled by koala73/butler PR #70: https://github.com/koala73/butler/pull/70 (merged 2026-06-17). This upstream issue can be closed now that the Butler fork fix has landed.