open-webui / open-webui/terminals
feat: Clean up orphaned persistent workspace data when a user is deleted in Open WebUI
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 108
- Forks
- 23
- Avg merge
- 12h 8m
- Merged PRs (30d)
- 1
Description
When a user account is deleted in Open WebUI, their persistent terminal workspace on the orchestrator host is never removed. On the Docker backend this is TERMINALS_DOCKER_DATA_DIR/<user_id> (plus <user_id>/contexts/ for per-chat contexts); on Kubernetes it's the per-user PVC. The orchestrator only learns about users at request time (JWT validation against Open WebUI), so a deletion is invisible to it and the data persists indefinitely.
Why
Data retention / GDPR-style policies require that a deleted user's personal data be deleted too. Today an operator has to manually find and delete the directory, which is easy to miss and leaves no audit trail.
Suggested approach
- Periodic reconciliation in the reaper sweep: list workspace roots under the data dir (or per-user PVCs on K8s) and compare against the current Open WebUI user list (GET /api/v1/auths/ in JWT mode; for API-key mode, document that operators must supply the list or accept manual cleanup).
- Quarantine before delete: move orphaned dirs to a quarantine/ location with a grace period (e.g. new setting TERMINALS_ORPHAN_RETENTION_DAYS, default 30) so accidental deletions and account re-creation are recoverable.
- Log every quarantine/deletion (user id, path, size, timestamp) for audit.
- Optional admin API + admin UI button: POST /api/v1/terminals/orphans/cleanup with a dry-run flag.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the reaper sweep and the Docker/Kubernetes workspace lifecycle paths. Review the GET /api/v1/auths/ user-list flow in JWT mode and the API-key-mode limitation, then clarify quarantine, retention, audit logging, and the optional POST /api/v1/terminals/orphans/cleanup endpoint. Done means orphaned directories and per-user PVCs are handled safely with recovery and audit evidence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, kubernetes, python
- Domain
- backend, infrastructure, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100