Skip to content

feat: let agents participate selectively in group conversations - #159478

Open
mcaxtr wants to merge 45 commits into
mainfrom
feat/group-decision-participation
Open

mcaxtr wants to merge 45 commits into
mainfrom
feat/group-decision-participation

Conversation

@mcaxtr

@mcaxtr mcaxtr commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Problem and motivation

When mention gating is disabled in a group, the primary reply model receives admitted messages and decides whether to participate as part of an agent turn. Many of those messages are exchanges between other people, questions that have already been answered, or chatter where another reply would add little value. Starting the primary agent for every such message creates unnecessary work and conversation noise.

Requiring an explicit mention avoids some of that work but misses indirect invitations and useful opportunities to contribute. A configured Decision Model should make the participation choice using the existing group etiquette, while the primary model keeps generating replies in its usual voice.

Solution

With the existing default-off Decision assistance setting enabled and a Decision Model configured, assess eligible unmentioned text messages in always-on groups and channels before primary generation.

The assessment receives the current message, reply reference, bounded recent model history, and bounded workspace identity text. Recent history uses the same reader as normal generation, preserving native message-tool calls and their actual delivery results. Identity context uses the existing workspace loader and context formatter, preserving heading/prose IDENTITY.md files and configured identity precedence.

History preparation runs inside the existing admitted Decision execution, after the selected model’s effective route limits are known. It reserves space for the current message, identity and question, then uses the existing history selector to keep a bounded suffix with complete tool-call/result pairs. In addition to the shared token-pressure estimate, aggregate state/question and request limits set a conservative UTF-8 byte envelope, checked against the complete serialized batch. Provider-specific encoded-input constraints keep their existing handling. It adds no second catalog preparation or provider hook call. If the required input cannot fit, or all prior context would be omitted, the existing ordinary-reply fallback applies. Diagnostics measure the prepared batch rather than its initial placeholder.

  • Reply: continue through the ordinary agent generation and delivery path. The turn carries approval as the existing result-required completion policy, and turn context tells the primary model to generate its reply in its usual voice.
  • Silent: record the incoming message through the existing transcript owner and finish the turn without primary generation.
  • Assessment unavailable: use the ordinary reply path.

The existing admission, transcript, queue, cancellation, permissions, and delivery owners remain responsible for their normal work. A declined queued source is consumed after persistence, so the recorded input is not retried as an abandoned request. The completion owner uses confirmed current-source delivery evidence. NO_REPLY after message-tool delivery prevents duplicate output. An undelivered NO_REPLY remains an unfulfilled reply and follows existing bounded generation recovery and failure handling. Source-delivery retries retain that requirement; they do not make another participation choice. Exhausted or refused retries record failure through the existing runner, and system notices retain their existing permission.

Scope and rollout

This uses the existing Decision assistance Labs flag and configured decisionModel; there is no separate participation setting. An already-saved enabled preference also enables this capability after upgrade.

Explicit mentions, commands, media inputs, ambient room events, internal events, and generic CLI backends keep their existing paths. When Decision assistance is disabled or unavailable, the primary model retains its ordinary participation behavior.

Assessments use the selected Decision provider and may incur its normal charges. The provider receives the identity and conversation evidence described above. Each assessment is bounded by the turn timeout and a maximum of 30 seconds.

Validation

The existing approved-text case reproduced approval followed by primary NO_REPLY completing without an answer before the fix, then passed with normal generation recovery and delivery. The existing message-tool case still completes without a duplicate reply. A second revised existing case reproduced queued delivery retry being disabled by the stronger completion policy.

Focused validation covered 168 existing cases across five files. After the final source-receipt consolidation, all 73 affected immediate/queued consumer cases passed in 77.02 seconds. The unchanged terminal-resolution and stranded-recovery suites also passed. No test cases or fixture frameworks were added.

