Skip to content

feat: pass chatbot_is_staff to lc-chatbot widget#3149

Draft
dcschreiber wants to merge 2 commits intomasterfrom
feature/sc-42362/distinguish-between-staff-prompts-and-public
Draft

feat: pass chatbot_is_staff to lc-chatbot widget#3149
dcschreiber wants to merge 2 commits intomasterfrom
feature/sc-42362/distinguish-between-staff-prompts-and-public

Conversation

@dcschreiber
Copy link
Contributor

Summary

  • Computes is_chatbot_staff = (user.is_staff OR email @sefaria.org) in base_props
  • Passes it as chatbot_is_staff prop through to the <lc-chatbot> web component's is-staff attribute
  • Used purely for Braintrust trace tagging in the chatbot backend

Companion PR: Sefaria/ai-chatbot (same branch name) receives and logs this field.

Test plan

  • Verify staff users (is_staff=True or @sefaria.org email) get is-staff attribute set on the widget
  • Verify non-staff users don't get the attribute

🤖 Generated with Claude Code

@mergify
Copy link

mergify bot commented Mar 15, 2026

🧪 CI Insights

Here's what we observed from your CI run for ca4a499.

❌ Job Failures

Pipeline Job Health on master Retries 🔍 CI Insights 📄 Logs
Continuous Continuous Testing: PyTest Flaky Configure an automatic retry View View

Compute is_sefaria_staff from existing is_moderator and _email fields
and pass it as the is-staff attribute on the lc-chatbot web component
for Braintrust trace tagging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dcschreiber dcschreiber force-pushed the feature/sc-42362/distinguish-between-staff-prompts-and-public branch from 112f92c to 5e5fc04 Compare March 15, 2026 11:02
chatbot_version = chatbot_version if is_int(chatbot_version) else None

# Chatbot props (passed through base_props for ReaderApp)
is_sefaria_staff = user_data["is_moderator"] or user_data["_email"].endswith("@sefaria.org")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is problematic. we have user definition in the db, and that takes a different logic. if we need another level of moderator, this is what we should do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we do need different logic. Hey, I'm not sure I understand. What do you recommend we do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems we should use user.is_staff. if for some reason we need something that is not staff or moderator, we should have a new attribute for User

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean, although I think this would be cluttering the DB for the wrong reason. Let me go back to Mickey and check what we want to do.

is-staff now handles both settings gear visibility and trace tagging,
making is-moderator redundant on the chatbot widget.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dcschreiber dcschreiber marked this pull request as draft March 15, 2026 14:19
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.

2 participants