Skip to content

fix: retain the native requester for scheduled Discord edits - #150308

Merged
shakkernerd merged 3 commits into
mainfrom
fix/scheduled-channel-requester
Sep 17, 2026
Merged

shakkernerd merged 3 commits into
mainfrom
fix/scheduled-channel-requester

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A scheduled job created from Discord has no inbound Discord message when it later runs. It cannot safely use the original session creator or an OpenClaw owner flag as the human authority for channel-edit. A later editor also needs to authorize the executable definition they save. Related: #140978.

This contribution retains the authenticated native requester through creation, edits, and scheduled execution. It uses the shared scheduled-message path landed in #150191, alongside the operator/account-read and SDK contributions in #150166, #150278, and #150182.

User Impact

An authorized user in Discord can create a finite-cap automation that edits channels or threads under that person's current Discord permissions. The job's owning session and account remain its boundary, and the existing tool policy, configured action restrictions, and plugin checks still apply. OpenClaw's owner designation does not replace Discord's permission check.

Changing the prompt, model, name, schedule, delivery, or another executable input binds the job to the current qualified editor, or clears native edit authority when that editor cannot be established. Description and display-label changes, and equivalent resaves, preserve the saved requester and running occurrence. An explicit tool-cap refresh or a complete authored declaration can reauthorize an unchanged definition. Executable changes retire further actions from the old occurrence; a provider edit already accepted still settles normally.

Discovery uses the saved native account even when the job delivers its result through another account. Read access keeps its separate recorded-origin checks. Jobs without a usable native requester need a fresh edit from their owning Discord session/account with an explicit finite toolsAllow cap containing message. Recreate the job there if its execution authorization is also missing. The automation and SDK documentation explain this recovery.

Why This Change Was Made

Creation records the actual authenticated sender in the existing private provenance envelope. A requester-only capture remains distinct from a genuine capture of the complete executable tool surface. Generated MCP requests retain the original private issuer and bind it to the actual admitted run and current MCP capture. The signed caller carries an opaque, one-use grant that remains subject to source validity at commit. Tool arguments and session attribution cannot supply requester authority, and native capture does not take over harness-owned runtime authority.

The existing mutation owner reconciles requester facts after the full edit is known, including declarations and authored trigger state. At execution, the scheduler binds the validated tuple to the live occurrence. The registered Discord adapter receives that requester with senderIsOwner: false and no fabricated inbound conversation, then checks current permissions before provider work.

Requester facts remain absent from public job results. There is no configuration or storage schema migration. A released-reader round trip confirms older readers can list and edit these jobs; older writers discard the unsupported requester fact, requiring fresh authorization afterward.

Evidence

Retained Blacksmith Testbox proof covers 566 selected runtime cases: 53 CLI/MCP, 29 discovery, nine scheduler journeys, 164 private-provenance/service/receipt cases, and 311 Gateway/token/creator-context cases. The native journey uses real reply ingress, generated MCP automation creation, persisted requester B on a non-default account, and cron.run. One edit succeeds; removing B's permission prevents a second PATCH. Model decisions and provider responses are synthetic. Runtime proof.

The full nine-row prerequisite integration passes with the scheduled 120-second gap. A shared fixture clock hook was limited to scheduled execution after reproducing a recursive Date.now spy during the separate creation phase; all creation, permission, cancellation, and settlement assertions remain. Three MCP listener lifetime cases also pass. Integration proof.

The latest integration run uses the landed dashboard permission contract and the new MCP lifecycle code with the native requester contribution. The one selected requester-B case passed; eight already-proven common scenarios were intentionally skipped. The actual tested source is a067e61de021731408cae8aa47b54171e3b5f956. The final main replay preserves all three native patches; the only later change within a native file passes the existing execution session into the embedded path, outside this Claude CLI case. Its source and caller contracts were inspected. Native integration proof.

