Skip to content

fix(plugins): channel plugin commands never receive native subagents or scheduled turns - #180968

Merged
fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/channel-command-native-capabilities
Oct 22, 2026
Merged

fuller-stack-dev merged 1 commit into
openclaw:mainfrom
fuller-stack-dev:fix/channel-command-native-capabilities

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes: plugin commands typed in Slack, Discord or another channel never receive ctx.runtimeContext.subagents or scheduledTurns. This happens even for an authorized sender who has operator authority, although the docs describe channel senders as eligible. The S6 follow-up proof (#180282) found the gap in the command capability added by #180173.

User Impact

User impact: some channel senders can now use a plugin command's declared native helpers and scheduled continuations from channel text, as Gateway chat clients already can. The sender must have a verified identity linked to a person whose current role grants operator.admin, and the channel must authorize them for the command.

  • Unlinked, unverified, demoted or unauthorized senders still see undefined.
  • No configuration change is needed.

Why This Change Was Made

This is a product gap, not a documentation bug.

  • The authority model already covers channel senders. Channel ingress binds the verified sender's operator authority. It is the same admitted-run authority type Gateway clients use, with the same live identity and role rechecks. It also carries a channel recovery source that scheduled turns can restore.
  • feat(plugins): let authenticated commands launch native subagents #180173 already expected channel ingress. It labels the admission channel and tests with real channel admin ingress. However, those tests injected the two pieces only Gateway chat.send creates: a run id and a user-turn recorder. Real channel dispatch never creates them, so the gate always declined.

What changes:

  • Run id and recorder. For channel ingress only, the host now creates them. It does so only when the reply's operator authority is exactly the one ingress bound to the message's verified sender, so a caller cannot lend a message someone else's authority.
  • Gate unchanged. Command authorization, the command's declaration, the requester's native tool policy, run admission and per-call authority rechecks still decide, as on the Gateway.
  • One transcript entry per message. The committed input uses the message's source turn id (a stable id per channel message). A continuing agent turn and restart recovery join that entry instead of adding a duplicate.
  • Redaction preserved. The committed input uses the same redacted form the delivered-command transcript mirror records. That mirror now records only the reply once a native command has committed the input.

Docs: The previous "authorized non-owner" wording now applies only to Gateway chat. On channels, operator authority requires a channel identity link to an operator.admin person.

Evidence

Verified on main first (d535d27). An authorized, admin-linked Discord sender ran /review-panel through real channel dispatch, and the handler saw subagents === undefined. An instrumented gate showed operatorAuthority: true, runId: false, recorder: false, which matches the S6 Slack trace.

New test src/auto-reply/reply/commands-plugin.channel-native.test.ts. It sends text through the real path: host channel ingress, dispatchInboundMessage, getReplyFromConfig, then a plugin command loaded from disk. Channel dispatch runs inside the same Gateway context resolver scope that server-channels uses for channel accounts. The test does not inject a run id, recorder or request scope.

Case Before (production code from main) After
Discord with role authority: live runtime (list), scheduled turns only when declared, redacted input committed once per message ❌ ✅
Slack with identity-grant authority: same checks ❌ ✅
continueAgent: one committed input, agent run admitted ❌ ✅
Demotion during the handler: spawn rejects with "Channel operator authority changed" ❌ ✅
Channel-unauthorized command: refused, handler not called ✅ ✅
Unlinked, unverified, borrowed-authority and demoted senders: undefined, nothing committed ✅ ✅

End-to-end proof through signed Slack HTTP ingress. This is a proof-only QA Lab run and is not committed. It used Crabline's local Slack provider, the real Slack plugin, an ephemeral Gateway built from this head, mock-openai, and a third-party plugin loaded from disk. The config set tools.swarm.maxConcurrent: 1 and commands.allowFrom: { slack: ["*"] }. A personal profile with an operator.admin role was linked to Slack sender U0123456789. All 6 scenario steps passed.

Step Observed result
Linked operator sends /chanproof The handler gets subagents: true and scheduledTurns: true. Its child finishes done with CHAN-AUTHORIZED-CHILD-OK; the provider received an agent-initial request carrying that child's marker. The schedule is enrolled (survivesRestart: true).
cron.run forces an occurrence The restored channel requester's child finishes done with CHAN-SCHEDULED-CHILD-OK and reaches the provider (agent-initial).
Unlinked sender U9876543210 sends /chanproof (the channel authorizes it) subagents: false, scheduledTurns: false, 0 child provider requests.
Linked operator starts a capacity holder plus a queued child, then is demoted with users.setRole The holder, released after the demotion, ends error: "source execution authority is no longer active | Channel operator authority changed; send a new request." The queued child never starts. There were 0 provider requests for either child after the demotion.
cron.run after the demotion The run ends error: "Queued channel operator authority changed; submit a new request." The plugin is not invoked and there are 0 provider requests.

A control run without the demotion launches the queued child as soon as its holder finishes, and that child reaches the provider. So the demotion is what stops the queued child.

Known gap, not introduced here. After the demotion, the queued child does not settle as failed. agent.wait still reported timeout after about 90 s, including after sessions.abort on the finished holder. Gateway operator authority aborts its revocation signal when a role changes, so its queued children settle immediately. Channel operator authority has no such signal for role-based links. This is pre-existing for every channel-origin swarm child, including sessions_spawn from a channel agent turn, and it never allowed an effect. I'll propose giving channel operator authority a revocation signal as a separate follow-up rather than widening this PR.

Mutation checks (each reverted afterwards):

  • Dropping the source-keyed id fails three cases.
  • Dropping the mirror's committed-input flag fails three cases.
  • Dropping the authority-identity check fails the denial case.
  • Dropping the redaction fails both positive cases.

Affected suites at head (rebased on 60c92913): 14 files, 305 tests, all passing. They cover the #180173 native-subagent tests, the #180282 and #180844 scheduled-turn and restart tests, plugin command and owner tests, command and inline-command transcripts, session transcripts, channel operator authority, command refusal, the subagent production boundary, and the ACP and allowlist owner tests.

CI changed-plan owner test. ci-changed-node-test-plan.source-owners.test.ts passes, with two edits:

Cost (pnpm test <file> --maxWorkers=1): about 19 s of test time and 37 s wall; the first case includes about 5 s of cold imports. This end-to-end path through channel ingress is the contract under test. The earlier unit-level injection in #180173 hid exactly this gap.

Local checks:

  • Type-aware oxlint and oxfmt pass on the changed files.
  • tsgo core plus the messaging and config test graphs report only the existing packages/ai TS2353 diagnostic from main.
  • check:changed has no failures from this diff. The remaining ones also fail on main:
    • max-lines suppressions in ui/;
    • the advisory test-root budget, which reports the same counts with this test removed;
    • that TS2353 diagnostic;
    • existing dead exports.
  • Local autoreview (Codex, branch mode against origin/main): scoped-clean, patch correct (0.88). Its sandbox saw only the diff, not the full repository.

@clawsweeper

clawsweeper Bot commented Oct 22, 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 plugin: file-transfer size: L labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR supplies eligible channel plugin commands with requester-bound run identities and transcript recorders so they can use native helpers and scheduled turns.

Example: Admin-linked Slack sender U0123456789 invokes /chanproof.

  • Before: The command receives neither subagents nor scheduledTurns despite valid operator authority.
  • After: The command receives its declared capabilities, and both its immediate child and scheduled-occurrence child reach the provider.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with production-entry-point results, meaningful integration coverage and green exact-head gates.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The updated body records this head running through signed Slack HTTP ingress, the real channel plugin, an isolated Gateway and a local provider transport: immediate and scheduled children complete, an unlinked sender receives no capability, and demotion prevents held, queued and subsequent scheduled effects before provider I/O. The authorized queued control reaches the provider. This satisfies the previous review's requested scenarios; the inspected UI screenshots are unrelated and are not relied upon.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Authorized, admin-linked channel users cannot invoke plugin commands' declared native helpers or scheduled continuations.
Reason: The maintainer-authored change restores documented eligibility without adding configuration or a competing execution owner.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current channel-command capability gap. No blocking defect remains, and the updated evidence addresses the previous authority-chain request.

Priority: P2
Reviewed head: 2c343b64513734eaf5f4d57ec6f4bc9b630bad01

Before merge

None.

Findings

None.

Agent review details

How this fits together

Channel ingress establishes sender authority; reply dispatch supplies command-turn identity and transcript commitment, then the existing native runtime governs helper execution and scheduling.

flowchart TD
  A[Channel message] --> B[Verified sender authority]
  B --> C[Reply dispatch]
  C --> D[Command turn recorder]
  D --> E[Existing native capability gate]
  E --> F[Native child execution]
  E --> G[Requester scheduled occurrence]
Loading

Technical review

Best possible solution:

Land the focused channel adapter using the existing admission and transcript owners, leaving the independently reported revocation-settlement gap to its shared authority owner.

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

Current-main source shows the missing run-ID and recorder prerequisites, and the PR records the matching Discord reproduction; no target code was executed during this review.

Is this the best way to solve the issue?

The adapter is a focused repair: it supplies missing channel-turn facts while retaining the existing capability, authorization, admission and persistence owners.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Native command admission keeps the original intent (7ba05b6: Expose explicitly declared delegation under current requester authority, committed user input and the existing tool ceiling.)
  • Command transcript recording and redaction keeps the original intent (289d859: Retain delivered command exchanges without duplicate inputs or persisted credential-bearing command text.)
  • Changed-test ownership inventory keeps the original intent (dfe0396: The restart-continuity change moved shared ingress setup into scheduled-turn test support; the corrected expectation follows the remaining direct imports.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit 7ba05b6 adds src/auto-reply/reply/dispatch-native-subagent.ts:126 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7ba05b683647; files: src/auto-reply/reply/dispatch-native-subagent.ts)
  • Ayaan Zaidi: Raw commit 289d859 adds src/config/sessions/command-transcript.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 289d859c2bab; files: src/config/sessions/command-transcript.ts)
  • Peter Steinberger: Raw commit 668e5e8 adds src/auto-reply/reply/dispatch-from-config.transcript.ts:22 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 668e5e8096ad; files: src/auto-reply/reply/dispatch-from-config.transcript.ts)

