Skip to content

fix(discord): update primary instance env for shared-client connections#369

Open
JonasJesus42 wants to merge 2 commits intomainfrom
JonasJesus42/shared-client-fix
Open

fix(discord): update primary instance env for shared-client connections#369
JonasJesus42 wants to merge 2 commits intomainfrom
JonasJesus42/shared-client-fix

Conversation

@JonasJesus42
Copy link
Copy Markdown
Contributor

@JonasJesus42 JonasJesus42 commented Apr 7, 2026

Summary

  • When multiple connections share the same Discord client (same bot token), bootstrap starts the bot with empty state: {} (no AGENT config).
  • onChange only updated the calling connection's env, but event handlers use the primary (client-owning) instance's env.
  • This caused "Erro ao processar sua mensagem" because the bot had no AGENT configured.
  • Now onChange also updates the primary instance's env so the bot gets the correct AGENT config, system prompt, etc.

Test plan

  • Deploy and save config for any decocms connection in Mesh UI
  • Verify decocms bot responds to messages (no more "Erro ao processar")
  • Verify deco-help bot continues working

Generated with Claude Code


Summary by cubic

Fixes shared-client Discord bots starting with an empty env by syncing the primary (client-owning) instance’s env on config changes. Event handlers now see the correct AGENT and system prompt, removing “Erro ao processar sua mensagem” when multiple connections share a token.

  • Refactors
    • Removed unused CONNECTION binding and HYPERDX_API_KEY from StateSchema, and dropped HyperDX setup in main.ts (logger reads from process env).

Written for commit 33b1487. Summary will update on new commits.

…red-client connections

Bootstrap starts bots with empty state (no AGENT config). When multiple
connections share the same client, onChange only updated the calling
connection's env — but event handlers use the primary instance's env.

Now onChange also updates the primary (client-owning) instance's env
so the bot has the correct AGENT config, system prompt, etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

…from StateSchema

CONNECTION (BindingOf) was declared but never used in server code.
HYPERDX_API_KEY is already read from process.env in the logger,
making the StateSchema field redundant with the Kubernetes env var.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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