Skip to content

Suppress protected Telegram group runtime replies#30

Merged
Vardominator merged 1 commit into
mainfrom
fix/telegram-protected-group-runtime-suppression
Mar 13, 2026
Merged

Suppress protected Telegram group runtime replies#30
Vardominator merged 1 commit into
mainfrom
fix/telegram-protected-group-runtime-suppression

Conversation

@Vardominator
Copy link
Copy Markdown
Contributor

Summary

  • suppress all outbound payload dispatch for protected Telegram group sessions in the OpenClaw reply runtime
  • keep the existing telegram-group-allowlist-guard plugin as a second fail-closed layer for normal replies and tool execution
  • document that plugin-only enforcement is not sufficient for a strict no-send guarantee

Problem

Davis and Marvin were still able to emit synthetic runtime error replies in Telegram groups, including provider billing failures. The earlier plugin change blocked normal assistant and tool replies, but it did not stop OpenClaw from generating and dispatching its own runtime error payloads.

Changes

  • add a build-time runtime patcher for core-human that injects protected Telegram group suppression into dispatch-from-config.ts
  • rebuild the custom core-human image from Dockerfile.custom so the patched runtime is baked into the container image
  • retain and test the plugin-level fail-closed behavior for missing account metadata and protected group tool blocking
  • update the bot access docs to call out the runtime-layer requirement

Verification

  • bun test tests/apply-protected-group-reply-suppression.test.ts
  • bun test tests/telegram-group-allowlist-guard.test.ts
  • node dist/cli.js --inventory inventory/instances.local.yaml validate
  • node dist/cli.js --inventory inventory/instances.local.yaml policy validate
  • render, compose generate, and preflight for core-human
  • docker build -f instances/core-human/config/Dockerfile.custom -t openclaw-core-human-custom:2026.2.22-r1 .
  • docker compose -f .generated/core-human/docker-compose.yaml up -d --force-recreate gateway
  • ./scripts/oco.sh health --instance core-human
  • docker compose -f .generated/core-human/docker-compose.yaml exec -T gateway node /app/openclaw.mjs doctor --non-interactive --yes
  • verified suppression markers in the live container source and compiled dist output

Notes

  • unrelated local dashboard/ changes were left uncommitted
  • this was validated by code-path and live-container verification; I did not inject a fresh Telegram billing failure after deploy

Copilot AI review requested due to automatic review settings March 13, 2026 13:59
@Vardominator Vardominator merged commit 494a328 into main Mar 13, 2026
8 checks passed
@Vardominator Vardominator deleted the fix/telegram-protected-group-runtime-suppression branch March 13, 2026 14:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a runtime-layer safeguard to prevent OpenClaw from dispatching any outbound replies (including synthetic runtime error payloads) in protected Telegram group sessions, while keeping the existing telegram-group-allowlist-guard plugin as a secondary, fail-closed enforcement layer.

Changes:

  • Introduces a build-time patcher that injects protected Telegram group suppression logic into the OpenClaw runtime dispatcher (dispatch-from-config.ts).
  • Updates the telegram-group-allowlist-guard plugin to better resolve protected account identity (including agentId fallbacks) and adds tests for fail-closed behavior when outbound metadata is missing.
  • Updates the custom core-human Dockerfile to apply the patch and rebuild the runtime, plus docs clarifying why runtime-layer enforcement is required.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/telegram-group-allowlist-guard.test.ts Adds coverage for fail-closed protected group sends/tool blocking when accountId is missing and agentId fallback is used.
tests/apply-protected-group-reply-suppression.test.ts Adds a unit test validating the runtime patch injection is applied and idempotent.
instances/core-human/config/openclaw-runtime-patches/apply-protected-group-reply-suppression.mjs Implements the build-time patcher that injects suppression logic into the runtime dispatcher.
instances/core-human/config/extensions/telegram-group-allowlist-guard/index.ts Adjusts account resolution logic and adds a fail-closed path for protected group sends when metadata is missing.
instances/core-human/config/Dockerfile.custom Applies the patch during image build and rebuilds the runtime output.
docs/BOT_ACCESS_SETUP.md Documents read-only group mode and clarifies that plugin-only enforcement isn’t a strict no-send guarantee.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +88 to +91
const enabledAccounts = new Set(asLowerStringList(pluginConfig.enabledAccounts));
if (enabledAccounts.size === 0) {
return undefined;
}
Comment on lines +78 to +81
const pluginEntry = cfg.plugins?.entries?.[TELEGRAM_GROUP_ALLOWLIST_GUARD_PLUGIN_ID];
if (!pluginEntry || pluginEntry.enabled === false) {
return undefined;
}
Comment on lines 865 to +871
if (!accountId || !isAccountEnabled(accountId, enabledAccounts)) {
if (parsedTo.kind === "group" && blockAllGroupReplies && enabledAccounts.size > 0) {
api.logger.info?.(
`telegram-group-allowlist-guard: cancelled group send -> ${toTarget} (missing protected account context; failing closed)`,
);
return { cancel: true };
}
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