Repository navigation
fix(cron): scope all-run job names - #80146
HemantSudarshan wants to merge 3 commits into
Conversation
|
Thanks for the context here. I did a careful shell check against current Close: current main already has a same-or-better trusted caller-scope cron fix from the merged cron ownership PR, so this stale branch is no longer the right landing path. Root-cause cluster Members:
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 detailsBest possible solution: Keep the current-main trusted caller-scope cron implementation from #96883 and close this older narrower branch. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the latest release builds all-scope Is this the best way to solve the issue? No for this branch; current main's trusted caller-scope implementation is the better fix because it derives scope from Gateway client identity instead of accepting caller-supplied Security review: Security review needs attention: The branch's proposed fix uses caller-supplied
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against ff1e7e1305cc; fix evidence: commit cee2aca40912, main fix timestamp 2026-06-27T02:41:14Z. |
21de933 to
bda1db1
Compare
|
Updated this branch to current What changed after the ClawSweeper review:
Validation run at the new head:
Remaining external gate from the prior review: contributor-supplied real gateway/UI or persisted cron run-history proof and maintainer/security confirmation of the all-scope run-log visibility boundary. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Fixes #49175.
cron.runswithscope: "all"still returns global run-log rows, but job-name enrichment now uses the same agent-scoped job visibility path ascron.listinstead of reading every job through the unfilteredcron.list()shortcut.Problem summary
cron.runs(scope=all)builtjobNameByIdfromcontext.cron.list({ includeDisabled: true }). That list is not caller/agent filtered, so run-history responses could attach another agent's cron job name to otherwise global run entries.Root cause
The all-scope run-log reader intentionally scans all run logs, but the server method reused an unscoped job list to enrich those entries and to make job names searchable. The leak was in the enrichment map, not in scheduler execution or run-log storage.
Architectural reasoning
context.cron.listPage()for the job-name lookup because it already appliesagentIdfiltering and effective default-agent handling.limit: 200so the enrichment map remains complete for large visible job lists.agentIdonCronRunsParams; when omitted, enrichment defaults to the cron service default agent, then the canonicalmaindefault.cron.runs, scheduling, delivery, cleanup, retry, and background-task behavior unchanged.Testing performed
pnpm test src/gateway/server-methods/cron.runs.test.ts src/gateway/protocol/cron-validators.test.tspnpm exec oxfmt --check --threads=1 CHANGELOG.md src/gateway/protocol/schema/cron.ts src/gateway/protocol/cron-validators.test.ts src/gateway/server-methods/cron.ts src/gateway/server-methods/cron.runs.test.tspnpm tsgo:corepnpm tsgo:core:testpnpm lint:coreOPENCLAW_LOCAL_CHECK=1 OPENCLAW_LOCAL_CHECK_MODE=throttled pnpm check:changedpnpm check:changelog-attributionsgit diff --check upstream/main...HEADReal behavior proof
cron.runs(scope=all)no longer builds its job-name enrichment map from every cron job across all agents.v22.15.0, pnpm10.33.2. The repo warns that Node>=22.16.0is preferred on this machine; the targeted proof below completed.cron.runsserver handler from the source checkout withscope: "all"andagentId: "main"; the command throws if the old unscopedcron.list()path is used and records the actual listing call made by the handler.{ "unscopedListCalls": 0, "listPageCalls": [ { "includeDisabled": true, "agentId": "main", "limit": 200, "offset": 0 } ], "response": { "ok": true, "result": { "entries": [], "total": 0, "offset": 0, "limit": 1, "hasMore": false, "nextOffset": null } } }unscopedListCalls: 0) and used the agent-scoped paginated list path withagentId: "main"; the call returned successfully.src/gateway/server.cron.test.ts -t "writes cron run history"integration test was attempted locally and still fails here because the pre-existing all-scope run-log directory listing path returns no entries under the local fs-safe/root implementation. That failure is independent of this privacy fix; the added regression directly tests the changed handler contract.Risk analysis
Risk is low-to-medium. The changed runtime path is limited to all-scope
cron.runsjob-name enrichment. It does not alter run execution, scheduler concurrency, cleanup, delivery, retries, or job-specific run-history reads. The main compatibility change is intentionally privacy-preserving: callers still receive all-scope run entries, but job names are only attached for the requested/default agent scope.Backward compatibility
Additive protocol change:
CronRunsParamsnow accepts optionalagentId. Existingcron.runscallers remain valid.