Skip to content

fix(agents): gate ask_user by channel capability - #130223

Merged
steipete merged 11 commits into
openclaw:mainfrom
jacobtomlinson:fix/mattermost-question-reply-dismiss
Oct 16, 2026
Merged

steipete merged 11 commits into
openclaw:mainfrom
jacobtomlinson:fix/mattermost-question-reply-dismiss

Conversation

@jacobtomlinson

@jacobtomlinson jacobtomlinson commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #161445
Fixes #167469
Related: #111470

What Problem This Solves

ask_user can start a question on a channel that cannot reliably deliver or complete it: WhatsApp DMs fail with REPLY_DISPATCH_DELIVERY_ERROR, and Mattermost turns can wait on an unseen question.

User Impact

Eligible primary sessions retain structured questions on WebChat/native OpenClaw clients, Discord, Slack, and Telegram. On Mattermost, iMessage, Signal, WhatsApp, and undeclared channels, the agent asks in ordinary plain text. Explicit tool denial still wins. Approval reactions remain unchanged.

Peter's product decision is to gate built-in ask_user by declared native question input and retire bundled question-reaction fallbacks. This addresses the built-in ask_user failure reported in #167469 by omitting the tool from Mattermost. The separate native Claude AskUserQuestion path also mentioned in that report bypasses this catalog and remains outside this fix.

Why This Change Was Made

The conversation capability owner resolves questionInputMode once from the authoritative inbound channel. Coding tools, Gateway catalogs, and skill dispatch carry that fact into registration; a supported fallback provider cannot enable questions on an unsupported inbound surface.

Bundled question-reaction adapters and obsolete tests are removed. The reaction SDK factory and members shipped in stable v2026.9.8 remain unchanged for third-party compatibility, with no removal date. The only additive SDK contract is optional agentPrompt.questionInputMode: "buttons", documented on the existing channel adapter; no new named export is needed.

Docs name the supported surfaces and explain plain-text questions elsewhere. A nearby CI fixture defect is also fixed: the final iMessage self-chat test left fake timers active during asynchronous database teardown. One file-level cleanup hook now replaces two incomplete per-suite hooks, without changing assertions or timeouts. No schema, retention, or new deferred side effect is introduced.

Original fix by @jacobtomlinson; maintainer cleanup reconciles current main, completes direct-catalog propagation, preserves shipped SDK contracts, and updates docs and regression coverage.

Evidence

Exact-head PR CI completed successfully on attempt 2 for c6443b005a44f4679d6257f2b5213ad3d586c217, after merging main d372cddb9f: 59 jobs passed and 27 were skipped. The previously failing Slack shard and aggregate gate passed on the latest attempt. PR CI is the test and typecheck gate per maintainer policy. Local tests, local typechecks, negative controls, live Gateway proof, and remote leases were intentionally skipped.

  • ask_user channel catalogs in channel-catalog.contract.test.ts: ten cases using real bundled declarations through the existing public-artifact loader; supported/unsupported channels, authoritative inbound selection, and explicit denial.
  • gates ask_user in the $messageProvider catalog (deny: $deny): three real Gateway catalog cases.
  • gates ask_user on the inbound $message.surface surface (deny: $deny): four real skill-dispatch cases, including unknown inbound surface with a supported provider.
  • Retained supported-flow coverage includes publishes the prompt through Bot API and completes after the answer, cached-question authority, and approval-reaction/partial-delivery tests.

Changed-file core oxlint, oxfmt, and git diff --check passed. The temporary lint config preserved every applicable core rule and omitted only an unmatched UI-only Solid override whose dependency was absent from the supplied install. Docs sanity passed on all ten changed pages. Full isolated Codex autoreview and each subsequent repair review were scoped-clean through P2.

Prior-head CI exposed and guided three repairs: use the public-artifact loader in an existing collected contract suite; retain SDK exports without increasing the deprecated-export ratchet; restore real timers before iMessage teardown. No baseline, assertion, or timeout was weakened. Current-head CI passed all 18 tests in channel-catalog.contract.test.ts, including the ten-case matrix, in a 52.50s shard (76% transformation, 16% tests). Production/test typechecks, lint, docs, baseline, boundary, and the previously failing iMessage shard passed. Earlier CI also ran the retained Telegram round-trip in 8.330s and passed the four new skill-dispatch cases; those timings are prior-head evidence.

ClawSweeper's direct-catalog and shipped-SDK findings are addressed. Its Mattermost support concern is superseded by the product decision above. Live-proof-only requests are superseded by the maintainer proof policy.

Exact numstat against merged main: production +50/−415 (−365), tests +129/−458 (−329), docs +75/−35 (+40); total +254/−908 (−654) across 42 files. The 17 new catalog cases add no timers, sleeps, network calls, or test-only production seams.

Earlier CI failure: attempt 1's job 116812813808, checks-node-changed-extensions-bundle-1-1, failed extensions/slack/src/monitor/provider.auth-test-token.test.ts / does not use a user-token identity as the bot mention target with StateDatabaseAccessError: ... is undergoing offline maintenance; retry when it finishes. The coordinator diagnosed a test-state flake; the PR's only Slack change is the declarative questionInputMode: "buttons". The failed job was rerun, and the same exact-head shard passed on attempt 2. This is a successful retry, not a claim that the flake itself was repaired. The current-head security-sensitive review status is successful; no approval command was posted.

Feishu #111470 is related: its undeclared surface is gated, but this PR does not claim to repair Feishu choice-card delivery.

@clawsweeper

clawsweeper Bot commented Aug 26, 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 channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web agents Agent runtime and tooling channel: qa-channel Channel integration: qa-channel size: XL maintainer Maintainer-authored PR labels Aug 26, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR limits built-in ask_user to declared question-capable channels and retires bundled question reactions while preserving the public SDK.

