Skip to content

fix(channels): dispatch replies in ACP-bound conversations - #149801

Closed
ZengWen-DT wants to merge 1 commit into
openclaw:mainfrom
ZengWen-DT:fix/146365-acp-dispatch-owner
Closed

ZengWen-DT wants to merge 1 commit into
openclaw:mainfrom
ZengWen-DT:fix/146365-acp-dispatch-owner

Conversation

@ZengWen-DT

@ZengWen-DT ZengWen-DT commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #146365

What Problem This Solves

Fixes: text follow-ups in Discord and Matrix conversations bound to a spawned ACP session can fail with prepared reply dispatch runtime owner was not published when the harness is not a configured Gateway agent.

User Impact

Text follow-ups retain the configured channel agent for reply-runtime admission while ACP execution, session storage, and transcript identity keep the bound harness target. No configuration or stored-data migration is introduced.

Native Discord slash commands remain outside this change, so this PR does not close the broader issue.

Why This Change Was Made

Conversation bindings rewrite the routed agent and session to the ACP target. The optional reply-dispatch owner preserves the configured source agent across the Discord and Matrix inbound-context builders. The refreshed implementation retains current main's route-observation symbols, asynchronous binding activity checks, and revoked-binding revalidation. Callers that omit the field retain the previous source-session fallback.

AI-assisted: yes. The refreshed code and sanitized local evidence were independently reviewed.

Evidence

  • Refreshed onto main fd2fa6b904a2069bf9c2c150302475dffdc51e29 to incorporate upstream fixes for both prior CI roots: restored script lint directives (392166d0) and the prepared-catalog import-cycle repair (80bfd0f5).
  • ACP production behavior is unchanged from the reviewed repair (+20/-3 lines). The refresh preserves upstream runtime-lease propagation and disposal; the relocated two-case regression now retains the upstream onRuntimeLease assertion. Optional-owner fallback, binding observations/revalidation, and harness-scoped execution/storage remain covered.
  • On the refreshed tree 0159e2b0ee280f9f1102e4eb4c1be2f80e986767, 188 tests in ten files passed in 202.278 seconds total command wall, including cold worker preparation. These cover dispatch ownership/lifecycle, binding activity and revocation, shared context/routing, Discord preflight/context/binding, and Matrix routing/binding observation.
  • Native runtime-import and Madge checks passed with zero cycles (25.609s and 25.537s). The canonical full scripts lint owner passed (47.243s), directly exercising the scope that failed in CI. An initial single-file lint probe reported the restored directives unused; that narrower Program is not the CI scope, and its result is retained in the diagnostics.
  • Canonical messaging and plugin-SDK test type graphs passed (144.523s combined). Conflict, line-cap, max-lines, assertion-safety and formatting checks passed; changed-core type-aware lint passed.
  • Independent native review and fresh canonical AutoReview were scoped-clean at P0–P2. The earlier red control (removing only the owner override) remains historical evidence of the same owner-selection defect; it was not rerun on this refreshed base.
  • The complete native changed aggregate and a new extension-wide type/lint sweep were not rerun for this refresh. Earlier local scoped extension checks belong to the prior tested base. The completed hosted CI below is separate evidence and does not relabel the unrun local aggregate.
  • Source composition with subsequently observed main 447144510b899463ee89774b62d015631d3bd891 is clean and preserves the exact main-relative ACP patch. Local runtime/type results belong to pinned fd2fa6b9, not that later composition.

Live proof remains outstanding: the dispatch regression mocks runtime publication, ACP execution and delivery; it does not establish real runtime-lease acquisition or configured-owner admission followed by real harness execution and receipt in Discord or Matrix. Before merge, provide current-candidate after-fix channel/harness evidence plus unauthorized-sender and removed/reassigned-binding rejection before ACP I/O. Existing local negative controls do not establish the full cross-owner channel path.

Publication and prior CI/review

  • Current published head: a9c6c0551fcc68851d3bbf795af3aedb792b8c2a, one commit on tested fd2fa6b9, exact tree 0159e2b0ee280f9f1102e4eb4c1be2f80e986767. Exact-head CI 37886818337 completed successfully: 55 successful jobs, 25 skipped, no failures. The required openclaw/ci-gate, dependency review, and applicable security-review statuses are success. Hosted architecture and full lint both passed, clearing the two previous CI roots.
  • Prior-head CI 37877414792 on eaabfe1 finished with 52 successful and 25 skipped jobs, two root failures and the failed aggregate. Madge matched a failing main control; the script lint failure was attributed by source comparison to newer-main removal of the directives, without a matching failed-main runtime claim. The refreshed executed checks above now pass both failing scopes.
  • The current-head review at a9c6c055 found no concrete introduced bypass or actionable code defect, and removed the compatibility risk label. It lists two remaining checklist items: real channel/harness behavior proof and a medium security concern that cross-owner unauthorized-sender or removed/reassigned-binding denial lacks final-effect evidence before real ACP I/O. Both remain open; green CI does not satisfy this proof requirement.

@clawsweeper

clawsweeper Bot commented Sep 16, 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 channel: discord Channel integration: discord channel: matrix Channel integration: matrix size: S labels Sep 16, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Preserves the configured channel agent for reply-runtime admission while Discord and Matrix text follow-ups execute in their bound Agent Client Protocol (ACP) harness session.

