Hey team, I’ve hit a persistent issue regarding user variable state being wiped whenever a custom integration is triggered and a user interaction is triggered, even after upgrading to @botpress/sdk@5.0.0 and @botpress/cli@5.x from 3.2.2.
Whenever my bot flows through a custom integration, and I click a Selection Card or other UI button inside the bot, then all user-scope variables reset to defaults, even if:
-They are simple primitives (e.g., a single string)
-They have a strict Zod schema in the case of objects
-They are not modified by the integration (i.e. integration triggers, but card after set the user vars via code)
-No client.setState() is called anywhere in the integration
I can reproduce this 100% of the time across bots. User var persist when I bypass the custom integration in the workflow.
Integration Testing
-Removed all setState() calls from the integration
-Removed schema complexity (single primitive user vars only)
-Updated to latest CLI + SDK (verified with npx bp --version)
-Cleared node_modules, lockfiles, redeployed clean
Tried new workspace, bots and fresh integrations. Behavior persists.
Observed Behavior
-Conversation scope persists normally
-Workflow scope persists normally
-User scope resets ONLY after a UI-driven event (selection/card)
-Without the integration triggered: user scope works perfectly
-With the integration triggered: user scope wipes immediately on next UI trigger
User scope should persist across events as documented here:
https://botpress.com/docs/studio/concepts/variables/scopes/user
I don’t rely on user scope for functional logic, but it should be usable for lightweight personalization (“welcome back”) or flags. Right now, it’s not safe to use in any bot that installs a custom integration.
If needed, I can provide a video demonstration. Thanks in advance — this one has been tricky to isolate.