Example: An owner in a WhatsApp DM asks the agent to choose between options A and B.

  • Before: The agent can invoke ask_user, whose prompt delivery can fail before either option appears.
  • After: The WhatsApp catalog omits ask_user, allowing the agent to ask an ordinary text question.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch resolves both previous findings and has successful current-head gates; behavior evidence remains at the in-process catalog boundary.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-owned PR is outside the ordinary contributor proof gate; supplied coverage exercises real catalog construction in-process, while no current-head shipped-entry-point demonstration is provided.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An agent can open a structured question on a channel where its prompt cannot reliably reach the person.
Reason: The maintainer-owned revision accepts ordinary text questions on undeclared channels, documents the capability reduction, and preserves supported catalogs and third-party SDK contracts.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still lacks this capability gate, both prior findings are addressed, and the latest exact-head CI gates pass; no new actionable defect was found.

Priority: P1
Reviewed head: c6443b005a44f4679d6257f2b5213ad3d586c217

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No base-failing run or shipped Gateway flow demonstrating the new catalog gate and subsequent ordinary-text exchange is supplied.
Agent review details

How this fits together

Conversation capability preparation combines the inbound channel declaration with existing session and tool policies to produce the agent's available tools; supported questions continue through the existing Gateway question and delivery owners.

flowchart TD
  A[Inbound conversation] --> B[Channel question capability]
  B --> C[Prepared conversation profile]
  C --> D[Tool catalog and policy]
  D --> E[Gateway question runtime]
  E --> F[Native controls and answers]
  D --> G[Ordinary text conversation]
Loading

Technical review

Best possible solution:

Retain the shared capability gate across all catalog paths, preserve shipped SDK contracts, and keep native harness delivery work separate.

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

The affected-release report supplies a concrete WhatsApp failure, and source confirms main still offers ask_user without this channel gate; no runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

The implementation follows the recorded product decision, uses one capability owner, completes the previously missing catalog propagation, and avoids unnecessary SDK removal.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 08be5ab0bf48.

Provenance checked

  • Primary-session question availability changes intended behavior with a stated reason (da44d52: The original feature supplied a provider-neutral structured question and answer flow; the current revision explains why availability must now depend on channel support.)
  • Bundled question-reaction adapters changes intended behavior with a stated reason (d7de67a: The follow-up added reaction answering on WhatsApp, Signal, and iMessage; the current maintainer direction explicitly retires that bundled behavior.)
  • Shared reaction SDK keeps the original intent (f5e3b5e: The refactor centralized reaction-target lifecycle and Gateway resolution while leaving transport identity with plugins; this revision retains that shipped public owner unchanged.)
  • Signal partial-delivery coverage keeps the original intent (85cec65: Accepted partial deliveries must retain usable controls; only obsolete question-reaction coverage is removed, while approval and remaining partial-delivery cases stay.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source -365, Tests -329, Docs +40. Total -654 across 42 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 23 50 415 -365
Tests 9 129 458 -329
Docs 10 75 35 +40
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 42 254 908 -654

Review metrics

Metric Value Why it matters
Production versus tests Production +50/−415; tests +129/−458 Retiring bundled reaction adapters removes their obsolete tests; new catalog coverage protects the previously missed construction paths.
Public capability contract 1 optional channel adapter member; 0 removed SDK exports Channels opt into structured questions through agentPrompt.questionInputMode while existing reaction SDK imports remain compatible.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: The linked release report establishes a real-user question-delivery failure, and related unsupported-channel flows can wait on unseen prompts.
  • merge-risk: 🚨 compatibility: The optional public channel declaration changes default tool availability for undeclared channels; the maintainer-owned revision explicitly accepts that tradeoff and retains shipped SDK exports.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 (3 earlier review cycles)
  • reviewed 2026-08-26T17:06:26.507Z sha 7395b9e :: needs changes before merge. :: [P1] Propagate question capability to direct tool surfaces
  • reviewed 2026-09-04T22:48:22.036Z sha 7395b9e :: blocked before merge. :: [P1] Propagate question capability to direct tool surfaces
  • reviewed 2026-10-07T08:43:02.528Z sha 7395b9e :: blocked before merge. :: [P1] Propagate question capability to direct tool surfaces | [P1] Retain the shipped question-reaction SDK during retirement

Reviewed October 16, 2026, 1:29 AM ET / 05:29 UTC (Revision 4).

steipete and others added 2 commits October 15, 2026 20:56
Prepare question input capability from the inbound channel for coding, Gateway, and skill tool catalogs. Retire bundled question reactions while retaining approval handling and shipped SDK compatibility. Document supported surfaces and add catalog regressions.

Fixes openclaw#161445. Related: openclaw#167469; native Claude questions remain separate.

Co-authored-by: Jacob Tomlinson <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the channel: line Channel integration: line label Oct 16, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: mattermost Channel integration: mattermost gateway Gateway runtime labels Oct 16, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 16, 2026
@steipete
steipete merged commit fe160eb into openclaw:main Oct 16, 2026
248 of 251 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* fix(agents): gate ask_user by channel capability

* test(channels): keep question catalogs within public contracts

Move the real-plugin question catalog regression into the shared channel contract suite. Retain the shipped question SDK unchanged and document compatibility without expanding the deprecated-export ratchet.

* test(channels): load question catalog fixtures through public artifacts

* test(channels): collect question catalogs in the existing contract suite

* test(imessage): restore real timers before database cleanup

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Jacob Tomlinson <[email protected]>
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: discord Channel integration: discord channel: imessage Channel integration: imessage channel: line Channel integration: line channel: mattermost Channel integration: mattermost channel: qa-channel Channel integration: qa-channel channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

2 participants