The earlier current-model run and typing retain their original execution identities. Both cycle checks, all 20 core test-type graphs, extension production/test types, and the strict runtime build with all 154 public SDK subpaths have passed in the retained qualification. The final affected formatting, lint, and ratchets are checked against the replay. Full contribution review and scoped correction/fixture autoreviews through P2 have no actionable findings; a fresh focused review confirmed that dashboard reads remain separate from native scheduled write authority. Type/build proof, earlier model-path proof.

The required read, write, and SDK contracts are on main. The final composition retains #150309’s dashboard read-only contract, #150216’s thread-permission correction, and documented older-writer recovery. Exact-head ClawSweeper review is Platinum with Diamond proof and no code or security findings. Review.

Final-head CI completed with three shared tooling failures: the planner clone lint rule, a Doctor fallback fixture, and the Labeler routing expectation. All three are repaired on main in #150655. Its executed CI passes the exact affected cases and lint; the tested repair files and relevant tooling/dependency inputs match the final combined result. The native change and the complete intervening main changes were inspected for compatibility. Failed CI retains its actual status; these results qualify the repaired merge result. Final-head CI, repair CI.

@shakkernerd
shakkernerd requested a review from a team as a code owner September 16, 2026 21:14
@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 docs Improvements or additions to documentation channel: discord Channel integration: discord gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 17, 2026, 5:26 AM ET / 09:26 UTC (Revision 8).

ClawSweeper review

What this changes

The PR retains the authenticated Discord requester on account-bound automations so scheduled channel edits use that person's current permissions and executable edits refresh or clear their authority.

Merge readiness

⛔ Blocked before merge - 5 items remain

This remains distinct, useful work beyond the merged scheduled-message prerequisites. No actionable introduced code defect was found; the maintainer-authored PR should remain open.

Priority: P2
Reviewed head: c4bb6a46c437e8ffd34c7e5ae7867c9e3707eb2c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent implementation with strong production-boundary proof and no actionable correctness findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Retained Testbox proof exercises real ingress, MCP creation, persisted requester B, scheduler admission, and Discord transport: one edit succeeds, permission withdrawal blocks the next PATCH, and related cases reject account mismatch and revocation before I/O. Synthetic provider responses do not bypass production authorization; historical source/log access limits are disclosed separately.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Retained Testbox proof exercises real ingress, MCP creation, persisted requester B, scheduler admission, and Discord transport: one edit succeeds, permission withdrawal blocks the next PATCH, and related cases reject account mismatch and revocation before I/O. Synthetic provider responses do not bypass production authorization; historical source/log access limits are disclosed separately.
Evidence reviewed 9 items Verified introduction and merge boundary: The checkout is the pinned original head. The raw test-merge parents are exactly the fetched main followed by that head; its comparison against main contains the introduced paths, without the unrelated base-only changes. The final working tree remained clean.
Still necessary on main and latest release: Fetched main still requires operator authority for scheduled channel administration and lacks this native-requester branch. The v2026.9.4 Discord adapter likewise rejects a source-less non-owner requester. The merged prerequisite #150182 provides operator edits, not the account-requester capability.
Requester capture and commit authority: Authenticated ingress supplies native identity separately from session attribution. Requester-only grants retain the admitted run and MCP capture validity, are consumed once, and are checked again at the mutation boundary; native persistence then preserves the synchronous guard-to-commit window.
Findings None None.
Security None None.

How this fits together

OpenClaw's scheduler runs saved agent instructions after the creating conversation has ended. Private job provenance carries requester identity through Gateway admission to the Discord plugin, which checks permissions before channel changes.

flowchart TD
  A[Authenticated Discord turn] --> B[Creator grant]
  B --> C[Saved automation]
  D[Executable job edit] --> C
  C --> E[Live scheduled occurrence]
  E --> F[Account and requester checks]
  F --> G[Discord permission checks]
  G --> H[Channel edit or rejection]
Loading

Decision needed

