Skip to content

Add user simulation and impersonation support for Addie - #390

Merged
bokelley merged 3 commits into
mainfrom
bokelley/addie-user-simulation
Dec 30, 2025
Merged

bokelley merged 3 commits into
mainfrom
bokelley/addie-user-simulation

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Implement WorkOS impersonation detection and audit logging to support debugging user issues in production. Admins can now impersonate users, chat with Addie as them, and view their full member context in the admin UI.

Changes

  • Impersonation Detection: Detect WorkOS impersonation sessions in auth middleware and expose via /api/me
  • Web Chat Enhancements: Show impersonation banner and add rich member context (org, subscription, engagement, working groups, Slack activity)
  • Admin Context Viewer: New modal in admin users tab to inspect any user's member context as Addie sees it
  • Audit Logging: Track impersonated conversations and messages with admin email and reason in database
  • Comprehensive Tests: Unit tests for context formatting (20 tests), integration tests for API and audit logging

Test Plan

  • ✅ TypeScript type checking passes
  • ✅ All schema validation tests pass
  • ✅ All documentation tests pass
  • ✅ All existing unit tests pass
  • ✅ New member context unit tests pass (20 tests)
  • ✅ Git pre-commit hook tests pass

🤖 Generated with Claude Code

bokelley and others added 2 commits December 30, 2025 06:50
Implement WorkOS impersonation detection and audit logging for debugging user issues in production. Admins can now impersonate users, chat with Addie, and see rich member context. Includes admin UI to view any user's context as Addie sees it.

Features:
- Detect WorkOS impersonation sessions in auth middleware
- Show impersonation banner in web chat when active
- Add rich member context to Addie web chat (org, subscription, engagement, working groups)
- Create admin users tab context viewer modal to inspect user details
- Add impersonation audit logging to addie_conversations and addie_messages tables

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
- Add AddieDatabase import and instance back to member-context.ts
- Restore addie_history property in MemberContext interface (needed for web chat)
- Rename migration 048 -> 050 to avoid conflict with main branch
- Add changeset for PR versioning

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@bokelley
bokelley force-pushed the bokelley/addie-user-simulation branch from 3a8a609 to 3035175 Compare December 30, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant