Repository navigation
Description
Summary
Provide per-agent isolation for the cron scheduler by storing and managing scheduled jobs in an agent-scoped jobs.json instead of a global list.
Problem to solve
In a multi-user / multi-agent deployment, any agent that has permission to use the cron tool can currently create, edit, delete, and list scheduled tasks. The critical issue is that the job list appears to be global to the entire OpenClaw instance: if one agent maps to one user, then a user can see scheduled tasks created by other users’ agents, and may even be able to edit or delete them. This creates a serious isolation and security risk (information leakage + cross-tenant modification).
I’d like OpenClaw to introduce a new capability to isolate scheduled tasks per agent, for example by letting each agent use an independent jobs.json (agent-scoped storage and CRUD), so that agents can only view and manage their own scheduled jobs.
Proposed solution
Proposed solution
Introduce agent-scoped cron job storage and access control so scheduled tasks are isolated per agent (and therefore per user in multi-user deployments).
Storage isolation: Instead of a single global jobs.json, maintain a separate jobs.json per agent (e.g., under each agent’s state directory such as /cron/jobs.json), or another equivalent per-agent persistence mechanism.
Access control: The cron tool should only list / create / update / delete jobs within the caller agent’s own scope by default. Cross-agent visibility or modification should be impossible unless explicitly enabled by an administrator.
Migration / backward compatibility: If a global job file exists, provide a migration path (e.g., on startup: migrate existing jobs into the corresponding agent’s jobs.json when the owner can be determined; otherwise place them into an “unassigned” admin-only scope).
Optional admin mode: Optionally allow an admin/operator to query aggregated jobs across agents for operational purposes, but keep this separate from default agent behavior.
This would prevent information leakage and cross-tenant tampering in multi-user environments where each agent represents a different user.
Alternatives considered
No response
Impact
Affected users / systems / channels:
This primarily affects multi-user OpenClaw deployments where one agent maps to one end user (e.g., team or enterprise environments). It impacts any system using the cron tool in shared gateway setups, including chat channels (Feishu, Slack, etc.) and automated workflows that rely on scheduled jobs.
Severity:
High — this is a security and isolation issue, not just a usability concern. It can lead to cross-tenant visibility and potential unauthorized modification or deletion of scheduled jobs. In regulated or enterprise environments, this may violate basic multi-tenant isolation expectations.
Frequency:
Always reproducible in multi-agent environments where multiple agents have cron permissions. The risk increases as the number of users/agents grows.
Consequence:
Information leakage (users can see other users’ scheduled tasks)
Risk of accidental or malicious modification/deletion of other users’ jobs
Reduced trust in multi-user deployments
Additional manual operational overhead to monitor and remediate conflicts
Evidence/examples
No response
Additional information
No response
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
zard-wang commentedon Mar 2, 2026
Hi, I'm hitting this exact issue in production and want to share my experience and a possible lightweight fix.
My Setup
4 agents serving multiple users via WeChat Work (企业微信), each agent bound to a different WeChat app:
shaniu(general assistant) →wecomchannelyousuo(news analyst) →wecom-yousuochannelniumo(finance) →wecom-niumochannelhuangmei(history) →wecom-huangmeichannelMultiple users chat with the same agent. Sessions are properly isolated via
session.dmScope: "per-channel-peer".The Problem (with evidence)
When User A (cstarnight) asks yousuo "show my scheduled tasks",
cron.listreturns ALL 4 jobs — including 3 jobs created by User B (WangZiChun). The AI then displays all of them, leaking:wecom-agent:WangZiChun)Worse: in one instance, the AI proactively modified User B's job (changed
delivery.to) when User A asked about tasks. This is cross-user data tampering.What I Tried (soft constraints don't work)
I spent significant time trying to solve this without code changes:
sessionKey/delivery.to→ AI ignores it ~80% of the timecreatedByfield injobs.json→ gets stripped byCronJobschema serializationsessionKeyfield on jobs + SOUL.md filtering → worked once, failed next timeConclusion: prompt-based filtering is fundamentally unreliable for privacy. This needs a hard constraint at the API level.
Proposed Fix (minimal, backward-compatible)
I've analyzed the source code and identified a ~30-line change across 4 files. Rather than per-agent storage (which is a bigger refactor), a simpler approach:
Add optional
sessionKeyfilter tocron.list:schema/cron.ts— addsessionKey: Type.Optional(Type.String())toCronListParamsSchemacron/service/ops.ts—listPage()filters jobs by matching peer ID extracted fromsessionKeygateway/server-methods/cron.ts— passsessionKeyparam through to serviceagents/tools/cron-tool.ts— auto-passopts.agentSessionKeywhen callingcron.listThe key insight:
CronJobalready has asessionKeyfield ("Origin session namespace"), andcreateCronToolalready receivesagentSessionKey. They just aren't connected for list operations.Backward compatible: omitting
sessionKeyreturns all jobs (existing behavior). The tool-level change auto-passes it, so AI never sees other users' jobs.This also complements the per-agent storage proposal — even with per-agent
jobs.json, you'd still need per-user filtering within a shared agent.Happy to Submit a PR
I have the implementation ready and can submit a PR if maintainers agree this approach aligns with the project direction. Would love feedback on:
cron.listAPI level the right layer? Or should this be enforced elsewhere?sessionKeyor just the peer ID portion?Thanks for a great project — OpenClaw's architecture is solid, this is one of the few gaps I've found in a real multi-user deployment.
padixa commentedon Mar 11, 2026
Our use case in multi-agent deployment:
Agent execution unclear: cron jobs don not clearly specify which agent should execute, leading to random assignment
Cross-app open_id issue: Different Feishu apps see different open_ids for the same user, causing delivery failures
Tasks modified by other agents: Any agent can modify cron jobs created by other agents, causing configuration chaos
Suggested:
juanpablodlc commentedon Mar 18, 2026
+1 - let's please prioritize this. We need to enforce per-agent cron ownership in createCronTool
Scope list, update, remove, run, and runs; leave status and add unchanged.
steipete commentedon Apr 26, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Keep open. Current main still has global cron management for the reported surfaces: jobs can carry agent/session metadata and cron.add stamps caller metadata, but cron.list, cron.update, cron.remove, cron.run, and cron.runs do not receive or enforce trusted caller scope. The issue discussion includes concrete production reports and a recent maintainer comment keeping the ownership model open for follow-up.
Required change / next step:
Keep this issue open for a maintainer-designed cron ownership model. The likely path is to thread trusted caller agent/session scope from createCronTool or the Gateway request context into cron.list, cron.update, cron.remove, cron.run, and cron.runs; enforce default job visibility/mutation by owner; preserve an explicit admin/operator all-jobs mode; handle existing global jobs safely; and update docs/tests alongside the protocol/service/UI surfaces. Related issue #35447 should be considered during consolidation, but this issue has the richer production context and should not be closed now.
Best possible solution:
Keep this issue open for a maintainer-designed cron ownership model. The likely path is to thread trusted caller agent/session scope from createCronTool or the Gateway request context into cron.list, cron.update, cron.remove, cron.run, and cron.runs; enforce default job visibility/mutation by owner; preserve an explicit admin/operator all-jobs mode; handle existing global jobs safely; and update docs/tests alongside the protocol/service/UI surfaces. Related issue #35447 should be considered during consolidation, but this issue has the richer production context and should not be closed now.
Acceptance criteria:
What I checked:
src/agents/tools/cron-tool.ts:656, 20e21173715e)src/gateway/protocol/schema/cron.ts:282, 20e21173715e)src/gateway/server-methods/cron.ts:135, 20e21173715e)src/cron/service/ops.ts:274, 20e21173715e)docs/automation/cron-jobs.md. (docs/automation/cron-jobs.md:42, 20e21173715e)Likely related people:
src/cron/service/ops.ts,src/cron/service-contract.ts,src/gateway/protocol/schema/cron.ts)src/cron/service/ops.ts,src/gateway/protocol/schema/cron.ts,src/gateway/server-methods/cron.ts)src/agents/tools/cron-tool.ts,src/agents/tools/cron-tool.test.ts,src/cron/isolated-agent/delivery-target.ts)Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 20e21173715e.
clawsweeper commentedon May 1, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Current main now implements trusted caller-scoped cron access for agent-originated list/get/add/update/remove/run/runs, with regression coverage and merged PR/release provenance; the adjacent declarative agent cron configuration request remains separate.
I found the merged PR that appears to have closed this: #96883: Scope agent cron operations to the calling agent.
Root-cause cluster
Relationship:
canonicalCanonical: #26370
Summary: This issue is the canonical production-context report for agent cron ownership; the merged caller-scoped cron PR implements it, while related cron configuration and run-history items are duplicate, partial, or adjacent.
Members:
fixed_by_candidate: Scope agent cron operations to the calling agent #96883 - Merged PR implements trusted caller identity and caller-scoped cron operations.duplicate: [Feature]:crontool: add per-agent/session isolation for job visibility and mutations #35447 - Closed issue requested the same per-agent/session cron visibility and mutation isolation with less production context.partial_overlap: cron.runs with scope=all leaks job names across sessions #49175 - Run-history job-name leakage was a narrower follow-up within the same cron visibility boundary.adjacent_distinct: Feature Request: Addcronfield to Agent configuration for Agent-owned scheduled tasks #46590 - Open issue requests declarative agent cron configuration, not the access-control enforcement now implemented here.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Close this issue as implemented by the caller-scoped cron fix, and keep declarative agent-owned cron configuration tracked separately in #46590.
Do we have a high-confidence way to reproduce the issue?
Yes at source level: the earlier issue discussion and pre-fix review showed global cron management by bare id, and current tests now encode the same-agent and foreign-agent access cases that would have exposed the bug.
Is this the best way to solve the issue?
Yes: the landed fix enforces ownership at the trusted Gateway caller boundary while preserving unscoped operator behavior, which addresses the reported access-control problem without requiring per-agent storage as a separate persistence refactor.
Security review:
Security review cleared: The issue is security-sensitive, and current main now enforces trusted caller-scoped cron access for the reported boundary.
AGENTS.md: found and applied where relevant.
What I checked:
src/gateway/server-methods/cron.ts:89, f27d494d00e7)src/gateway/server-methods/cron.ts:559, f27d494d00e7)src/agents/tools/cron-tool.ts:948, f27d494d00e7)src/gateway/server-methods/cron.validation.test.ts:533, f27d494d00e7)Likely related people:
src/gateway/server-methods/cron.ts,src/agents/tools/cron-tool.ts,src/gateway/server-methods/cron.validation.test.ts)src/gateway/server-methods/cron.ts,src/gateway/server-methods/cron.validation.test.ts,src/cron/service/store.ts)src/gateway/server-methods/cron.ts,src/gateway/protocol/schema/cron.ts,src/cron/service/ops.ts)Codex review notes: model internal, reasoning high; reviewed against f27d494d00e7; fix evidence: merged PR #96883, release v2026.7.1-beta.1, commit cee2aca40912.