Skip to content

fix(gateway): enforce control-plane limits on cron mutations - #128287

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-cron-control-plane-20260823
Aug 23, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-cron-control-plane-20260823

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where authenticated operators could repeatedly add, update, remove, or manually run cron jobs without those mutating requests consuming the Gateway's control-plane write budget.

Why This Change Was Made

Classifies the four administrative cron mutations as control-plane writes at the canonical Gateway method-descriptor boundary. Read-only cron methods and agent-runtime scratch updates keep their existing admission behavior.

User Impact

Operators retain normal cron management behavior, while runaway or abusive cron mutation loops are now limited by the existing per-method control-plane budget instead of bypassing it.

Evidence

  • Regression-first proof: the new descriptor-classification test failed before the production change because cron.add was not classified as a control-plane write; both Gateway projects reproduced the failure.
  • Focused proof after the fix and after rebasing onto current main: OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs src/gateway/server-methods-list.test.ts src/gateway/server-methods.control-plane-rate-limit.test.ts — 116/116 tests passed.
  • Required changed-file gate: node scripts/check-changed.mjs -- src/gateway/methods/core-descriptors.ts src/gateway/server-methods-list.test.ts — passed all selected core, coreTests checks.
  • Gateway test-file benchmark: 56/56 baseline tests passed in 28.05s (28.61s elapsed, 816,188 KB max RSS); after the regression/fix, 58/58 passed in 12.56s (12.89s elapsed, 667,564 KB max RSS).
  • Fresh structured autoreview on the rebased branch: clean, no accepted/actionable findings.
  • Production diff: +4/-4 lines (net 0); tests: +17/-0.

@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Aug 23, 2026
@steipete
steipete marked this pull request as ready for review August 23, 2026 16:49
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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 Aug 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 12:56 PM ET / 16:56 UTC.

ClawSweeper review

What this changes

The PR marks cron creation, update, removal, and manual execution RPCs as control-plane writes and adds regression coverage for their descriptor policy.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: current main still omits the cron mutation classification, while the PR applies it at the canonical descriptor boundary and has no actionable correctness finding. The protected maintainer label and incomplete exact-head checks require normal maintainer merge handling.

Priority: P2
Reviewed head: 24d8611f3bbabdf9de601507bd41348412001ee5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused net-neutral fix at the shared policy boundary with targeted regression coverage; remaining work is exact-head validation and acceptance of the intentional rate-limit compatibility change.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies focused regression-first and after-fix test evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies focused regression-first and after-fix test evidence.
Evidence reviewed 5 items Current-main gap: Current main lists all four cron mutation methods without the control-plane-write policy, so they do not satisfy the registry predicate used by admission.
Canonical admission boundary: The request envelope checks descriptor metadata and consumes the existing budget before invoking a handler, making the policy table the correct repair owner.
Mutation ownership: The cron handlers implement add, update, remove, and manual-run operations and call the cron runtime, distinguishing them from the read-only cron methods left unclassified.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/gateway/server-methods-list.test.ts src/gateway/server-methods.control-plane-rate-limit.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs src/gateway/server-methods-list.test.ts src/gateway/server-methods.control-plane-rate-limit.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128287-j3gwQF/target$ node scripts/run-vitest.mjs src/gateway/server-methods-list.test.ts src/gateway/server-me
thods.control-plane-rate-limit.test.ts
node scripts/run-vitest.mjs src/gateway/server-methods-list.test.ts src/gateway/server-methods.control-plane-rate-limit.test.ts
[test] starting test/vitest/vitest.gateway.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128287-j3gwQF/target

 ✓  gateway-server-isolated  ../../src/gateway/server-methods-list.test.ts (29 tests) 22ms
 ✓  gateway-server-isolated  ../../src/gateway/server-methods.control-plane-rate-limit.test.ts (29 tests) 109ms
 ✓  gateway-server  ../../src/gateway/server-methods-list.test.ts (29 tests) 37ms
 ✓  gateway-server  ../../src/gateway/server-methods.control-plane-rate-limit.test.ts (29 tests) 89ms

 Test Files  4 passed (4)
      Tests  116 passed (116)
   Start at  16:57:11
   Duration  21.39s (transform 24.81s, setup 1.04s, import 30.64s, tests 257ms, environment 0ms)

[test] passed 1 Vitest shard in 27.52s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128287-j3gwQF/target$ node scripts/run-vitest.mjs src/gateway/server-methods-list.test.ts src/gateway/server-me
thods.control-plane-rate-limit.test.ts






























Assertions:

  • PASS expect_output: Test Files

How this fits together

Gateway method descriptors define each RPC’s authorization and admission attributes before the Gateway dispatches its handler. Operator cron requests flow through that shared descriptor registry, where control-plane writes consume the per-method budget before mutating scheduled jobs.

flowchart LR
  A[Authenticated operator request] --> B[Gateway method descriptor]
  B --> C[Control-plane write check]
  C --> D[Rate-limit admission]
  D --> E[Cron mutation handler]
  E --> F[Scheduled job state]
