Repository navigation
fix(automations): let configured owners manage jobs from chat - #148790
Conversation
Reuse live method-bound management grants for explicit channel owners without transferring scheduled execution authority. Preserve ordinary caller isolation, owner revocation, and management-only requester continuations. Related: #144814, #147241 Co-authored-by: steipete <[email protected]>
Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 01f799e8-928d-4f62-b966-6768d35facf8
|
🦞👀 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 15, 2026, 1:57 AM ET / 05:57 UTC (Revision 3). ClawSweeper reviewWhat this changesLets explicitly configured channel owners manage existing automations across sessions using revocable grants, while preserving SDK compatibility and management-only subagent continuations. Merge readiness✅ Ready for maintainer review The prior SDK compatibility blocker is resolved, and no introduced blocking defect was found. This maintainer-sponsored work remains useful because current main still restricts cross-session automation management to Control UI administrators. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s automation tool sends job-management requests to the Gateway scheduler. Authenticated turn admission supplies authority, which the Gateway checks before returning job data or committing changes. flowchart TD
A[Authenticated chat turn] --> B[Configured owner or UI administrator]
B --> C[Run-bound management grant]
C --> D[Automation tool request]
D --> E[Current authority check]
E --> F[Read or modify scheduled job]
C --> G[Verified requester continuation]
G --> E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +59, Tests +512, Docs 0. Total +571 across 31 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one Gateway management-grant owner, preserve existing harness consumers, and retain current-owner checks through continuation admission and final job commits. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect reproduction: current main deliberately limits this authority to Control UI administrators, and the PR adds a supported channel-owner path. Is this the best way to solve the issue? Yes. Reusing method-bound, one-use grants avoids a competing authorization system, and the repaired SDK projection preserves the documented compatibility window. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c657a10e11da. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles) |
Preserve the authenticated Control UI owner boundary while checking the new management entitlement contract. Co-authored-by: steipete <[email protected]>
Retain the deprecated readonly controlUiAdmin field with its original UI-only meaning through the documented SDK compatibility window. Management entitlements remain the sole authority source; legacy and V2 consumers are covered without permitting creator grants from management-only scopes. Co-authored-by: steipete <[email protected]>
|
Addressed the SDK compatibility finding: the deprecated readonly controlUiAdmin field is restored as a UI-admin-only projection of managementEntitlement, through the documented 2026-10-12 compatibility window. No grant validation reads the deprecated field. Public legacy/V2 consumer regressions verify its old value and reject creator grants for management-only scopes of both sources. The regression failed before the fix; 60 focused tests, the scoped changed checks, and independent P0–P2 review pass. The separate websocket admission assertion is also corrected (51 tests pass). |
|
Merged via squash.
|
…aw#148790) * fix(automations): let configured owners manage jobs from chat Reuse live method-bound management grants for explicit channel owners without transferring scheduled execution authority. Preserve ordinary caller isolation, owner revocation, and management-only requester continuations. Related: openclaw#144814, openclaw#147241 Co-authored-by: steipete <[email protected]> * fix(automations): let configured owners manage jobs from chat Worked on by: - @steipete Co-authored-by: steipete <[email protected]> OpenClaw-Publication: 01f799e8-928d-4f62-b966-6768d35facf8 * test(automations): align websocket admission entitlement assertion Preserve the authenticated Control UI owner boundary while checking the new management entitlement contract. Co-authored-by: steipete <[email protected]> * fix(automations): preserve the public harness admin projection Retain the deprecated readonly controlUiAdmin field with its original UI-only meaning through the documented SDK compatibility window. Management entitlements remain the sole authority source; legacy and V2 consumers are covered without permitting creator grants from management-only scopes. Co-authored-by: steipete <[email protected]> --------- Co-authored-by: steipete <[email protected]>
…hat (#158372) * fix(automations): backport configured owner job management Backport the applicable owner-management changes from #148790 onto sjf_openclaw_2026-09-04. Keep this release's existing Control UI harness API and omit requester-continuation code absent from this branch. (cherry picked from commit d74277a) * test(automations): refresh owner management prompt snapshots --------- Co-authored-by: Sarah Fortune <[email protected]>
Related: #168823 (this fixes fresh channel-owner messages queued for followup/collect execution, not every parent-resumption path). ## What Problem This Solves Fixes: an authenticated channel owner sees only the current conversation's automations when their message waits in the followup queue. ## User Impact Owners retain their existing ability to manage gateway-wide automations after a queued message starts; revoked ownership and non-owner or internal messages remain restricted. No configuration changes or migration are required. ## Why This Change Was Made The original ingress capability expires before queued execution starts with a new run identity. Preserve a source-bound capability factory through queue collection and overflow, then enter a fresh scope for that queued run. The original sender, transport identity, current-owner check, and run-settlement/abort revocation remain authoritative; presentation defaults cannot supply another turn's capability. ## Related work and scope Related: #148790 (merged channel-owner automation management) and #160018 (merged owner-authority preservation after a child reply). #148294 tracks the broader distinction between admission authority, continuation ownership, and delivered completion. This PR fixes fresh authenticated channel-owner messages crossing the followup/collect queue. The Control UI parent-resumption report #168823 enters through a different path; neither that entire issue nor the broader completion contract is claimed resolved here. ## Reproduction and environment Observed on macOS with packaged OpenClaw 2026.10.2 and a configured Telegram channel owner. The controlled comparison restored the exact original versions of the three affected runtime modules, then applied the qualified fix; the installation also contained disclosed unrelated backports. The isolated Gateway cases used synthetic external Telegram/model endpoints. The separate October 15 Telegram check used the normal channel and provider. These runtime results belong to the earlier qualified patch, not to a new deployment of the October 16 integration head. 1. Configure an explicit owner in `commands.ownerAllowFrom` and use a Gateway with automation jobs belonging to multiple conversations. Confirm a fresh owner request can list the full inventory. 2. Start owner request A with a bounded wait. While A is still running, send a separate owner request B asking the native `automations` tool for `action=list, includeDisabled=true`, with the inline `/queue followup` directive at the end of B's message. 3. Confirm B arrives while A runs and executes afterward with a different run identity. Inspect the actual native tool result, not just the model's answer or a CLI list. 4. Before the fix, the exact-original control returns `scope=caller` with 1 of 6 jobs. After the fix, it returns `scope=gateway` with all 6; the separate real Telegram run returned all 73 jobs with `hasMore=false` and matching operator-inventory IDs. The non-owner, foreign-source and authenticated-cancellation controls and the deferred-revocation limitation are linked below. This reproduction makes no mutation-race claim. ## Evidence - October 16 integration: merged frozen main `0fd8396314714ed4251d802502a072ec558b9f5e` into this branch to resolve the actual import conflict. Head `534dce6504ba0438f0f76e111f09f852769b9a9e` retains both imports, and the PR's added/removed lines across all seven files are identical to the previously reviewed patch. Formatting and the diff check pass. A focused four-file test attempt stopped before tests in the borrowed compiler installation (`Symbol.dispose`); type-aware lint also refused dependencies outside this checkout. The borrowed compiler/test-runner versions differ from the new base and were not modified. [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/38876614603) completed successfully on `534dce6504ba0438f0f76e111f09f852769b9a9e`; the current check rollup has 69 successful, 56 skipped and 1 neutral check, with no failing or pending checks. This hosted result verifies the new integration head; the earlier runtime proof retains its stated version boundary. No local full core build or production change. - Reproduced the loss through real ingress preparation, queue draining, followup execution, and the native cron tool before the fix, then verified gateway scope after it. External model execution and gateway transport are isolated fixtures; the capability and grant checks are real. - On pre-integration head `e5691d669a93ada9b8dd75099d76a12292510b9c`, 130 focused tests passed: 112 prepared-reply tests, 3 queued-callback tests, and 15 queue-authority tests. The 36 new cases cover both queue modes, batching, overflow, mixed sources, current-owner revocation, sender aliases, and internal/replayed/spawned/non-owner inputs. - On the pre-integration head above, targeted typed lint, formatting, whitespace checks, and the repository-required autoreview passed. CI exposed that a whole-object queue type annotation rejected existing private ingress metadata; the factory was captured before object construction to preserve the inferred shape. All 130 focused tests passed after this adjustment. The changed 112-test file also passed after narrowing the native tool result and preserving all real typing-module exports; two obsolete mock allowances were removed, and the mock-export ratchet passed. - The complete [PR CI run](https://github.com/openclaw/openclaw/actions/runs/38639828076) passes on e5691d6, including production/test declarations, lint, extension-package boundaries, and baseline ratchets. Local declaration checks could not use the borrowed dependency installation; CI provides that verification. No local full core build. The packaged-Gateway negative controls below use synthetic external services; the additional real Telegram check uses the normal channel and model provider. - Additional packaged-Gateway proof: with exact-original negative control, a queued owner returns `caller/1` before and `gateway/6` after; fixed output IDs exactly match the global inventory, including foreign-agent jobs. Native ingress, queue, tool, grants, Gateway transport and handlers are real; only external Telegram/model endpoints are fixtures. - Nearest forbidden paths: non-owner tool surface excludes automations; a different local agent-RPC source without channel-owner/Control UI management entitlement returns `caller/1` and no foreign jobs; authenticated `/stop` after queued tool binding prevents automation execution or result. Config-only owner removal was deferred by channel reload and is not counted as applied-revocation proof. No mutation-race claim. [The evidence comment](#172539 (comment)) contains the redacted native trace and boundaries. - Real Telegram owner-channel check (October 15): B arrived while A was executing a bounded command and ran afterward with its own run identity using a per-message followup directive. Its actual native `automations` list result was `scope=gateway`, `total=73`, 73 returned, `hasMore=false`, with every job ID matching the operator inventory. The reply was delivered to Telegram; persistent queue mode stayed unchanged. This proves the production read path, not a new revocation or mutation-commit race. Co-authored-by: Ayaan Zaidi <[email protected]>
…aw#172539) Related: openclaw#168823 (this fixes fresh channel-owner messages queued for followup/collect execution, not every parent-resumption path). ## What Problem This Solves Fixes: an authenticated channel owner sees only the current conversation's automations when their message waits in the followup queue. ## User Impact Owners retain their existing ability to manage gateway-wide automations after a queued message starts; revoked ownership and non-owner or internal messages remain restricted. No configuration changes or migration are required. ## Why This Change Was Made The original ingress capability expires before queued execution starts with a new run identity. Preserve a source-bound capability factory through queue collection and overflow, then enter a fresh scope for that queued run. The original sender, transport identity, current-owner check, and run-settlement/abort revocation remain authoritative; presentation defaults cannot supply another turn's capability. ## Related work and scope Related: openclaw#148790 (merged channel-owner automation management) and openclaw#160018 (merged owner-authority preservation after a child reply). openclaw#148294 tracks the broader distinction between admission authority, continuation ownership, and delivered completion. This PR fixes fresh authenticated channel-owner messages crossing the followup/collect queue. The Control UI parent-resumption report openclaw#168823 enters through a different path; neither that entire issue nor the broader completion contract is claimed resolved here. ## Reproduction and environment Observed on macOS with packaged OpenClaw 2026.10.2 and a configured Telegram channel owner. The controlled comparison restored the exact original versions of the three affected runtime modules, then applied the qualified fix; the installation also contained disclosed unrelated backports. The isolated Gateway cases used synthetic external Telegram/model endpoints. The separate October 15 Telegram check used the normal channel and provider. These runtime results belong to the earlier qualified patch, not to a new deployment of the October 16 integration head. 1. Configure an explicit owner in `commands.ownerAllowFrom` and use a Gateway with automation jobs belonging to multiple conversations. Confirm a fresh owner request can list the full inventory. 2. Start owner request A with a bounded wait. While A is still running, send a separate owner request B asking the native `automations` tool for `action=list, includeDisabled=true`, with the inline `/queue followup` directive at the end of B's message. 3. Confirm B arrives while A runs and executes afterward with a different run identity. Inspect the actual native tool result, not just the model's answer or a CLI list. 4. Before the fix, the exact-original control returns `scope=caller` with 1 of 6 jobs. After the fix, it returns `scope=gateway` with all 6; the separate real Telegram run returned all 73 jobs with `hasMore=false` and matching operator-inventory IDs. The non-owner, foreign-source and authenticated-cancellation controls and the deferred-revocation limitation are linked below. This reproduction makes no mutation-race claim. ## Evidence - October 16 integration: merged frozen main `c126b7a2c67a794183f4674cdc2a144ce7c2f8cb` into this branch to resolve the actual import conflict. Head `534dce6504ba0438f0f76e111f09f852769b9a9e` retains both imports, and the PR's added/removed lines across all seven files are identical to the previously reviewed patch. Formatting and the diff check pass. A focused four-file test attempt stopped before tests in the borrowed compiler installation (`Symbol.dispose`); type-aware lint also refused dependencies outside this checkout. The borrowed compiler/test-runner versions differ from the new base and were not modified. [Exact-head CI](https://github.com/openclaw/openclaw/actions/runs/38876614603) completed successfully on `534dce6504ba0438f0f76e111f09f852769b9a9e`; the current check rollup has 69 successful, 56 skipped and 1 neutral check, with no failing or pending checks. This hosted result verifies the new integration head; the earlier runtime proof retains its stated version boundary. No local full core build or production change. - Reproduced the loss through real ingress preparation, queue draining, followup execution, and the native cron tool before the fix, then verified gateway scope after it. External model execution and gateway transport are isolated fixtures; the capability and grant checks are real. - On pre-integration head `e5691d669a93ada9b8dd75099d76a12292510b9c`, 130 focused tests passed: 112 prepared-reply tests, 3 queued-callback tests, and 15 queue-authority tests. The 36 new cases cover both queue modes, batching, overflow, mixed sources, current-owner revocation, sender aliases, and internal/replayed/spawned/non-owner inputs. - On the pre-integration head above, targeted typed lint, formatting, whitespace checks, and the repository-required autoreview passed. CI exposed that a whole-object queue type annotation rejected existing private ingress metadata; the factory was captured before object construction to preserve the inferred shape. All 130 focused tests passed after this adjustment. The changed 112-test file also passed after narrowing the native tool result and preserving all real typing-module exports; two obsolete mock allowances were removed, and the mock-export ratchet passed. - The complete [PR CI run](https://github.com/openclaw/openclaw/actions/runs/38639828076) passes on e5691d6, including production/test declarations, lint, extension-package boundaries, and baseline ratchets. Local declaration checks could not use the borrowed dependency installation; CI provides that verification. No local full core build. The packaged-Gateway negative controls below use synthetic external services; the additional real Telegram check uses the normal channel and model provider. - Additional packaged-Gateway proof: with exact-original negative control, a queued owner returns `caller/1` before and `gateway/6` after; fixed output IDs exactly match the global inventory, including foreign-agent jobs. Native ingress, queue, tool, grants, Gateway transport and handlers are real; only external Telegram/model endpoints are fixtures. - Nearest forbidden paths: non-owner tool surface excludes automations; a different local agent-RPC source without channel-owner/Control UI management entitlement returns `caller/1` and no foreign jobs; authenticated `/stop` after queued tool binding prevents automation execution or result. Config-only owner removal was deferred by channel reload and is not counted as applied-revocation proof. No mutation-race claim. [The evidence comment](openclaw#172539 (comment)) contains the redacted native trace and boundaries. - Real Telegram owner-channel check (October 15): B arrived while A was executing a bounded command and ran afterward with its own run identity using a per-message followup directive. Its actual native `automations` list result was `scope=gateway`, `total=73`, 73 returned, `hasMore=false`, with every job ID matching the operator inventory. The reply was delivered to Telegram; persistent queue mode stayed unchanged. This proves the production read path, not a new revocation or mutation-commit race. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #144814, #147241
What Problem This Solves
Configured Gateway owners cannot maintain an existing automation from Discord or another channel when the job belongs to a different session or was created by an operator.
User Impact
Fresh authenticated senders explicitly listed in
commands.ownerAllowFromcan list, inspect, update, run, and remove any existing Gateway automation without switching to the Control UI. Ordinary channel users, channel allowlists, and wildcard entries do not gain this authority. No new configuration option, database migration, or dependency change is required.Why This Change Was Made
Reuse the existing live, method-bound, one-use management grants rather than relaxing job visibility for every agent. Recheck the admitted owner against the current global owner list at use and before commit. Management preserves the job creator and scheduled execution authority.
Requester continuations retain management only, not creator execution privileges. Owner removal, a new direct user turn, session reset/archive, cancellation, or Gateway restart revoke the relevant authority. Existing Control UI administrator management remains supported.
Evidence
Review follow-up: restored the deprecated readonly
controlUiAdminSDK projection through 2026-10-12 with its original UI-only meaning. Both legacy and V2 public consumers are covered, and management-only scopes of both sources still reject creator grants. The regression failed before repair; 60 grant/continuation tests, scoped changed checks, and independent P0–P2 review pass.Corrected the sibling WebSocket admission assertion for the new entitlement contract; all 51 tests in that file pass.
The new prepared-reply → automation-tool regression failed on the original production code because the configured Discord owner received no management grant.
A second regression demonstrated that new owner and non-owner channel messages did not retire a pending owner task; both now pass.
Focused coverage exercises all five management operations against foreign/trusted jobs, preserved stored execution authority, current-owner revocation during awaited validation and after yield, canonical owner aliases, non-owner/replay/heartbeat exclusions, and existing Control UI behavior. The final ingress/owner/lifecycle/persisted-continuation group passed 253 tests; additional Gateway, grant, and bundled Codex suites passed.
Independent autoreview: scoped-clean for P0–P2.
Build passed. Selected changed checks passed using the unchanged successful type/guard stages plus focused lint reruns and the remaining invariant checks. The five test-brace lint findings and a fixture-size limit were repaired without changing production behavior.
The four affected Codex construction cases passed on the final fixture layout. A broader post-build rerun timed out in existing MCP approval-mode cases and was stopped; the earlier complete Codex suite passed. Exact-head CI remains the landing gate.
The channel tests use synthetic inbound fixtures and real tool/grant/Gateway boundaries; this is not a live Discord-account test. There are no UI rendering changes.
Requested by @steipete.
OpenClaw session: https://team.openclaw.ai/chat/roboclaw/dashboard/bf6d93c4-a043-42d1-9e55-2770ac2b2230
Worked on by
View the OpenClaw team session