Repository navigation
fix(cron): scheduled automations get the same owner-only tools on every runtime - #182585
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
|
Codex review: needs maintainer review before merge. What this changesScheduled automations use one owner-authority decision across runtimes and recheck requester authority before privileged effects. Example: An owner-created Discord automation calls conversations_list through a CLI backend.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current runtime-authority inconsistency, addresses the earlier final-effect finding, and has sufficient behavior and upgrade evidence; no actionable defect remains. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCron admission derives authority from the stored job and current requester; embedded tools, the Codex host, and CLI loopback consume that decision before Gateway effects. flowchart TD
A[Stored automation] --> B[Occurrence admission]
B --> C[Execution context]
C --> D[Embedded and Codex tools]
C --> E[CLI MCP loopback]
D --> F[Owner check and receipt authority]
E --> F
F --> G[Gateway effect]
Technical reviewBest possible solution: Land the shared occurrence-authority repair while retaining the documented legacy compatibility and scoped CLI automations denial. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the undefined-to-false divergence, and the supplied Gateway comparison demonstrates allowed embedded calls versus refused CLI calls; this review ran no target code. Is this the best way to solve the issue? The patch uses existing occurrence admission, the per-run registry, and Gateway receipt authority, providing the smallest coherent repair without another authorization owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b1ae827b1cdc. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +431, Tests +664. Total +1095 across 27 files. Added test files: 2. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 (5 earlier review cycles)
Reviewed October 25, 2026, 6:09 PM ET / 22:09 UTC (Revision 6). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…dience Operator-linked jobs without a recorded requester carry basis trusted-policy. The replay projection distinguishes owner-private from conversation-only parent memory, with fixtures and audience tests for the v2026.10.6 trusted shape and an agent-created account-policy job.
… the call The owner-only guard now composes the requester recheck into the call's Gateway caller receipt authority, so a requester revoked while the tool awaits is refused at the next dispatch, not only at the next call.
…hrough the Gateway Replaces the mocked-dispatch guard test with an admitted scheduled run that calls nodes approve through the real in-process Gateway dispatch and pairing handlers on embedded and CLI runtimes.
Main grew run-prompt-executor.ts to its line limit; the admission that owns the minted context now exposes the shared sender bit.
d484127 to
18568c2
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…s the CLI parity gain The projection now names owner surfaces, so a lost owner reads owner -> non-owner. Scheduled CLI runs with an owner context now get the owner-only tools their embedded runs had; the review states that instead of announcing it.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…ry runtime (openclaw#182585) * fix(cron): scheduled runs take owner authority from their execution context Child and detached scheduled runs take their sender bit from the context's authority.owner on embedded, Codex and CLI runtimes alike: owner runs carry no sender bit (every owner-only tool except standing intents) and non-owner requesters carry false. Owner-only tools recheck the requester before each call, so a requester who stops being an owner is refused mid-run. The CLI loopback keeps its automations denial until it carries the self scope. Refs openclaw#178813 * test(cron): owner authority parity covers Codex and standing intents Each principal gets the same owner-only tools on embedded, Codex and CLI runs; no scheduled run is offered intent, and the CLI loopback keeps its automations denial. * fix(cron): operator-linked jobs without a recorded requester keep operator authority v2026.10.6 stored a trusted tool policy but no requester for jobs an authenticated operator linked with cron.add --session-key. They keep the operator surface they had; agent-created jobs with no requester stay non-owners. * fix(cron): name trusted-policy authority and project parent memory audience Operator-linked jobs without a recorded requester carry basis trusted-policy. The replay projection distinguishes owner-private from conversation-only parent memory, with fixtures and audience tests for the v2026.10.6 trusted shape and an agent-created account-policy job. * fix(cron): scheduled owner recheck fences every Gateway effect inside the call The owner-only guard now composes the requester recheck into the call's Gateway caller receipt authority, so a requester revoked while the tool awaits is refused at the next dispatch, not only at the next call. * test(cron): revoked scheduled owner is refused at node.pair.approve through the Gateway Replaces the mocked-dispatch guard test with an admitted scheduled run that calls nodes approve through the real in-process Gateway dispatch and pairing handlers on embedded and CLI runtimes. * refactor(cron): the cron run admission carries the run's sender bit Main grew run-prompt-executor.ts to its line limit; the admission that owns the minted context now exposes the shared sender bit. * fix(doctor): scheduled-run review reads the owner surfaces and reports the CLI parity gain The projection now names owner surfaces, so a lost owner reads owner -> non-owner. Scheduled CLI runs with an owner context now get the owner-only tools their embedded runs had; the review states that instead of announcing it.
Related: #178813 (Phase 3a of #178812, tracked by #178811)
What Problem This Solves
Fixes: the same scheduled automation gets different owner-only tools depending on its runtime, and a non-owner's automation keeps owner-only tools on embedded runs. Embedded and Codex runs pass no sender bit, which keeps every owner-only tool except
intent. CLI runs coerce the missing bit tofalseand lose them all. Neither runtime checks whether the job's requester is still an owner.User Impact
isolated,current) now gets one owner decision from its execution context, the same on embedded, Codex and CLI runtimes.intent. That includes operator and unbound jobs, and parent-linked jobs whose requester passes the per-occurrence owner check. CLI runs of these jobs now get that surface too.falseand lose the owner-only tools on all three runtimes. This covers parent-linked jobs whose requester no longer passes the check (a profile that is gone, a channel sender removed fromcommands.ownerAllowFrom) or that has no recorded requester.nodes approvebetweennode.pair.listandnode.pair.approve) is refused before the effect.trustedtool policy, but no requester (createdActor), for jobs an authenticated operator linked withcron.add --session-key; agents never get a trusted policy. Such a job now carriesowner: truewith basistrusted-policy(no requester to recheck):intent) on every runtime.main) to owner-private, the audience the operator's own conversation has. One owner bit drives both, as the design requires.accountpolicy (agent-created) staysowner: falsewith conversation-only memory, as decided.trusted-policyis its own basis. Its only reader today is admission, which treats it exactly likelegacy: no requester recheck, because there is no requester. Neither basis reaches the sender bit (both owner runs carry none, so neither getsintent), and no Doctor check reads the basis yet.Scope, stated plainly: consumers still see the existing
undefined-or-falsesender bit. Only the source of the bit changes: the execution context'sauthority.ownerreplaces each runtime's own derivation. Removing the tri-state at the consumers is later cleanup, not this PR.Why This Change Was Made
The execution context already decides
authority.owneronce per occurrence (#178933, #178965). This PR makes the runtimes consume it.falsefor non-owners. The embedded runner and the Codex harness read it from the same run params.false.Known differences from the design, approved by the 0d5 coordinator:
session:<key>andmainjobs keep their session turn's own command-owner check. That check is already one boolean on both runtimes. Applying the builder'sowner: trueto the 44 storedsession:operator jobs would hand them owner-only tools they don't have today.automationsdenial. The loopback has no self-scoped automations grant yet, so letting the bit through would expose an unscopedautomationstool. 0d5.12 removes the denial when it passes the self scope (row 40).Unchanged rows:
message-action-dispatch.ts) keeps its occurrence-bound capability, per the design.scheduled-configured-mcp-authority.ts) is reached only whentrigger === "user"and there is no scheduled tool policy, so scheduled runs never reach it.Doctor's scheduled-run review (from #182328) now reads the owner surfaces (a lost owner shows
owner -> non-owner), and its CLI-backend section reports the parity gain this PR delivers instead of announcing it.run-prompt-executor.tsreached its 700-line limit after the rebase; the cron run admission, which owns the minted context, now exposes the run's sender bit.tool-resolution.tswas at its 700-line limit. The default HTTP deny computation moved unchanged totool-resolution-authority.ts, next to the new sender helper.Evidence
Crabbox, AWS (
c7a.8xlarge, us-east-1). Exit 0.CRABBOX_AWS_REGION=us-east-1 CRABBOX_CAPACITY_REGIONS=us-east-1,us-east-2,us-west-2 crabbox run --provider aws --keep --ttl 75m --timing-json --download proof-out.tgz=… --shell -- "bash proof/0d510-remote.sh"f260e0f51ed(this head). Crabbox verified the synced source SHA; the SHA-256 of all 27 changed files was checked on the remote against the local head: "changed files match local head". The proof scenario, mock-provider script, fake CLI, QA plugin and bind/authority probes are local proof tooling, not committed.aws,cbx_9f88c2e7a9da. Released after the run.Focused tests: 64/64 passed (owner authority, operator-source child, final-effect fence through the Gateway, memory audience,
run.bind-parentincluding bind-then-device-revoked refusal,bind-parent,cron-bind, Doctor's scheduled-run review).Real Gateway, Discord owner DM (Crabline local provider). The agent creates two automations from a Discord owner DM, one on the embedded runtime (
mock-openai) and one on a CLI backend whose fake CLI calls tools through the real MCP loopback. Each scheduled run calls the owner-onlyconversations_list.main(f211f3d601e), same scenarioconversations_list needs the owner's authoritycommands.ownerAllowFrom(nearest refused case): embeddedUpgrade from v2026.10.6 and from v2026.10.7 (latest stable). Each old build stores a linked job, an unlinked job and a linked memory-probe job (all with a
trustedpolicy and nocreatedActor; both versions store that shape) and runs the first two: allowed. After this build'sdoctor --fix,cron.listreturns every job unchanged.legacytrusted-policyOWNER-PRIVATE-NOTE/OWNER-PRIVATE-NOTE(owner-private audience)trusted-policyprofile-rolelegacycron.bind(feat(cron): bind older automations to the conversation that created them #182561) and these jobs.cron.bindonly applies to key-only links (unbound-parent), and a storedtrustedpolicy never classifies asunbound-parent. So a v2026.10.6/10.7 trusted job without a requester cannot be bound: run over each stored row,resolveCronBindParentrefuses the linked ones with "already bound to its parent conversation" and the unlinked ones with "only applies to automations linked to a parent conversation by session key alone". The jobs are unchanged and keep basistrusted-policy, the same owner-only tools and owner-private memory. Binding anaccount-policy key-only job leads to a parent with no recorded requester and anaccountpolicy, which stays non-owner.Final-effect revocation through the Gateway (
node scripts/run-vitest.mjs run src/cron/execution-context-owner-final-effect.test.ts, temporary result logging, request IDs redacted):4d3a98f72e0, entry check only)node.pair.list→node.pair.approve; pairing approvednode.pair.listagent tool caller authority is no longer active; dispatched["node.pair.list"]; request still pendingnode.pair.list→node.pair.approve; pairing approvednode.pair.listStatic replay (
scripts/dev/cron-context-replay.mtsover a copy of Josh's Gateway state; 105 jobs):gain-unexpected, 0loss.ownerCli: gain-intendedon 43 child and detached jobs (24 operator, 16 unbound, 3 parent-linked). Cause: Phase 3 runtime parity; the CLI takes the surface embedded runs already have.ownerEmbeddedisequalon every job. All 3 parent-linked child jobs have a requester profile that passes the owner check.equalon both fields.memoryvalue now names the parent audience (parent-owner/parent-conversation). Checked-in fixtures 28 and 29 cover both shapes: the v2026.10.6 trusted job →memory: parent-owner, gain-intended (cause: refinement of resolved decision 2), owner-only toolsequal; the agent-created account-policy job →memory: parent-conversation,ownerEmbedded: loss(cause: resolved decision 2, no recorded requester).pauseresults are archived parents (Phase B), unchanged by this PR: "Verify knowledge reload from main", "Verify bundled Knowledge after Gateway restart", "land bundled reload pr 180466", "babysit-pr-181933".ownerClilabel.Tests:
src/cron/execution-context-owner-authority.test.ts, one case per principal kind (operator, unbound, owner profile requester, non-owner profile requester, no recorded requester):automationsdenial.intent; a control with an explicit owner bit is.sessionsandautomationsgrants.execution-context.test.tspins its authority (owner: true, basistrusted-policy).execution-context-memory-audience.test.ts: that shape gets owner-private memory with a direct-chat parent on embedded and CLI; an agent-created account-policy job without a requester gets only the conversation's memory.run.operator-source-child.test.ts: the executor passes the context's bit to the run, and revoking the device during a run trips the owner-only recheck.execution-context-owner-final-effect.test.ts(final-effect fence, production dispatch path): a profile-requester job is admitted through cron occurrence admission andprepareCronRunAdmissionwith the Gateway context bound as cron binds it. Its embedded tools and its CLI loopback tools (resolveGatewayScopedTools) runnodes approveunder the admitted run's Gateway caller (createAdmittedGatewayToolCallerIdentity, as the CLI and embedded runners do), through the real in-process Gateway dispatch, the realnode.pair.list/node.pair.approvehandlers and the real pairing store. Only the profile catalog's residency check is stubbed so the test can remove the requester insidenode.pair.list.pnpm tsgo:core,pnpm tsgo:core:testand oxlint are clean on the rebased head. 33 files / 512 tests across the cron, bind, tool-resolution, agent-tools and run-admission callers pass, plus the fixtures (30) and Doctor cron suites (43).Autoreview (Claude engine, because the Codex CLI failed authentication on this host): scoped-clean at P1.