PR surface

Source +206, Tests +419, Docs +9. Total +634 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 7 248 42 +206
Tests 4 421 2 +419
Docs 1 12 3 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 681 47 +634

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: A bounded plugin-command workflow is unavailable to eligible channel users; ordinary channel messaging remains functional.
  • merge-risk: 🚨 compatibility: Existing optional plugin capabilities become operational for eligible channel commands, with the intended behavior documented and approved by the maintainer-authored direction.
  • merge-risk: 🚨 security-boundary: The adapter admits requester-bound model and scheduling effects from channel ingress; exact authority binding, existing live checks and the supplied forbidden/revoked scenarios address this boundary.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 (1 earlier review cycle)
  • reviewed 2026-10-22T20:59:20.907Z sha defa3f952ede0067d0fec2d9cd4bcb1898a4d053 :: needs real behavior proof before merge. :: none

Reviewed October 22, 2026, 5:52 PM ET / 21:52 UTC (Revision 2).

Plugin commands typed in Slack, Discord and other channels never received
the command-scoped native subagents (openclaw#180173) or scheduled turns
(openclaw#180282), although the docs describe authorized channel senders as
eligible. Channel ingress already binds the verified sender's operator
authority, but the native gate also required a Gateway chat.send run id
and user-turn recorder, which channel dispatch never supplies.

For channel ingress only, the host now mints that run id and recorder,
and only for the operator authority host ingress bound to the message's
verified principal. The existing gate is unchanged: command authorization,
the declared capability, the requester's native tool policy, admission
and per-call authority rechecks still decide. Unlinked, unverified,
demoted or unauthorized senders keep seeing no capability.

The committed input uses the message's route-scoped source turn id, so a
continuing agent turn and restart recovery join it, and it stores the
same redacted form the delivered-command transcript mirror records. That
mirror now records only the reply once a native command committed the
input.
@fuller-stack-dev
fuller-stack-dev force-pushed the fix/channel-command-native-capabilities branch from defa3f9 to 2c343b6 Compare October 22, 2026 21:09
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Head 2c343b64513734eaf5f4d57ec6f4bc9b630bad01 is rebased on main 60c92913, so the merge conflict is resolved. The PR body now includes end-to-end proof through signed Slack HTTP ingress:

  • allowed: a channel-origin child and a scheduled-occurrence child both reached the provider;
  • forbidden: an unlinked sender got no capability and no provider I/O;
  • revoked: after demotion, the held child was refused before provider I/O, the queued child never started, and a post-demotion occurrence was refused before the plugin ran.

The body also notes the known gap: queued channel children are not settled on revocation. That gap is pre-existing and has no effect.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 22, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 1a82e93 into openclaw:main Oct 22, 2026
173 of 174 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/channel-command-native-capabilities branch October 22, 2026 21:58
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…openclaw#180968)

Plugin commands typed in Slack, Discord and other channels never received
the command-scoped native subagents (openclaw#180173) or scheduled turns
(openclaw#180282), although the docs describe authorized channel senders as
eligible. Channel ingress already binds the verified sender's operator
authority, but the native gate also required a Gateway chat.send run id
and user-turn recorder, which channel dispatch never supplies.

For channel ingress only, the host now mints that run id and recorder,
and only for the operator authority host ingress bound to the message's
verified principal. The existing gate is unchanged: command authorization,
the declared capability, the requester's native tool policy, admission
and per-call authority rechecks still decide. Unlinked, unverified,
demoted or unauthorized senders keep seeing no capability.

The committed input uses the message's route-scoped source turn id, so a
continuing agent turn and restart recovery join it, and it stores the
same redacted form the delivered-command transcript mirror records. That
mirror now records only the reply once a native command committed the
input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation 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. P2 Normal backlog priority with limited blast radius. plugin: file-transfer proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

1 participant