feat(ai-bot): make bot account email configurable via env var#1
Open
dnplkndll wants to merge 1 commit into
Open
feat(ai-bot): make bot account email configurable via env var#1dnplkndll wants to merge 1 commit into
dnplkndll wants to merge 1 commit into
Conversation
802aaed to
dc2dcbd
Compare
…v var The AI bot email was hardcoded to huly.ai.bot@hc.engineering, causing self-hosted deployments to send notifications to an unreachable address. Add AI_BOT_EMAIL env var to the ai-bot service and transactor: - ai-bot service: reads AI_BOT_EMAIL, calls setAiBotAccountEmail() on startup, uses it for signUp/assignWorkspace/identity lookups - transactor: reads AI_BOT_EMAIL, calls setAiBotAccountEmail() so middleware recognizes the bot as a service account - server plugin triggers: use getAiBotEmailSocialKey() for DB queries - middleware: import from @hcengineering/ai-bot instead of duplicating the hardcoded string - client plugin unchanged: queries by the default constant, which still works because the bot retains its original social identity Defaults to huly.ai.bot@hc.engineering when unset (no behavior change). Tested on self-hosted K8s: bot registers new social identity, DMs work, 0 restarts on both services. Resolves hcengineering/huly-selfhost#239 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Don Kendall <kendall@donkendall.com>
dc2dcbd to
f24b6fe
Compare
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
Makes the AI bot account email configurable via
AI_BOT_EMAILenv var instead of hardcoded tohuly.ai.bot@hc.engineering.Resolves hcengineering/huly-selfhost#239
Motivation
Self-hosted deployments send email notifications to the hardcoded
huly.ai.bot@hc.engineeringwhen the bot is mentioned offline — an unreachable address for self-hosters.Design
setAiBotAccountEmail()/getAiBotAccountEmail()on the shared@hcengineering/ai-botplugin — mutable at startup, defaults to original emailgetAiBotEmailSocialKey()— derives social key from the configured email at call timeaiBotAccountEmailandaiBotEmailSocialKeyconstants kept (used by client-side code that doesn't have env vars)Env vars
AI_BOT_EMAILhuly.ai.bot@hc.engineeringAI_BOT_EMAILhuly.ai.bot@hc.engineeringBoth services must use the same value if set.
Changes (12 files)
plugins/ai-bot/src/index.tsget/setAiBotAccountEmail(),getAiBotEmailSocialKey()services/ai-bot/pod-ai-bot/src/config.tsEmailfromAI_BOT_EMAILenv (imports default from plugin)services/ai-bot/pod-ai-bot/src/start.tssetAiBotAccountEmail(config.Email)on startupservices/ai-bot/pod-ai-bot/src/utils/account.tsservices/ai-bot/pod-ai-bot/src/utils/platform.tspods/server/src/__start.tsAI_BOT_EMAIL, callsetAiBotAccountEmail()foundations/server/packages/middleware/src/identity.ts@hcengineering/ai-bot(was duplicate hardcoded string)foundations/server/packages/middleware/src/pluginConfig.tsserver-plugins/ai-bot-resources/src/index.ts**/package.json+pnpm-lock.yaml@hcengineering/ai-botdependencyNot changed:
plugins/ai-bot-resources/src/utils.ts(client-side, correctly uses constant),models/contact/src/migration.tsanddev/tool/src/db.ts(hardcoded strings reference historical data).Testing
Deployed to Hetzner K8s cluster with
AI_BOT_EMAIL=aibot@ledoweb.com:email:aibot@ledoweb.comas new social identityemail:huly.ai.bot@hc.engineeringidentity preserved (backwards compat)🤖 Generated with Claude Code