-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Feature]: First-class user identity for shared gateways (presence, viewers, attribution, profiles) #111133
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.enhancementNew feature or requestNew feature or requestimpact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.maintainerMaintainer-authored PRMaintainer-authored PR
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.enhancementNew feature or requestNew feature or requestimpact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.Issue quality rating does not apply to this item.maintainerMaintainer-authored PRMaintainer-authored PR
Type
Fields
Priority
None yet
Summary
Make people first-class in a shared (multiplayer) gateway: thread the trusted-proxy-authenticated user identity through connections, presence, and prompt attribution; add durable user profiles (stable id, email aliases, display name, avatar); show who is online and who is viewing which session. Identity is strictly optional — token/password/no-auth gateways behave exactly as today.
Problem to solve
A team can already share one gateway behind Cloudflare Access + trusted-proxy auth (
gateway.auth.trustedProxy): the proxy verifies a GitHub-backed email and the gateway checks it againstallowUsers. But the verified identity is dropped immediately after the allow/deny decision (src/gateway/auth.tsreturnsuserfrom the trusted-proxy/tailscale paths; nothing consumes it). Consequences for shared instances:senderattribution (src/sessions/user-turn-transcript.types.ts).Proposed solution
A PR train, each independently landable, identity optional throughout:
userinto WS connection state; add optionaluser: { id, email?, name?, avatarUrl? }toPresenceEntry; log identity on connect/disconnect.idis opaque: email today, profile id once profiles land. Clients group presence entries byuser.id(gateway keeps one truthful entry per connection).user_profiles(stable id, display name, avatar blob,merged_intotombstone) +user_profile_emails(lowercased alias → profile). Resolver:ensureProfileForEmaillazily creates on first login. Email change: new email auto-creates a profile; adminusers.linkEmailre-points the alias to the person's real profile and tombstones the orphan (merged_into, one-hop resolution) so prior attribution still resolves. RPCs (users.list/linkEmail/setDisplayName/setAvatar) + minimal CLI.watchedSessionson presence entries; Control UI sidebar renders viewer avatars per session row.UserTurnInput.senderfield from connection identity for identified clients. Prompts only; tool calls and agent actions remain the agent's.trustedProxyconfig surface afterdeviceAutoApprove(in flight separately) lands, so there is one decision surface for proxy-user scopes, not two.Alternatives considered
presence.focusclient message for viewing state: deferred — subscription piggyback gives ~90% with no new protocol messages.Impact
Shared team gateways (the documented company-shared-agent pattern). No behavior change for single-user or token/password gateways.
Evidence/examples
src/gateway/auth.ts(~line 525): trusted-proxy auth returns{ ok, method, user };userunused past the gate.packages/gateway-protocol/src/schema/snapshot.ts:14:PresenceEntrySchema(closed object) — device fields only.src/sessions/user-turn-transcript.types.ts: existing durablesender/senderIsOwnerattribution seam, currently channel-only.Do you plan to open a PR for this?
Yes, I plan to implement this myself
Additional information
Maintainer-driven program (requested by @steipete for the shared team instance). PRs land as they go green; this issue tracks design decisions and cross-PR coordination.