The final messaging type-check graph, formatting, syntax guards, whitespace checks, and source/test line ratchets pass. Independent source review is clean. It also traced private transcript receipts, exhausted retry settlement, and refused retry enqueue through the existing owners. The 180-line allocation covers the excess above the 400-line allowance: 580 net test lines retain participation, persistence, source settlement, delivery and prepared-input coverage. The budget repair extends existing cases without adding test cases or a fixture framework.

The history-input repair passes all 11 existing participation/queue cases, the messaging type-check graph, formatting, syntax guards, whitespace checks, and the runtime import-cycle check. An isolated synthetic SQLite transcript reproduces the prior omission and confirms that the shared model-history reader retains the reply text and matching settled source-delivery receipt in order. Independent review is clean; no tests were added for this repair.

A fresh live assessment reached TypeSafe and received HTTP 400 with token-limit wording; the earlier rejection traces remain unattributed. The budget repair passes 102 existing cases across seven focused files (109.38 seconds). After the final interruption correction, all 89 affected Decision host/native cases passed again (46.40 seconds). Messaging and agents-root type checks, formatting, syntax guards, runtime import-cycle and line ratchets pass. Independent source review is clean.

Live validation of that first budget repair still returned unsupported input. A controlled replay through the existing native Gateway Decision tool then compared reconstructed local history with all fields preserved: the approximate selection (85,580 submitted JSON bytes) was rejected; the byte-bounded selection (26,067 bytes, seven messages with complete paired turns) succeeded with 13,990 provider input tokens. A local protocol comparison confirmed HTTP 400 with token-limit wording for the former and HTTP 200 for the latter. These were reconstructed inputs, not captured copies of the original requests; no channel messages were sent.

The follow-up repair changes one production file (+12/-2) and adds no tests. All 13 existing participation/queue/history cases pass, along with the messaging type graph, formatting, focused guards, whitespace and source-line checks. Independent source review is clean. The byte envelope is conservative, not an exact tokenizer guarantee. Exact-commit package installation and live greeting, contextual follow-up and silent-branch validation remain pending.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex size: XL labels Sep 27, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lets the configured Decision Model choose whether eligible unmentioned group messages need primary-agent participation.

Example: Decision assistance is enabled in Telegram group -10001, and Alice writes “Bob, see you at lunch.”

  • Before: The primary agent starts a turn and decides whether to respond.
  • After: A silent Decision assessment records the message and completes the turn without primary generation.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful, coherent implementation with the prior fixture defect repaired; available live validation remains partial and revision-limited.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Always-on group conversations start the primary agent for exchanges where its participation adds little value.
Reason: Avoiding unnecessary primary turns has clear user value, and the maintainer-authored direction explicitly accepts reuse of the saved Decision-assistance preference.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-authored feature PR open: current main still starts primary generation for these messages, and the proposed participation step has clear value. The prior fixture blocker is fixed; no definite introduced code or security defect remains, although the description still overstates reply-completion guarantees.

Priority: P2
Reviewed head: 33307819f336416c0680e1e50f3fc663bc201116

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted current-head Gateway/channel evidence of contextual participation with confirmed delivery, reaction-only completion and a silent turn, plus fresh-install and latest-stable upgrade runs preserving saved settings and sessions.
Agent review details

How this fits together

Shared reply preparation receives admitted channel messages, assesses eligible group input through the existing Decision runtime, and either records silent input or continues through normal generation and delivery.

flowchart TD
  A[Group message] --> B[Existing admission]
  B --> C[Decision assessment]
  C --> D[Primary generation]
  D --> E[Channel delivery]
  C --> F[Record silent input]
Loading

Technical review

Best possible solution:

Retain one pre-generation participation decision within existing admission, transcript, and delivery owners, then complete the applicable live validation.

Do we have a high-confidence way to reproduce the issue?

This is a feature addition; source confirms that main reaches primary generation before making the proposed participation choice.

Is this the best way to solve the issue?

