Feature - User Isolation - #93
Open
saharannaveen wants to merge 9 commits into
Open
Conversation
- Add deleteMemory, deleteAllMemories, deleteRule, deleteAllRules API functions - MemoryList.tsx and RulesEditor.tsx now call backend API on delete - Use JWT sub claim for user identification instead of preferred_username
- /memory command: typing "/memory <text>" in chat saves to backend DB - createMemory() API function added to agent-rest.ts - MemoryList.tsx: add-memory now syncs to backend API - Fix: cancel active stream when navigating between chats - Fix: reload thread state from backend when returning to a chat that only has human messages (stream was cancelled mid-flight)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enforce per-user data isolation across all API surfaces — threads, checkpoints, feedback, token usage,
personalization (memories/rules), and memory consolidation
Add thread deletion endpoint that purges all associated data (checkpoints, feedback, token usage), not
just the thread row
Prevent user_id spoofing by always extracting identity from JWT, never from query params
Add Locust load test suite to validate isolation under concurrent multi-user load
What changed
Core isolation enforcement
Personalization REST API (GET/POST/DELETE /memories, /rules) scoped by JWT sub claim
Decay scoring, consolidation, and clustering SQL queries scoped with AND user_id
Feedback endpoint overrides user_id from JWT (prevents spoofing via query param)
Token-usage endpoint now requires authentication
Cache invalidation on memory/rule deletion (was missing; Redis failure no longer causes 500)
Thread deletion cleanup
Custom DELETE /threads/{id} purges checkpoints, feedback, and token usage records
Previously only thread metadata and runs were deleted by Aegra's default handler
Integration tests
12 live integration tests against real Postgres validating cross-user isolation for threads, runs,
checkpoints, feedback, and token usage
Unit tests
27 user isolation tests with in-memory fake DB
5 thread cleanup tests
Load tests
Self-signed JWT provider with JWKS server for Locust virtual users
IsolatedUser scenario with 6 tasks: create thread, chat, list threads, cross-user visibility, feedback
isolation, delete thread
Configurable load profiles (smoke, load, stress, soak)
Test plan
27 unit tests for isolation enforcement (in-memory fake DB)
5 unit tests for thread cleanup
12 integration tests against real Postgres
Locust smoke test against staging (locust -f tests/load/isolation_locustfile.py --tags smoke)
Manual: create thread as user A, verify user B cannot see it via GET /threads
Manual: delete thread, verify checkpoints and feedback are also purged