Question Recommendation
Does the listed security owner accept persisting native requester authority for account jobs, including executable-edit invalidation and older-writer reauthorization? Accept the documented authority contract: Record listed-owner acceptance, or confirm that the author already supplies that involvement, while retaining the documented reauthorization behavior.

Why: The implementation and boundary proof support the design, but accepting this persisted permission contract requires owner intent; available metadata does not establish that involvement.

Before merge

  • Resolve merge risk (P1) - An older writer discards the saved requester, so native scheduled channel edits stop until reauthorization; an older Discord adapter cannot serve the new requester path.
  • Resolve merge risk (P1) - Security-owner acceptance of the widened persisted authority contract is not established by the available review or membership metadata.
  • Resolve merge risk (P1) - The retained runtime run predates the final replay; unavailable historical objects and a blocked log redirect limited independent verification of the reported source-equivalence bridge.
  • Complete next step (P2) - Confirm listed security-owner involvement and acceptance of the persisted requester and downgrade-recovery contract.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +607, Tests +1090, Docs +33. Total +1730 across 37 files.

View PR surface stats
Area Files Added Removed Net
Source 26 925 318 +607
Tests 9 1256 166 +1090
Docs 2 34 1 +33
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 37 2215 485 +1730

Review metrics

Metric Value Why it matters
Production versus test growth production +607 lines; tests +1090 lines Production growth implements requester capture and lifecycle reconciliation; the larger test delta covers persistence, revocation, and actual transport boundaries.

Merge-risk options

Maintainer options:

  1. Accept explicit reauthorization after downgrade (recommended)
    Accept the documented older-writer behavior and coordinate host/plugin upgrades so users can restore native scheduled edits from the owning Discord conversation.

Technical review

Best possible solution:

Keep requester provenance with the canonical scheduler owner and obtain security-owner acceptance of its executable-edit revocation and documented downgrade recovery contract.

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

Not applicable as a new account-authorized execution mode: main explicitly limits scheduled channel administration to operators. The retained production-path harness demonstrates the proposed account mode.

Is this the best way to solve the issue?

Yes. Extending existing creator grants, canonical job mutation, and Discord permission checks avoids a parallel authority owner or fabricated inbound conversation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded improvement to account-owned scheduled Discord administration.
  • merge-risk: 🚨 compatibility: Native scheduled edits require a compatible adapter, and older writers erase requester provenance until fresh authorization.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Retained Testbox proof exercises real ingress, MCP creation, persisted requester B, scheduler admission, and Discord transport: one edit succeeds, permission withdrawal blocks the next PATCH, and related cases reject account mismatch and revocation before I/O. Synthetic provider responses do not bypass production authorization; historical source/log access limits are disclosed separately.
  • proof: sufficient: Contributor real behavior proof is sufficient. Retained Testbox proof exercises real ingress, MCP creation, persisted requester B, scheduler admission, and Discord transport: one edit succeeds, permission withdrawal blocks the next PATCH, and related cases reject account mismatch and revocation before I/O. Synthetic provider responses do not bypass production authorization; historical source/log access limits are disclosed separately.

Evidence

