Skip to content

fix(channels): emit passive hooks for mention-skipped group messages#60018

Merged
obviyus merged 4 commits intomainfrom
fix/silent-ingest-root-cause
Apr 3, 2026
Merged

fix(channels): emit passive hooks for mention-skipped group messages#60018
obviyus merged 4 commits intomainfrom
fix/silent-ingest-root-cause

Conversation

@obviyus
Copy link
Copy Markdown
Contributor

@obviyus obviyus commented Apr 3, 2026

Summary

  • emit existing internal message:received hooks when mention-skipped Telegram and Signal group messages opt into ingest
  • keep the config surface small with a boolean ingest flag instead of a second hook-dispatch system
  • add focused Telegram, Signal, and schema regression coverage

Testing

  • pnpm test -- extensions/telegram/src/bot-message-context.silent-ingest.test.ts extensions/signal/src/monitor/event-handler.silent-ingest.test.ts src/config/zod-schema.providers-core.ingest.test.ts
  • pnpm tsgo

@openclaw-barnacle openclaw-barnacle bot added channel: signal Channel integration: signal channel: telegram Channel integration: telegram size: M maintainer Maintainer-authored PR labels Apr 3, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 3, 2026

Greptile Summary

This PR adds passive message:received hook emission for mention-skipped group messages in both Telegram and Signal, controlled by a new ingest?: boolean flag on group/topic config objects. The schema, types, and Telegram implementation are clean and consistent with how other group policies (e.g. requireMention) are resolved. One logic issue was found in the Signal path.

  • Config surface (src/config/group-policy.ts, types.signal.ts, types.telegram.ts, zod-schema.providers-core.ts): ingest?: boolean added correctly to all relevant types and Zod schemas with JSDoc comments.
  • Telegram (bot-message-context.body.ts, bot-message-context.ts): Hook dispatch uses topicConfig?.ingest ?? groupConfig?.ingest — the nullish-coalescing correctly gives topic-level config priority over group-level config, matching how requireMention resolution works elsewhere.
  • Signal (event-handler.ts): The ingest check uses groupConfig?.ingest === true || defaultConfig?.ingest === true. This || means a specific group with ingest: false cannot override a wildcard * entry with ingest: true, which is inconsistent with Telegram's ?? semantics and with how requireMention priority is resolved. A group-specific opt-out would be silently ignored.
  • Tests: New focused test files cover the happy path for both channels. The Telegram test references anthropic/claude-opus-4-5 as a placeholder model string where project guidelines prefer sonnet-4.6.

Confidence Score: 3/5

Mostly safe, but the Signal ingest precedence bug means a group-specific ingest: false can be overridden by the wildcard ingest: true, producing unintended hook emissions.

The Telegram and schema changes are clean. The Signal implementation has a logic bug in how group-specific vs. wildcard config precedence is handled — it uses || where ?? is needed. While not a crash, this silently breaks explicit per-group opt-outs if a wildcard default is also set.

extensions/signal/src/monitor/event-handler.ts — the ingest condition on lines 733-736 needs the || replaced with nullish-coalescing to match Telegram semantics and the rest of the policy resolution pattern.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/signal/src/monitor/event-handler.ts
Line: 733-736

Comment:
**Group-specific `ingest: false` cannot override wildcard `ingest: true`**

The `||` condition means: if the specific group has `ingest: false` but the wildcard `*` entry has `ingest: true`, the hook still fires — the group-specific opt-out is silently ignored.

For example:
```yaml
channels:
  signal:
    groups:
      "group-abc":
        requireMention: true
        ingest: false   # explicit opt-out for this group
      "*":
        requireMention: true
        ingest: true    # default for other groups
```

With the current code `false === true || true === true` evaluates to `true` and the hook fires for `group-abc`.

The Telegram counterpart correctly uses `??` (nullish-coalescing) to give the specific group config priority over the wildcard, and `resolveChannelGroupRequireMention` in `group-policy.ts` applies the same precedence rule for `requireMention`. The ingest flag should follow the same pattern:

```suggestion
      if (
        (signalGroupPolicy.groupConfig?.ingest ?? signalGroupPolicy.defaultConfig?.ingest) === true
      ) {
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/telegram/src/bot-message-context.silent-ingest.test.ts
Line: 51-53

Comment:
**Test model constant doesn't match project preference**

The project guidelines (CLAUDE.md) ask to prefer `sonnet-4.6` for example Anthropic model constants in tests. This placeholder uses `anthropic/claude-opus-4-5`.

```suggestion
          model: "anthropic/sonnet-4.6",
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(channels): emit passive hooks for me..." | Re-trigger Greptile

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 150151dead

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 346634ca90

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@obviyus obviyus force-pushed the fix/silent-ingest-root-cause branch from 1df588d to 69571b6 Compare April 3, 2026 04:39
@obviyus obviyus merged commit 251fa72 into main Apr 3, 2026
43 checks passed
@obviyus obviyus deleted the fix/silent-ingest-root-cause branch April 3, 2026 04:44
@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Apr 3, 2026

Landed.

Commits:

ngutman pushed a commit that referenced this pull request Apr 3, 2026
* fix(channels): emit passive hooks for mention-skipped group messages

* fix(channels): honor signal ingest overrides

* fix(channels): honor telegram ingest fallback

* fix: emit passive hooks for mention-skipped group messages (#60018)
steipete pushed a commit to duncanita/openclaw that referenced this pull request Apr 4, 2026
…60018)

* fix(channels): emit passive hooks for mention-skipped group messages

* fix(channels): honor signal ingest overrides

* fix(channels): honor telegram ingest fallback

* fix: emit passive hooks for mention-skipped group messages (openclaw#60018)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: signal Channel integration: signal channel: telegram Channel integration: telegram maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant