Automattic / Automattic/frontend-agent-chat
Persist logged-out chat sessions with a secure browser principal
- Dominant language
- PHP
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
Frontend Agent Chat can now chat with public/audience-granted agents while logged out, but session history does not persist safely for anonymous visitors. The UI enables sessions, but the server-side session APIs currently require a principal that maps to a WordPress user.
We should not use the insecure middle ground of letting `audience:public` list sessions owned by the agent owner or by the whole public audience.
## Required shape
- Bootstrap an opaque browser principal for logged-out visitors.
- Prefer an HttpOnly, Secure, SameSite cookie so the secret is not exposed to JavaScript.
- Send session list/get/delete requests under that browser principal.
- Keep active agent preference working for logged-out visitors without depending on user options.
- Add a visible path for future account persistence, e.g. “Sign in with WordPress.com to save chat history.”
## Acceptance criteria
- Logged-out visitors can reload the page and see their own previous chat sessions.
- A different browser/session cannot list or read those sessions.
- Logged-in users continue to use normal user-owned session persistence.
- No raw `session_id` is treated as the sole authorization secret.
- The UI behaves gracefully when browser cookies are disabled.
## Related work
- Agents API needs principal-owned conversation sessions.
- Data Machine needs transcript ownership separate from runtime execution user.
- A8C Intelligence can implement WordPress.com login/account-linking for persistence across devices.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the server-side session APIs and the logged-out UI request path, then inspect how principals, WordPress users, and active-agent preferences are currently handled. Done means anonymous sessions survive reloads but remain isolated by browser principal, authenticated persistence is unchanged, raw session IDs do not authorize access, and cookie-disabled browsers degrade gracefully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- authentication, authorization, backend-api-design, full-stack
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100