Uh oh!
There was an error while loading. Please reload this page.
fix(console-ai): clear plaintext chat cache on logout / user switch - #2485
Merged
Conversation
…d (ADR-0057 A1.b) When the build surface is opened to edit an existing app (?package=X), the empty-state guidance was still the magic-flow 'describe an app to build' copy + from-scratch starters — wrong for editing a bound app. Now the build surface has two empty states, keyed on editPackageId: - magic flow (no ?package=): 'Build with AI' + build-a-CRM/tracker starters. - edit mode (?package=X): 'Editing "<app>"' + 'what would you like to change… I'll modify this app in place' + change-oriented starters (add a field / object / dashboard / automation). App name comes from metadata (editAppLabel); falls back to a generic 'Edit this app' title until metadata loads, so a raw package id (app.xadv) never flashes. agentEmptyState + buildAgentSuggestions gain the edit branch and are exported + unit-tested (8 cases). Empty state stays string-props into ChatbotEnhanced — no plugin-chatbot change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Conversation content + tool payloads are cached in localStorage in plaintext (objectstack:ai-chat-conversation-id:* and :ai-chat-messages:*). They were never cleared on logout, so on a shared machine the next profile user could read the prior user's AI threads (which may contain data surfaced by the ask agent). useChatConversation now purges all objectstack:ai-chat-* keys when the signed-in user changes (defined -> undefined = logout, or u1 -> u2 = switch). A mid-session auth flicker would also purge, but that only forces a harmless server re-fetch. New exported purgeChatCaches() so an explicit logout path can also call it. Unit-tested (purge scope, no-purge-on-initial-mount, logout, user-switch). Refs #2478 (M2). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
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 freeto 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.
Highest-ROI item from the AI-chat subsystem review (#2478, security M2). Refs epic #2409.
Problem
Conversation content + tool payloads are cached in localStorage in plaintext (
objectstack:ai-chat-conversation-id:*pointers andobjectstack:ai-chat-messages:*bodies) and were never cleared on logout. On a shared machine, the next profile user could read the prior user's AI threads — which may contain business data surfaced by theaskagent.Fix
useChatConversationnow purges everyobjectstack:ai-chat-*key when the signed-in user changes:defined → undefined(logout)u1 → u2(a different user signs in)Initial mount never purges (no prior user). A mid-session auth flicker (userId momentarily undefined during a token refresh) would also purge, but that only forces a harmless server re-fetch — the server is the source of truth.
New exported
purgeChatCaches()so an explicit logout path in the auth layer can also invoke it directly (follow-up).Scope / safety
objectstack:ai-chat-*prefixes; unrelated localStorage is untouched (tested).Tests
useChatConversation.test.tsx+4 cases (purge scope excludes unrelated keys; no purge on initial mount; purge on logout; purge on user switch). Full hook suite green (33);tsc --noEmitclean.🤖 Generated with Claude Code