The implementation uses the existing Decision runtime and lifecycle owners, preserves ordinary fallback behavior, and keeps response form with the primary model.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 895c50368fee.

Provenance checked

  • Decision assistance rollout changes intended behavior with a stated reason (feat: optionally omit tools on conversational turns #153340: Automatic tool filtering used default-off Labs consent and bounded evidence; the current maintainer-authored proposal explicitly extends that consent to participation.)
  • Group etiquette and explicit silence changes intended behavior with a stated reason (9c7c0ae: Keep agents quiet when others are addressed; this PR moves that choice into the Decision assessment while retaining ordinary completion semantics.)
  • Source delivery prompt ownership keeps the original intent (fix(auto-reply): deliver embedded fallback replies after CLI failures #121897: Separate stable CLI prompt bytes from runtime delivery selection and preserve later prompt additions; the patch extends that same owner.)
  • Answered-history reconciliation keeps the original intent (fix(channels): stop repeating answered messages in recent chat history #186081: Omit only confirmed answered requests while retaining edits and unfinished input; the patch adds confirmed reaction receipts and raw-user boundaries.)
  • Codex terminal release keeps the original intent (349c1a4: Preserve submitted steering after final replies; the patch retains those checks and additionally waits for native outer-call receipts.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit cde6bbd adds src/decisions/runtime.ts:21 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cde6bbdcfe84; files: src/decisions/runtime.ts)
  • Vincent Koc: Raw commit 2f4373b adds src/decisions/runtime.ts:36 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2f4373bd1f84; files: src/decisions/runtime.ts)

PR surface

Source +614, Tests +1031, Docs +36, Other -1. Total +1680 across 72 files. Added test files: 8.

View PR surface stats
Area Files Added Removed Net
Source 31 883 269 +614
Tests 33 1144 113 +1031
Docs 6 43 7 +36
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 3 -1
Total 72 2072 392 +1680

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Useful optional group-conversation improvement behind existing default-off Decision assistance, with limited rollout scope.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (17 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-01T06:19:42.585Z sha 114be4f :: blocked before merge. :: none
  • reviewed 2026-10-01T18:00:12.336Z sha 114be4f :: blocked before merge. :: none
  • reviewed 2026-10-01T18:59:58.480Z sha 60becc8 :: blocked before merge. :: none
  • reviewed 2026-10-02T22:21:11.960Z sha 60becc8 :: blocked before merge. :: none
  • reviewed 2026-10-02T23:05:01.513Z sha 5b5b64e :: blocked before merge. :: none
  • reviewed 2026-11-18T03:33:43.137Z sha a21ea82 :: blocked before merge. :: none
  • reviewed 2026-11-19T04:28:13.459Z sha 7447d9d :: blocked before merge. :: [P2] Run skipped preflight before resuming an observed turn
  • reviewed 2026-11-22T03:39:45.709Z sha a7455cc :: needs changes before merge. :: [P2] Update the channel-turn fixture for the selected transcript reader | [P3] Correct the obsolete reply-completion guarantee in the description

Reviewed November 22, 2026, 1:18 PM ET / 18:18 UTC (Revision 18).

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Sep 27, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 27, 2026
@mcaxtr
mcaxtr force-pushed the feat/group-decision-participation branch from 683c312 to 53c87ba Compare September 27, 2026 14:56
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 27, 2026
@mcaxtr
mcaxtr force-pushed the feat/group-decision-participation branch from 87c26f7 to 5f50e79 Compare September 27, 2026 22:35
@jalehman
jalehman force-pushed the feat/group-decision-participation branch from 5f50e79 to d6ed1ea Compare September 30, 2026 22:20
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 30, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Oct 1, 2026
@clawsweeper clawsweeper Bot removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 1, 2026
Restore main typing, steering cleanup and reply completion behavior. Keep Decision participation, input custody and normal generation/delivery.

mcaxtr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: whatsapp-web Channel integration: whatsapp-web docs Improvements or additions to documentation extensions: codex gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants