Repository navigation
fix: allow trusted scheduled Discord channel edits - #150182
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: blocked before merge. Reviewed September 16, 2026, 11:57 PM ET / September 17, 2026, 03:57 UTC (Revision 6). ClawSweeper reviewWhat this changesAllows trusted operator-created scheduled jobs to edit Discord channels, carrying live authorization through lookups and retries while preserving accepted edit results after cancellation. Merge readiness⛔ Blocked before merge - 4 items remain This PR remains useful and has convincing authority-boundary proof, with no actionable code findings. The documented SDK authority expansion still needs explicit owner acceptance; the merged read prerequisite does not replace this work. Priority: P2 Review scores
Verification
How this fits togetherScheduled agents invoke the shared message tool through embedded execution or generated MCP access. The Gateway validates their job authority and dispatches approved actions through the Discord plugin to its HTTP transport. flowchart TD
A[Scheduled agent] --> B[Message tool and MCP]
B --> C[Gateway job authority]
C --> D{Trusted job and declared adapter?}
D -->|No| E[Reject before provider request]
D -->|Yes| F[Discord lookup and edit]
F --> G[Check authority before each request]
G --> H[Preserve accepted result]
Decision needed
Why: The implementation and boundary proof support the design, but repository policy reserves acceptance of this public authority expansion for its owners. Before merge
Agent review detailsSecurityNone. PR surfaceSource +249, Tests +712, Docs +65. Total +1026 across 20 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep scheduled administration narrowly bound to the existing operator job grant, with an accepted SDK contract, per-request revocation checks, and preserved mutation outcomes. Do we have a high-confidence way to reproduce the issue? Yes: the current dispatcher lacks scheduled writer admission, and the retained differential trace shows the trusted job rejected before PATCH. No target code was executed during this read-only review. Is this the best way to solve the issue? Yes, subject to owner acceptance: extending the existing job grant and Discord request guard avoids a competing authority mechanism and retains the established interactive path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 035227797aa6. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
dbd5c6b to
be56ced
Compare
3652264 to
b7050b3
Compare
b7050b3 to
4c1df7a
Compare
|
Fixed: scheduled jobs created by an operator can edit Discord channels with live permission checks and preserved accepted results after cancellation. |
Enable Discord channel edits for scheduled jobs created by an operator. Preserve live job and plugin checks before further requests and keep accepted results when the caller is canceled. Refs openclaw#140978.
What Problem This Solves
Trusted operator-created scheduled jobs have no inbound Discord sender. Before this change,
channel-editfailed at the channel administration check even when the job had validmessageaccess. Related: #140978.This PR carries the canonical job grant through Discord channel editing, channel-name resolution, and provider retries. It uses the scheduled message admission and current tool-policy evaluation landed in #150166. It also fixes a caller completion check that discarded an accepted edit when disabling the job canceled its generated MCP request.
User Impact
Operator-created jobs with
messageaccess can edit Discord channels and use the action's existing thread edit options. Configured account and action restrictions, the job's current capability, and Discord permissions continue to apply.Disabling, removing, replacing, or narrowing a job blocks later requests and rate-limit retries. Caller or plugin retirement also blocks subsequent I/O. Configuration changes apply to the next invocation; an admitted operation retains its configuration. A confirmed provider result survives job cancellation and the original MCP request's abort.
Why This Change Was Made
The optional SDK field
ChannelMessageActionAdapter.writeAuthorityActions?: readonly ChannelMessageActionName[]declares that an adapter preserves the existingassertDirectAdapterHandoffcallback through preparation and every provider request or retry. Action discovery and read support do not establish that write contract. The host independently selects eligible actions; Discord declares onlychannel-editin this PR.Admission checks the canonical job grant, configured action and account, and the active bundled or loader-verified official registration. Channel lookup retains the selected registration and request guard. Its read scope closes before the mutation, whose actual result is allowed to settle. The in-process Gateway retains the original signal and caller guards for later dispatches and mutation commits.
Older adapters remain source-compatible because the declaration is optional. Scheduled administration requires the updated adapter contract and its loaded registration. Account-created jobs do not inherit operator administration, and no run-wide owner flag or invented requester identity is introduced. Canonical SDK and automation documentation explains the interface, retained checks, configuration timing, and upgrade behavior.
Evidence
The existing isolated fixture exercises the real scheduler, CLI child protocol or embedded runner, generated HTTP MCP grants, registered Gateway handler, and official Discord adapter. Only model decisions and provider responses are synthetic. The original scheduler failure submitted no PATCH. A separate regression reproduced channel-directory I/O after revocation; the repaired path blocks it.
All six scheduler scenarios passed: the two read controls, CLI and embedded edits, disable-before-429-retry, and accepted-response settlement after the original MCP signal aborts. The disable cases use real
cron.updatecalls, inspect the persisted disabled job, and verify the exact authenticated PATCH and completed run cleanup.The operator-only candidate passed 477 selected runtime tests, core/root typing, all 20 selected core test type graphs, formatting, targeted lint, source ratchets, and both import-cycle checks. Retained proof covers outbound/registry/Discord siblings and SDK declaration compatibility. Independent implementation, caller-settlement, and integration reviews found no actionable issues; the recorded default-P0 automated reviews are clean.
The three writer commits were replayed unchanged onto main after #150166 landed. Final head
4c1df7ac6bbd36aac84cf376e7052168f0b2cde4preserves all 20 contribution files from the tested current-main integration candidatee95ace9ce0841849a2e29f87bad86fe49bbd98cb(tree1578b5592e5bb2e943393d450acc369415d7122b). That run includes the prerequisite's run-lifetime correction, the updated MCP request scope and CLI watchdog, and a controlled 120-second clock gap before CLI tool discovery. All six scheduler scenarios and combined core/root typing passed. Later main changes were checked against the writer's contracts; the recorded integration review is clean. The current-head ClawSweeper review is Platinum with no code or security findings. Current CI has one unrelated Qwen timeout-equality failure and its aggregate: the test expected120000after one elapsed millisecond, receiving119999; 1,295 other cases in that bundle passed. The matching main-branch baseline failures are recorded in #150523, whose repair has landed in main. Those reported baseline runs used macOS/Node 26.8.2; this CI failure used Linux/Node 24.19.0. Source comparison tied the CI failure to the baseline's unchanged timeout/test inputs, with no writer interaction; the final main result retains the repair.Retained execution output and checked provider outcomes
The following integration run includes the prerequisite's run-lifetime correction and the updated MCP request scope and CLI watchdog. All three writer commits remain patch-equivalent. Its CLI cases advance the fixture clock by 120 seconds before tool discovery.
The scheduler and retained MCP cases checked these outcomes against the Gateway and fixture HTTP peers:
PATCH /api/v10/channels/100000000000000003; the returned channel contains the requested topic.isErroris false and the returned channel/topic is preserved; active Cron runs drain to zero.Current-head assertions: durable disablement and original-signal abort, tool outcome and sole PATCH, and account/forged-sender denial.
The account-denial and additional lifetime cases ran on the writer patch before the parent move. That verified tree was subsequently committed as
2128bd6. Nineteen contribution files remain byte-identical; the shared scheduler fixture gained the prerequisite's clock-gap setup, exercised by the current-main run above. All three writer commits remain patch-equivalent.The earlier differential run recorded the two failures below before their respective corrections. These selected fields are extracted from its retained diagnostics:
{ "before_operator_write_admission": { "discordRequests": [], "mcpIsError": true, "mcpText": [ "Error: Discord guild admin actions require a trusted Discord sender identity." ] }, "before_caller_completion_fix": { "discordRequests": [ { "method": "PATCH", "path": "/api/v10/channels/100000000000000003", "authorizationMatches": true } ], "mcpIsError": true, "mcpText": [ "agent tool caller authority is no longer active" ], "providerStatus": 200 } }