What I checked:

  • Verified introduction and merge boundary: The checkout is the pinned original head. The raw test-merge parents are exactly the fetched main followed by that head; its comparison against main contains the introduced paths, without the unrelated base-only changes. The final working tree remained clean. (dc628827b7c9)
  • Still necessary on main and latest release: Fetched main still requires operator authority for scheduled channel administration and lacks this native-requester branch. The v2026.9.4 Discord adapter likewise rejects a source-less non-owner requester. The merged prerequisite fix: allow trusted scheduled Discord channel edits #150182 provides operator edits, not the account-requester capability. (src/channels/plugins/message-action-dispatch.ts:543, 9ab47386778b)
  • Requester capture and commit authority: Authenticated ingress supplies native identity separately from session attribution. Requester-only grants retain the admitted run and MCP capture validity, are consumed once, and are checked again at the mutation boundary; native persistence then preserves the synchronous guard-to-commit window. (src/gateway/server-methods/cron-caller-scope.ts:47, c4bb6a46c437)
  • Executable edits retire saved authority: The canonical mutation owner compares executable definitions and authored trigger state, preserves metadata-only edits, and refreshes or clears requester facts. Receipt tests cover changes followed by restoration without allowing an old occurrence to regain authority. (src/cron/service/jobs-tool-policy.ts:76, c4bb6a46c437)
  • Final-effect authority proof: The captured PR body reports Testbox execution through real reply ingress, generated MCP automation creation, persisted requester B, cron.run, and the registered Discord transport. One PATCH succeeds and permission withdrawal prevents a second PATCH. Current fixture assertions match those observations; additional transport cases reject foreign accounts/channels and revoke permission during preparation before PATCH. Model decisions and provider responses are synthetic. Retained native evidence: https://github.com/openclaw/openclaw/actions/runs/35199236990, tested source a067e61de021731408cae8aa47b54171e3b5f956. (test/cron-message-read.integration.test.ts:953, c4bb6a46c437)
  • Upgrade and adapter contract: The persisted provenance union gains an authenticated-requester variant without adding SQL columns. The body reports a released-reader round trip and explicitly states that older writers discard requester facts. Documentation explains fresh authorization from the owning Discord conversation and recreation when execution authorization is also missing. Public docs: docs/automation/cron-jobs/payloads.md. (docs/automation/cron-jobs/payloads.md:119, c4bb6a46c437)

Likely related people:

  • shakkernerd: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • openclaw/openclaw-secops: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed 2026-09-16T21:21:35.551Z sha 0df7ef2 :: blocked before merge. :: none
  • reviewed 2026-09-17T01:36:47.507Z sha ce6cc1f :: blocked before merge. :: none
  • reviewed 2026-09-17T02:03:02.078Z sha ce6cc1f :: blocked before merge. :: none
  • reviewed 2026-09-17T05:27:06.734Z sha bf1b37f :: blocked before merge. :: none
  • reviewed 2026-09-17T05:47:17.084Z sha ceefa83 :: blocked before merge. :: none
  • reviewed 2026-09-17T06:19:48.859Z sha ceefa83 :: blocked before merge. :: none
  • reviewed 2026-09-17T09:12:12.813Z sha ceefa83 :: blocked before merge. :: none

@shakkernerd shakkernerd self-assigned this Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Sep 17, 2026
@shakkernerd
shakkernerd force-pushed the fix/scheduled-message-writes branch from 102787f to 60b6a15 Compare September 17, 2026 05:06
@shakkernerd
shakkernerd force-pushed the fix/scheduled-channel-requester branch from ce6cc1f to bf1b37f Compare September 17, 2026 05:16
@shakkernerd
shakkernerd force-pushed the fix/scheduled-message-writes branch from 60b6a15 to 5a5115e Compare September 17, 2026 05:32
@shakkernerd
shakkernerd force-pushed the fix/scheduled-channel-requester branch from bf1b37f to ceefa83 Compare September 17, 2026 05:38
@shakkernerd
shakkernerd force-pushed the fix/scheduled-message-writes branch from 5a5115e to a9b9f5f Compare September 17, 2026 08:05
Base automatically changed from fix/scheduled-message-writes to main September 17, 2026 09:04
@shakkernerd
shakkernerd force-pushed the fix/scheduled-channel-requester branch from ceefa83 to c4bb6a4 Compare September 17, 2026 09:19
@shakkernerd
shakkernerd merged commit 9ee5c26 into main Sep 17, 2026
215 of 220 checks passed
@shakkernerd
shakkernerd deleted the fix/scheduled-channel-requester branch September 17, 2026 09:53
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: scheduled Discord channel edits retain their authenticated requester and check that person's current permissions.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…w#150308)

Retain the native requester for account-scheduled Discord channel edits, reauthorize executable changes, and stop later actions from revoked runs.

Refs openclaw#140978.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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