openclaw - 💡(How to fix) Fix [Bug]: Slack per-channel systemPrompt is assembled but agent behavior ignores it [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59238Fetched 2026-04-08 02:27:04
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Per-channel systemPrompt configured under channels.slack.channels.<id>.systemPrompt is correctly resolved through the Slack adapter, inbound context, and reply pipeline — but channel agent behavior consistently ignores the instructions. Fresh session + gateway restart do not fix it. Affects all Slack channels tested (and likely other platforms).

Root Cause

Per-channel systemPrompt configured under channels.slack.channels.<id>.systemPrompt is correctly resolved through the Slack adapter, inbound context, and reply pipeline — but channel agent behavior consistently ignores the instructions. Fresh session + gateway restart do not fix it. Affects all Slack channels tested (and likely other platforms).

Fix Action

Fix / Workaround

Workaround in use

Code Example

{
  "channels": {
    "slack": {
      "channels": {
        "C0APBUALN3V": {
          "requireMention": false,
          "systemPrompt": "When a URL is posted, run bash script X and reply with the output. Never summarize yourself."
        }
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

Per-channel systemPrompt configured under channels.slack.channels.<id>.systemPrompt is correctly resolved through the Slack adapter, inbound context, and reply pipeline — but channel agent behavior consistently ignores the instructions. Fresh session + gateway restart do not fix it. Affects all Slack channels tested (and likely other platforms).

Steps to reproduce

  1. Set a per-channel systemPrompt on a Slack channel:
{
  "channels": {
    "slack": {
      "channels": {
        "C0APBUALN3V": {
          "requireMention": false,
          "systemPrompt": "When a URL is posted, run bash script X and reply with the output. Never summarize yourself."
        }
      }
    }
  }
}
  1. Restart gateway
  2. Delete any existing session file for that channel
  3. Post a URL in that Slack channel
  4. Observe: agent ignores systemPrompt entirely and falls back to generic reasoning

Expected behavior

Agent follows the per-channel instructions on every turn, including fresh sessions.

Actual behavior

Agent behaves as if no systemPrompt was set — improvises its own approach to the task, ignoring all instructions in the config.

Source investigation (v2026.3.31)

Traced the full execution path in local node_modules:

  • prepare-DLj4tQOx.jsresolveSlackRoomContextHints() correctly reads channelConfig.systemPrompt and returns groupSystemPrompt
  • Slack inbound context passes GroupSystemPrompt into finalizeInboundContext()
  • reply-B8i7ZpFD.js reads sessionCtx.GroupSystemPrompt and appends it to extraSystemPromptParts
  • extraSystemPromptParts.join("\n\n") passed as extraSystemPrompt to the agent runner ✅
  • pi-embedded-iRgRpYxO.js buildEmbeddedSystemPrompt() accepts extraSystemPrompt

The prompt is assembled in code, but agent runtime behavior consistently ignores the per-channel instructions.

Workaround in use

Moved all channel-specific logic into deterministic shell scripts. Slack channel session is treated as a stateless relay — agent just runs the script and returns output. This works but requires one script per channel and prevents natural per-channel LLM behavior.

OpenClaw version

2026.3.31 (213a704)

Operating system

macOS Tahoe 25.4.0 (arm64)

Install method

npm global

Related issues

#40513 (WeChat Work group systemPrompt not applied — channelConfigPrompt=null for group messages) #47095 (Discord voice transcript ignores per-channel systemPrompt override)

extent analysis

TL;DR

The agent's failure to follow per-channel systemPrompt instructions may be due to an issue with how the extraSystemPrompt is processed or utilized by the agent runtime, despite being correctly assembled in the code.

Guidance

  • Verify that the extraSystemPrompt is correctly passed to and utilized by the agent runtime by checking the input parameters of the agent runner in pi-embedded-iRgRpYxO.js.
  • Investigate if there are any overrides or conditions in the agent runtime that could cause it to ignore the extraSystemPrompt.
  • Compare the implementation of buildEmbeddedSystemPrompt() in pi-embedded-iRgRpYxO.js with other platforms (e.g., WeChat Work, Discord) to identify potential inconsistencies or platform-specific issues.
  • Consider adding logging or debugging statements to track the flow of extraSystemPrompt through the agent runtime to identify where it might be ignored or overridden.

Example

No specific code snippet can be provided without further investigation, but checking the buildEmbeddedSystemPrompt() function and its interaction with the agent runtime could be a starting point:

// Example of how to add a debug log in buildEmbeddedSystemPrompt()
function buildEmbeddedSystemPrompt(extraSystemPrompt) {
  console.log('Received extraSystemPrompt:', extraSystemPrompt);
  // ... rest of the function implementation
}

Notes

The issue seems to be specific to how the agent runtime processes the extraSystemPrompt, and further investigation into the agent's code and its interaction with the extraSystemPrompt is needed. The fact that a workaround using deterministic shell scripts works suggests that the issue is not with the Slack adapter or inbound context but rather with the agent's behavior.

Recommendation

Apply workaround: Continue using the deterministic shell scripts for channel-specific logic as a temporary solution until the root cause of the agent's behavior can be identified and fixed. This approach, although not ideal, ensures that per-channel instructions are followed, albeit without the flexibility of natural per-channel LLM behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Agent follows the per-channel instructions on every turn, including fresh sessions.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING