Repository navigation
fix(plugins): channel plugin commands never receive native subagents or scheduled turns - #180968
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherChannel 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +206, Tests +419, Docs +9. Total +634 across 12 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
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.
defa3f9 to
2c343b6
Compare
|
@clawsweeper re-review Head
The body also notes the known gap: queued channel children are not settled on revocation. That gap is pre-existing and has no effect. |
|
🦞👀 Re-review progress:
|
…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.
What Problem This Solves
Fixes: plugin commands typed in Slack, Discord or another channel never receive
ctx.runtimeContext.subagentsorscheduledTurns. 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.undefined.Why This Change Was Made
This is a product gap, not a documentation bug.
channeland tests with real channel admin ingress. However, those tests injected the two pieces only Gatewaychat.sendcreates: a run id and a user-turn recorder. Real channel dispatch never creates them, so the gate always declined.What changes:
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.adminperson.Evidence
Verified on
mainfirst (d535d27). An authorized, admin-linked Discord sender ran/review-panelthrough real channel dispatch, and the handler sawsubagents === undefined. An instrumented gate showedoperatorAuthority: 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 thatserver-channelsuses for channel accounts. The test does not inject a run id, recorder or request scope.main)list), scheduled turns only when declared, redacted input committed once per messagecontinueAgent: one committed input, agent run admittedspawnrejects with "Channel operator authority changed"undefined, nothing committedEnd-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 settools.swarm.maxConcurrent: 1andcommands.allowFrom: { slack: ["*"] }. A personal profile with anoperator.adminrole was linked to Slack senderU0123456789. All 6 scenario steps passed./chanproofsubagents: trueandscheduledTurns: true. Its child finishesdonewithCHAN-AUTHORIZED-CHILD-OK; the provider received anagent-initialrequest carrying that child's marker. The schedule is enrolled (survivesRestart: true).cron.runforces an occurrencedonewithCHAN-SCHEDULED-CHILD-OKand reaches the provider (agent-initial).U9876543210sends/chanproof(the channel authorizes it)subagents: false,scheduledTurns: false, 0 child provider requests.users.setRoleerror: "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.runafter the demotionerror: "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.waitstill reportedtimeoutafter about 90 s, including aftersessions.aborton 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, includingsessions_spawnfrom 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):
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.tspasses, with two edits:commands-plugin.scheduled-turns.test.ts. Since feat(plugins): keep requester command schedules across Gateway restarts #180844 moved that file's ingress import intocommands-plugin.scheduled-turns.test-support.ts, the planner no longer selects it, and this expectation already fails onmain(60c92913).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:
packages/aiTS2353 diagnostic frommain.check:changedhas no failures from this diff. The remaining ones also fail onmain:ui/;autoreview(Codex, branch mode againstorigin/main): scoped-clean, patch correct (0.88). Its sandbox saw only the diff, not the full repository.