Loading

Before merge

  • Resolve merge risk (P1) - Existing cron automation that exceeds 30 requests for one mutation method per device/IP in a minute will now receive retryable rate-limit responses; that intentional upgrade behavior should be accepted with the existing control-plane policy.
  • Resolve merge risk (P1) - The branch is behind current main and its required check suite was still incomplete in the supplied context, so mergeability and CI need an exact-head refresh before landing.
  • Complete next step (P2) - The maintainer label and incomplete exact-head checks require explicit maintainer merge handling; no autonomous repair is indicated.
Agent review details

Security

None.

PR surface

Source 0, Tests +17. Total +17 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 4 0
Tests 1 17 0 +17
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 21 4 +17

Review metrics

Metric Value Why it matters
Production versus test delta production net 0 (+4/-4); tests +17 The bounded policy repair preserves production size while adding focused descriptor regression coverage.
Control-plane policy coverage 4 existing cron mutations newly classified These methods now consume the established 30-per-minute per-method identity budget before dispatch.

Merge-risk options

Maintainer options:

  1. Accept the existing control-plane budget (recommended)
    Land after exact-head checks are green, intentionally applying the established per-method write cap to cron automation.
  2. Prove burst-client handling
    Before merge, exercise a supported cron mutation client past the budget and confirm it receives and handles the retryable response as intended.

Technical review

Best possible solution:

Keep the four mutations in the canonical descriptor policy and land after exact-head CI confirms the existing budget is the intended compatibility boundary for cron automation.

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

Yes—source inspection on current main shows the four cron mutations lack the descriptor flag, while the shared request envelope consumes the budget only when that flag is present.

Is this the best way to solve the issue?

Yes. The descriptor table is the canonical policy owner, and the existing Gateway envelope already enforces that policy before invoking the cron handler.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 7941c05e44e5.

Labels

Label changes:

  • add P2: This repairs a bounded Gateway control-plane admission gap for authenticated operator mutations.
  • add merge-risk: 🚨 compatibility: Existing high-frequency cron mutation automation will now be constrained by the Gateway’s established write budget.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies focused regression-first and after-fix test evidence.

Label justifications:

  • P2: This repairs a bounded Gateway control-plane admission gap for authenticated operator mutations.
  • merge-risk: 🚨 compatibility: Existing high-frequency cron mutation automation will now be constrained by the Gateway’s established write budget.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless supplies focused regression-first and after-fix test evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the cron descriptor rows and control-plane request-envelope logic to this Gateway history; recent file history is also concentrated in this area. (role: introduced current Gateway descriptor and admission surface; confidence: high; commits: b26ee4fb3500, a7f9a7fdd4fe; files: src/gateway/methods/core-descriptors.ts, src/gateway/server-methods.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete exact-head CI after refreshing the branch against current main.
  • If a supported batch cron client exists, record a redacted burst test showing its retryable rate-limit handling.

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.

Copy link
Copy Markdown
Contributor Author

Land-ready evidence for 24d8611f3bbabdf9de601507bd41348412001ee5:

  • Regression-first descriptor test failed on the pre-fix rows because cron.add was not classified as a control-plane write.
  • OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs src/gateway/server-methods-list.test.ts src/gateway/server-methods.control-plane-rate-limit.test.ts — 116/116 passed after the one clean rebase.
  • node scripts/check-changed.mjs -- src/gateway/methods/core-descriptors.ts src/gateway/server-methods-list.test.ts — all selected core, coreTests gates passed.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main — clean, no accepted/actionable findings.
  • Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/32652890687 — green for the reviewed SHA.
  • Native review artifacts validate READY FOR /prepare-pr with zero findings; OPENCLAW_TESTBOX=1 scripts/pr prepare-run 128287 passed in hosted_exact_or_recent_parent mode by reusing the exact-head hosted gates. No separate Testbox lease/run was needed.
  • Production LOC: +4/-4 (net 0); tests: +17/-0.

ClawSweeper disposition:

  1. Compatibility risk accepted: the established 30/minute per-method control-plane budget is the intended boundary for these four operator mutations; requests above it receive the existing retryable rate-limit response.
  2. Exact-head refresh complete: hosted CI is green on the reviewed head. The branch was not rebased again merely because main moved; the PR is conflict-free and native policy treats behind-main drift as advisory.
  3. Maintainer handling complete: this maintainer-authored PR is proceeding through the required scripts/pr review/prepare/merge flow.

Rank-up moves: exact-head CI is complete. No separate supported burst cron client was identified; the shared envelope rate-limit regression is the canonical deterministic proof, so no client-specific live burst was manufactured. There is no UI-visible behavior to capture.

@steipete
steipete merged commit bca206d into main Aug 23, 2026
304 checks passed
@steipete
steipete deleted the codex/autoqa-cron-control-plane-20260823 branch August 23, 2026 17:29

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants