Repository navigation
fix: restore scheduled Discord message writes - #150191
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. Reviewed September 17, 2026, 4:15 AM ET / 08:15 UTC (Revision 9). ClawSweeper reviewWhat this changesRestores scheduled Discord message editing, deletion, pinning, and unpinning while preserving the creator account through credential selection, authorization, and request deduplication. Merge readiness✅ Ready for maintainer review This remains a useful, bounded repair that current main does not provide. No actionable correctness or security defect was found, and retained production-path evidence supports the changed authority boundary. Priority: P2 Review scores
Verification
How this fits togetherScheduled agents invoke the shared message tool through embedded execution or authenticated MCP requests. The Gateway checks job and plugin authority before Discord applies its account, target, and provider-permission rules. flowchart LR
A[Scheduled agent] --> B[Message tool]
B --> C[Saved creator account]
C --> D[Gateway job authority]
D --> E[Registered Discord plugin]
E --> F[Target and request checks]
F --> G[Discord message mutation]
G --> H[Confirmed result]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +39, Tests +562, Docs +13. Total +614 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing scheduled grant and writer lifetime for these actions, preserving creator-account selection, provider target restrictions, and confirmed mutation results. Do we have a high-confidence way to reproduce the issue? Yes, from source: a scheduled grant without inbound conversation context cannot admit these four writes through the installed Discord adapter on current main. This review did not execute a reproduction. Is this the best way to solve the issue? Yes. The patch extends the existing scheduled authority and account-selection owners instead of introducing a parallel permission mechanism, with meaningful boundary coverage. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fca04893b5b3. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
3652264 to
b7050b3
Compare
c0ce79c to
102787f
Compare
2c85b0f to
4ce184f
Compare
3dcd846 to
0b628f7
Compare
102787f to
60b6a15
Compare
60b6a15 to
5a5115e
Compare
5a5115e to
a9b9f5f
Compare
|
Fixed: Scheduled jobs can edit, delete, pin, and unpin Discord messages with the intended account and permission checks. |
Restore scheduled Discord message editing, deletion, pinning, and unpinning while preserving account selection, target authorization, and cancellation behavior. Refs openclaw#140978.
What Problem This Solves
Scheduled jobs permitted to use
messagecan still fail to edit, delete, pin, or unpin Discord messages through an official installed plugin. These actions previously required an inbound conversation even when the job had a recorded principal and Discord could authorize its target. This addresses the scheduled message management portion of #140978.This contribution uses the scheduled grants established by #150166 and #150278, together with the SDK writer contract and settlement behavior from #150182. The account and SDK contributions are independent prerequisites.
User Impact
Eligible scheduled jobs can perform all four actions. Account jobs retain their recorded creator account, creator origin, and delegated target policy; trusted operator jobs use operator target policy. Discord action settings, target restrictions, and bot permissions continue to apply.
An omitted
accountIdselects the saved creator before credential preparation and Gateway routing, even when delivery or provider defaults name another account. Request deduplication uses that same account, so two saved accounts cannot accidentally share a write result. Explicit account arguments retain their existing validation and scope checks.The shared writer lifetime preserves a confirmed mutation's result after job or caller cancellation while stopping later requests and retries. Existing interactive actions and bundled provider paths retain their admission behavior; older installed adapters require the supported write declaration for scheduled writes.
Why This Change Was Made
Discord enrolls
edit,delete,pin, andunpinthrough the optional SDK declarationChannelMessageActionAdapter.writeAuthorityActions. Host admission remains specific to each action and uses active plugin registration, the private scheduled grant, and provider checks for target authorization. Account jobs do not acquire an owner flag.The account correction belongs at the existing preparation and routing owners: validate the selected account before resolving secrets, carry it through the message action, and bind the request key to it. Read completion fencing remains separate from write settlement. Canonical cron and SDK docs describe the supported actions, policy, and plugin upgrade requirements.
Evidence
The current replay is a9b9f5f on main 1c9914a, with all prerequisites and fix: allow dashboard reads through official plugins #150309 effective. Independent review accepted the dashboard integration, and all seven fast preflight categories passed in 21.40 seconds. The exact replay passed 23 existing context/account cases on Blacksmith Testbox: 16 message-tool execution cases and seven Gateway write-account cases, including all four default-account changes, explicit-account rejection and same-key account isolation. The native command exited 0. Focused current-head run.
The earlier replay, 60b6a15, passed 22 tests across the execution fixture and its existing scheduled-account sibling after the upstream fixture integration. Vitest took 20.32 seconds; the native command exited 0 in 106.76 seconds. Focused replay check.
Additional Blacksmith Testbox validation passed the existing eight scheduler scenarios on the composition of main revision a90b969, the corrected run-bound issuer, and both account and writer prerequisites. Every CLI row includes a controlled 120-second clock advance before
tools/list; cancellation before a 429 retry, confirmed success after the original caller aborts, and both account rows passed. Vitest took 76.64 seconds, and the native command exited 0 in 169.55 seconds. Integrated scheduler run.The earlier consumer replay was qualified against source 102787f. The subsequent upstream location-fixture changes passed the focused replay check above. The current integration retains the reviewed contribution and account controls, with the two explicit source adjustments described above.
The account prerequisite's later bridge passed all four existing operator/account × CLI/embedded read journeys on main 9a44681 plus its account contribution, tree 6011f69f78b34fedb212b69a64e536c97c0db156. Current model/configuration producer check. Subsequent caller, configuration, loader, registration, and settlement changes were source-qualified against the unchanged contribution; these checks retain their original execution identities.
Retained native Blacksmith Testbox validation passed 167 tests across eight files on the exact source tree committed as
102787fc731ff7ad17ae35f75c3da26e6cab0fae. The test run took 120.08 seconds; the delegated native command exited 0 in 422.07 seconds. Runner context.The run includes all eight real scheduler scenarios across CLI/MCP and embedded execution, account creation and delivery independence, job disablement during a 429 retry, and accepted-write settlement after the original MCP request signal aborts. It also covers 47 CLI/MCP cases, direct Gateway account routing, credential selection, Discord metadata siblings, and registered writer/request lifetime controls.
Controlled regressions fail on the earlier source: all four writes resolve credentials before rejecting a missing account; all four select the wrong provider default after it changes; two saved accounts sharing a key produce only the first pin request. The corrected cases pass, including positive credential identity for both accounts and unchanged ordinary-send account behavior.
The existing integration fixture verifies the request methods and routes for all four actions under both principal modes, edit payloads, action/account/target denials, directory lookup, provider permission denial without replay, and adapter compatibility. Installer provenance and scheduled source lifetime are explicit fixture seams; this evidence makes no live Discord permission claim.
Retained independent source, test, and integration reviews found no remaining P0–P2 findings. Their applicability follows the preserved contribution and the fresh review of its two dashboard-integration adjustments. Changed-path formatting, focused syntax and boundary lint, line caps, whitespace and MDX checks passed on the committed replay; no baseline or assertion exception was added.
Retained remote production and root-test typing on qualified source 102787f passed, together with the
agents-toolsandgateway-othertest graphs selected for the changed source tests. The paired graphs ran with concurrency two on the observed worker. Type-check runner.CI passed on qualified source 102787fc731f, including full core-test type coverage. The retained P0–P2 automated review and the fresh integration review are clean. ClawSweeper Revision 9 reviewed current head a9b9f5f: Platinum 4/6, proof Diamond 5/6, no correctness or security findings.
Current-head CI completed with one unrelated Linux Doctor fixture failure and its aggregate; all other selected CI lanes succeeded. The executed merge was d12a51c20a9d5bac64ad95191088bc6d9c49b88f on main 7d2933b. That unchanged main revision reproduced the same failure: the old test double permits only
busctl, while the service-inspection change in fix(update): continue when service inspection is unavailable #150494 also askssystemctlto classify an unavailable manager. The four-case baseline run produced three passes and that same failure, with native exit 1. Source and dependency inspection establish that the message-write contribution does not cause it. The failed checks remain recorded as failures.A fresh Blacksmith Testbox run passed the existing eight scheduler scenarios on composition 17884b38c9c4504b639763095482fb0db9216d9f, tree 1e625a9b26e536345fea6b535a5acf728656fefd, combining main 7885f84 with the prior public contribution. CLI/MCP and embedded, operator/account, controlled 120-second discovery delay, disabled-job retry and accepted-write settlement all passed. Vitest took 47.50 seconds; the native command exited 0 in 103.82 seconds. Fresh scheduler run. Subsequent MCP requester/connection cleanup and the dashboard integration were source-qualified for these actual routes; this is not a claim that those later revisions were executed in that run.
Observed native execution output
Selected lines from the retained run above, with ANSI styling removed.
The issuer, SDK, and account prerequisites are landed through #150166, #150182, and #150278. The contribution remains scoped to its own eleven files on main. The current integration has passing focused account/context proof, clean review and exact-head Platinum ClawSweeper evidence. The remaining CI failure is independently reproduced and attributed to its unchanged-main fixture; it does not change this contribution's behavior.
Recovery after an ambiguous lost Discord response remains tracked separately in #127536. The settlement evidence above covers confirmed provider success and authority cancellation; it does not claim that retry-recovery issue is resolved.