Example: Send “continue” in Discord conversation C123 bound to agent:opencode:acp:bound-session.

  • Before: Dispatch selects opencode as the runtime owner and fails when only main has a published runtime.
  • After: Dispatch selects main for runtime admission while opencode executes the turn and produces “Bound ACP reply” in the regression fixture.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused repair is useful and source-consistent, but synthetic coverage leaves the cross-owner runtime boundary unproven.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Text messages in a conversation bound to an external ACP harness can produce no reply because the harness is mistaken for a configured Gateway agent.
Reason: This restores the owner separation established by the earlier merged ACP repair. The body correctly uses Related because native Discord slash commands in the canonical report remain outside its scope.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR addresses a source-confirmed defect still present on current main. No concrete introduced code defect was found, and the overlapping proposals do not provide a proven replacement.

Priority: P1
Reviewed head: a9c6c0551fcc68851d3bbf795af3aedb792b8c2a

Before merge

  • Add real behavior proof - Authority-chain proof required: provide current-candidate Discord or Matrix logs or terminal output showing configured-owner runtime admission, real bound-harness execution, and channel receipt, plus unauthorized-sender and removed/reassigned-binding rejection before ACP I/O. The body explicitly leaves these scenarios outstanding, and the regression mocks publication, storage, execution, and delivery. Redact credentials, IP addresses, phone numbers, private endpoints, and user data. No stored-data contract changes are introduced. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - No concrete bypass or supply-chain regression was found; the changed cross-owner admission boundary still lacks final-effect proof.

Findings

None.

Tests

  • Missing end-to-end proof: Show a current-candidate Discord or Matrix follow-up reaching a real harness and returning a reply, with unauthorized-sender and removed/reassigned-binding rejection before ACP I/O; the failing control was not repeated on the refreshed base.
Agent review details

How this fits together

Channel routing selects an OpenClaw agent, and conversation bindings can redirect a message to an external ACP harness. Reply dispatch needs the configured agent’s published runtime while the bound harness retains execution, storage, and transcript identity.

flowchart TD
  A[Discord or Matrix message] --> B[Channel access and routing]
  B --> C[Current conversation binding]
  C --> D[Configured reply owner]
  C --> E[Bound harness session]
  D --> F[Published runtime admission]
  F --> G[Revalidate binding and execute]
  E --> G
  G --> H[Channel reply]
Loading

Technical review

Best possible solution:

Keep configured runtime admission separate from harness execution and storage while preserving sender authorization and current-binding checks.

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

Yes, from source: a bound channel route replaces the configured agent with the harness identity, which cannot load a configured-only published runtime. The linked report supplies live failures; this review did not execute target code.

Is this the best way to solve the issue?

Yes for text follow-ups: preserving the configured admission owner repairs the established contract without changing harness session identity. Native Discord slash commands remain outside this patch.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: unit tests only.

Security

Needs attention: No concrete bypass or supply-chain regression was found; the changed cross-owner admission boundary still lacks final-effect proof.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit a3b4c0a adds src/auto-reply/reply/dispatch-from-config.gather.ts:329 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a3b4c0aa7196; files: src/auto-reply/reply/dispatch-from-config.gather.ts)

PR surface

Source +17, Tests +54. Total +71 across 17 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 10 20 3 +17
Tests 7 237 183 +54
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 257 186 +71

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #146365
Summary: This PR is a partial candidate repair for the configured-owner versus ACP-harness dispatch mismatch.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The existing defect prevents bound Discord and Matrix ACP conversations from delivering follow-up turns.
  • merge-risk: 🚨 security-boundary: Configured runtime admission now reaches a separate harness identity, requiring final-effect evidence that sender and binding authority remain enforced.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record final-effect rejection of an unauthorized sender and a removed or reassigned binding before the real ACP harness receives input.

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 (6 earlier review cycles)
  • reviewed 2026-09-16T06:35:55.944Z sha 7f40532 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-24T18:06:43.664Z sha 7f40532 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-05T14:00:02.048Z sha 7f40532 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-09T03:10:45.041Z sha eaabfe1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-09T03:22:54.069Z sha eaabfe1 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-09T05:10:55.600Z sha a9c6c05 :: needs real behavior proof before merge. :: none

Reviewed October 9, 2026, 1:22 AM ET / 05:22 UTC (Revision 7).

@jmar5439

jmar5439 commented Oct 5, 2026

Copy link
Copy Markdown

Related: #165517 carries the same #146365 dispatch-owner fix through the generic route spread (plus reply scope and fast-path init), which is what Telegram-bound harness turns need — this PR's Discord/Matrix monitor-level coverage doesn't reach them. Flagging the overlap on dispatch-from-config.gather.ts / templating.ts so whichever lands second can trim cleanly.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Oct 5, 2026
@ZengWen-DT
ZengWen-DT force-pushed the fix/146365-acp-dispatch-owner branch from 7f40532 to eaabfe1 Compare October 9, 2026 03:02
@ZengWen-DT
ZengWen-DT force-pushed the fix/146365-acp-dispatch-owner branch from eaabfe1 to a9c6c05 Compare October 9, 2026 05:04
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Oct 9, 2026
@ZengWen-DT ZengWen-DT closed this Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: matrix Channel integration: matrix merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants