Skip to content

BUG: Slack integration crashes with placeholder token value instead of proper validation #187

@flexus-teams

Description

@flexus-teams

Error Summary

Karen bot (version 20046) crashes every 60 seconds when attempting Slack authentication with a placeholder token value ("value") instead of a valid token or empty string. The error occurs in IntegrationSlack.__init__ and propagates through join_channels() -> auth_test() with SlackApiError: invalid_auth.

Stacktrace

SlackApiError: invalid_auth
  at IntegrationSlack.auth_test() (fi_slack.py:708)
  called from join_channels()
  called from karen_bot.py:112

Investigation Findings

Root Cause

Repository: flexus-client-kit
File: flexus_client_kit/integrations/fi_slack.py
Line: 174
Function: IntegrationSlack.__init__

Why: The Slack integration does not properly validate tokens before attempting API calls. When SLACK_BOT_TOKEN is set to a placeholder value like "value" instead of empty string, the check if not SLACK_BOT_TOKEN passes (since "value" is truthy), but subsequent Slack API auth_test() fails with invalid_auth. Additionally, join_channels() is called unconditionally in karen_bot.py line 112 without checking if Slack integration is properly configured.

Code Snippet

# fi_slack.py:171-176
self.SLACK_BOT_TOKEN = SLACK_BOT_TOKEN
self.SLACK_APP_TOKEN = SLACK_APP_TOKEN
logger.info("%s have SLACK_BOT_TOKEN=%s and SLACK_APP_TOKEN=...%s", 
            rcx.persona.persona_id, 
            ("..." + SLACK_BOT_TOKEN[-4:] if SLACK_BOT_TOKEN else "none"), 
            ("..." + SLACK_APP_TOKEN[-4:] if SLACK_APP_TOKEN else "none"))
self.should_join = [x.strip() for x in should_join.split(",") if x.strip()]
...
try:
    if not SLACK_BOT_TOKEN:
        raise ValueError("no token configured")

# karen_bot.py:112
await slack.join_channels()  # Called unconditionally

Occurrence Data

  • First Seen: 2026-02-02T09:48:40Z
  • Last Seen: Continuous (every 60 seconds)
  • Occurrence Count: Continuous loop since first occurrence
  • Affected Pods: flexus-pod-bot-karen-20046-rx
  • Affected Namespaces: isolated
  • Karen Version: 20046
  • Image: europe-west4-docker.pkg.dev/small-storage1/flexus-marketplace/wnoqwtd2yl-karen:20046

Cluster Behavior

  • Pod is Running and healthy (ready=true, restartCount=0)
  • Bot successfully connects to Discord and establishes Slack Socket Mode connection
  • Fails at auth_test() API call
  • Sleeps 60 seconds and retries forever
  • Pod has FLEXUS_WORKSPACE="" (empty), suggesting workspace-less test/development environment
  • Token ending in "alue" indicates literal string "value" was used as placeholder

Recommended Fixes

HIGH Priority

  1. Add robust token validation in fi_slack.py IntegrationSlack.__init__:

    • Reject known placeholder values ("value", "your_token_here", etc.)
    • Validate token format (e.g., xoxb-* for bot tokens)
    • Fail fast with clear error message before attempting API calls
  2. Make join_channels() conditional in karen_bot.py or fi_slack.py:

    • Check if Slack is properly configured before calling join_channels()
    • Or handle auth failures gracefully without crash-looping

MEDIUM Priority

  1. Configuration audit: Check persona_setup for karen_20046 - why is SLACK_BOT_TOKEN set to "value"?

LOW Priority

  1. Graceful degradation: If Slack auth fails, log warning but allow bot to continue operating without Slack integration

Related Files

  • flexus_client_kit/integrations/fi_slack.py
  • flexus_simple_bots/karen/karen_bot.py
  • flexus_simple_bots/karen/karen_install.py
  • flexus_client_kit/ckit_bot_exec.py

This issue was automatically created by Diplodocus error tracking system.
Error ID: 69807338b679757f69392197
Investigation completed: 2026-02-02T09:57:00Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions