Repository navigation
feat(channels): post a grounded introduction when the bot joins a group room - #130103
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 11:04 PM ET / August 27, 2026, 03:04 UTC. ClawSweeper reviewWhat this changesAdds a shared, default-on introduction flow that posts one grounded message when the bot joins an allowed Discord server, Slack channel, or Telegram group. Merge readinessKeep open for maintainer product-direction review and native Telegram proof. The implementation has a coherent shared owner, access-policy checks, durable replay suppression, bounded prompts, and no identified patch defect, but it deliberately makes automatic model-generated group messages default-on across three existing channel plugins. Priority: P2 Review scores
Verification
How this fits togetherDiscord, Slack, and Telegram adapters detect a bot membership transition and provide room metadata to a shared core flow. That flow applies channel/account settings and deduplication, runs an isolated agent turn, then delivers the resulting announcement back to the room. flowchart LR
A[Bot joins group room] --> B[Channel adapter]
B --> C[Access policy check]
C --> D[Shared introduction flow]
D --> E[Durable deduplication]
E --> F[Isolated agent turn]
F --> G[Channel announcement]
Decision needed
Why: This is a deliberate change to default operator-visible behavior and outbound messaging, not a defect that source review can resolve. Before merge
Agent review detailsSecurityNone. PR surfaceSource +698, Tests +1569, Docs +32, Config +7, Generated 0, Other +2. Total +2308 across 44 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Mantis proof suggestionA restored group-eligible Telegram QA bot would directly prove the user-visible native transition and final chat delivery that the current run could not exercise. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Ship only after an owner explicitly accepts the default-on outbound behavior and a group-eligible QA bot demonstrates one native Telegram remove-and-reinvite delivery on the exact head. Do we have a high-confidence way to reproduce the issue? Not applicable to a defect: this PR adds a feature; source and focused tests cover its intended paths, while the available native Telegram proof could not trigger a membership event. Is this the best way to solve the issue? Unclear: the shared owner is the right architectural location and tests cover the key invariants, but maintainers must still choose whether default-on automatic messages are the right product behavior and obtain native Telegram evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a87fb08e70e3. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
6a904b2 to
52d2ed6
Compare
f43c87e to
72e8e9f
Compare
315ba56 to
27ad691
Compare
27ad691 to
5953737
Compare
…rable commit fails
5953737 to
9f36170
Compare
|
Status update ahead of landing. All review findings to date are resolved. Both original P1 blockers are fixed. Room evidence is now wrapped in the canonical untrusted-external-content boundary and the introduction turn runs with The config-surface P2 is fixed. Two findings on the later head were stale-base artifacts, not defects here. The third finding was real and is fixed. A durable-commit failure after a visibly delivered introduction could drop the claim and let a reconnect post a duplicate. The commit now uses the per-call Also since the last review: history read raised from 30 to 100 messages with the snapshot budget raised to 12,000 characters, and |
|
Merged via squash.
|
…up room (openclaw#130103) * feat(channels): introduce bots when they join group rooms * feat(channels): add Discord and Telegram join introductions * fix(channels): isolate untrusted evidence and select allowed join targets * refactor(channels): scope joinIntro to implementing channels * fix(channels): keep a delivered join introduction settled when its durable commit fails * feat(channels): read more room history and document join introductions in detail * chore(config): regenerate bundled channel metadata after rebase
What Problem This Solves
Inviting the bot into a Slack channel, Discord server, or Telegram group currently leaves the room silent. This adds a brief introduction grounded in the room's available facts, describing two or three concrete ways the bot can help.
Why This Change Was Made
Channel plugins recognize native membership events, enforce room policy, and provide a bounded context snapshot to one shared introduction owner. That owner runs an isolated agent turn with no tools and treats room text as untrusted evidence. Telegram supplies metadata and pinned text, explicitly marking pre-join history unavailable. The turn does not depend on heartbeat being enabled.
The existing durable claim store suppresses replays by account, conversation, and native join identity: Slack
event_id, Discordjoined_at, and Telegramupdate_id. A later removal/reinvite can therefore produce a new introduction; changing Discord's selected destination cannot duplicate the same membership. There is no new SQLite table, schema version, or persistence engine. A delivered message remains settled if committing its durable claim fails.User Impact
Introductions are on by default for these three plugins, never for DMs. Disable them with
channels.<id>.joinIntro: false, optionally overridden per account. Unsupported channels do not accept an unused setting. This adds three channel settings and three account overrides and intentionally changes the default group-join behavior.Slack preserves Enterprise workspace identity and resolves authoritative channel type to exclude multi-person DMs. Discord selects a policy-allowed, writable destination and ignores stale membership snapshots. Telegram respects General-topic enablement, policy, and agent routing; failed introductions enter the existing durable-ingress retry path. Outcomes are logged as posted, skipped with a reason, or failed.
Evidence
The published candidate is
595373756790a2cd50318a9360529bb1d470a978. Native Telegram verification remains blocked; this PR is not ready to merge.The replay/rejoin, Slack routing/MPIM, and Telegram topic/retry regressions failed against the original production code and pass with these repairs. After the first refresh, 96 focused tests across nine files and five shards passed, plus both owner-roster browser E2E tests. After the final metadata refresh, 185 prompt, introduction-owner, and channel-config tests across six files/shards passed, including unsupported-channel rejection. The Unicode regression also passed a separate 16-test prompt/helper run.
Before the mechanical rebase, the full build and changed-file type/lint/architecture gates passed, including zero runtime import cycles. The real isolated Gateway test passed with two distinct joins, two deliveries, no duplicate on replay, and recovery after one injected metadata failure. Its Telegram API and provider are mocked; this is not authenticated live proof.
All six source patches are unchanged by the rebase. Generated config metadata was regenerated against current main. Codex autoreview completed both bounded branch-review passes with no actionable P0 findings. A fresh review of the final four-file repair also reported no actionable P0 findings; lower priorities were outside that automated threshold.
Previous-head CI failed
session-owner-first.e2e.test.ts:70in UI shard 2/4. The inherited test raced a legitimate session-reference lookup against roster subscription: its fixture now uses the existing literal-key route and checks that no list request appears after hydration. The original fixture failed the strengthened assertion, and both roster E2E files pass with the repair. This race came from perf(ui): bootstrap session rosters in one request #130294 (a482a50cda885, authored and merged by @steipete), not the introduction feature. CI for the new head is queued/running. The fresh Mantis Telegram run is blocked, not passed.Direct AWS Crabbox run
run_31842c66aea9passed the real Gateway replay/rejoin/retry test on sourceca1949f1fc866451da090884da9ba479e451d785(exit 0). Telegram and the model were mocked for that run. Direct AWS runrun_99961586ac6bthen passed with the realopenai/gpt-5.6-lunamodel and OpenClaw runtime: one introduction for the first membership, none extra for its replay, and one for the distinct later membership. Actual outputs were 35 and 33 words, grounded in shoreline-cleanup/tide-pool facts, offering concrete help without claiming unavailable history. Telegram remained synthetic in this run; no upstream response rewriting or proxy was used. The declared and remote Git SHA both matchedca1949f1fc866451da090884da9ba479e451d785, six feature/harness source hashes matched, and Gateway/server cleanup completed. The AWS lease was released. The exact 889-byte prompt for this live fixture is byte-for-byte unchanged by the final Unicode repair; this is earlier-head live evidence, not a new exact-head live run.The refreshed review found that a character cap could exceed the prompt budget for CJK text. The shared builder now budgets the complete prompt in UTF-8 bytes, reserves instructions first, and reuses the canonical truncation helper to preserve complete code points. The pre-fix Unicode reproduction reached 10,270 bytes; the regression now enforces a 1,024-byte cap. No tokenizer dependency, new setting, or transport-specific workaround was added. The full local changed-file gate passed, including production/test typechecking, lint, architecture guards, and zero runtime import cycles. Earlier attempts caught and led to fixes for an internal changelog attribution and an unsupported test-library method.
One refresh was required because main independently landed the same roster-fixture repair in #130578 (
c35b18309329). The upstream test is retained, removing our duplicate UI edit.git range-diffreports all eight feature patches unchanged when excluding that now-upstream test; the prompt, introduction owner, and three membership adapters are byte-identical to the locally gated source. The local gate predates the mechanical refreshes. A subsequent refresh onto31b26d09f050resolved conflicts in the three generated config artifacts by regenerating them from the current schemas. All eight non-generated feature patches remain unchanged, and the 185-test run above was performed on the final head. The current main merge was checked locally without conflicts.Focused verification:
The previous Mantis run observed live Telegram metadata, delivery, and visible messages, but injected the membership event because the leased bot reported
can_join_groups=false; it also used a scripted model. It does not prove a native removal/reinvite or live model grounding. In the fresh run, Mantis calledleaveChatbefore checking group-join capability, despite the explicit no-remove guard in its instructions. Telegram rejected the re-add becausecan_join_groups=false; the shared QA bot is now absent and needs owner-assisted restoration. Candidate join events, provider requests, and deliveries were all zero, so this run provides no join-feature verdict. Further shared-fixture runs are stopped.ClawSweeper rank-up work: event-scoped deduplication and replay-versus-rejoin coverage are implemented across all three adapters. Fresh native rejoin evidence is blocked on restoring the QA fixture and its join capability; it is not claimed from the injected-event test. The earlier onboarding/sidebar findings were stale-base comparisons: neither file is in this PR. The durable-commit finding is fixed and regression-tested. The latest provider-cache finding is also a stale-base comparison: neither
src/plugin-sdk/provider-catalog-shared.tsnor its test is in the PR diff. Main landed the cited cache fix in #130412 (4c4c06aa359) after the earlier branch base, then refactored that owner in #130564. The refresh inherits both changes; this PR does not modify that owner. That rank-up move is therefore skipped as unrelated; the Unicode move is implemented and native Telegram proof remains blocked.Production LOC: +699/-4 (net +695). Tests: +1569/-0. Docs/changelog: +32/-0; generated metadata: +23/-23; SDK/build metadata: +12/-0. Feature growth provides the shared bounded turn and three transport integrations. The later repairs add net 34 production lines to carry membership, workspace, topic, and retry facts through their existing owners; no parallel policy or retry engine was added. Unicode budgeting adds net 12 production lines for byte accounting and instruction reservation while deleting duplicate snapshot assembly. The UI repair is now inherited from main and is no longer in this PR diff.
Docs: channels, Slack, Discord, Telegram, configuration.
Named follow-ups outside this change: investigate the existing Discord connection/listener-registration ordering and the possible Telegram named-account policy-inheritance inconsistency. Both are source/history leads, not reproduced defects or claimed fixes.
Mantis follow-up: enforce a safe membership-restoration prerequisite at the test harness boundary, and restore the affected shared Telegram QA fixture. This is separate from the product feature; the failed proof is not waived.
Observed live-model introduction: