Repository navigation
refactor(limits): single canonical automation-limits module - #1104
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 2:29 PM ET / 18:29 UTC. ClawSweeper reviewWhat this changesThe PR makes the top-level automation-limits module the single owner of worker-budget derivation and updates repair code and tests to use it. Merge readinessKeep open for normal merge review. The branch removes a real duplicated limit implementation, redirects all seven repair consumers to the canonical module, and supplies strong container-backed equivalence proof; no actionable patch defect was found. Priority: P3 Review scores
Verification
How this fits togetherAutomation limits are read from repository configuration and converted into lane budgets used by review and repair workflows. Those workflows use the resulting limits to cap worker concurrency and job dispatches. flowchart LR
A[Automation limits config] --> B[Canonical limits module]
B --> C[Derived lane budgets]
C --> D[Review automation]
C --> E[Repair automation]
D --> F[Review workers]
E --> G[Repair job dispatch]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land one canonical limits implementation while retaining the focused equivalence proof and dual-build validation as guardrails for future capacity changes. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor rather than a report of a user-observable failure. The relevant verification is deterministic limit equivalence across the affected scheduler scenarios. Is this the best way to solve the issue? Yes. Removing the duplicate owner and routing repair consumers to the existing top-level module is the narrowest maintainable way to eliminate the demonstrated drift. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3a38d3622a9b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: refactor(limits): single canonical automation-limits module This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
What Problem This Solves
ClawSweeper had two copies of the scheduler capacity math:
src/limits.tsandsrc/repair/limits.ts. They shared roughly 223 lines but had already drifted. The repair copy alone parsedlanes.exact_review.target_max_concurrent, exposed theassistlane, and implementedworkerLimit("assist"). Keeping two owners for these derived budgets leaves review and repair runtimes vulnerable to mixed behavior after otherwise correct limit changes.Why This Change Was Made
src/limits.tsis now the canonical superset. It contains the repair-only target and assist fields, all seven repair consumers import it directly, and the duplicatesrc/repair/limits.tsis deleted. The repair test imports the canonical compiled module as well.Both TypeScript configurations compile the canonical module without configuration changes.
tsconfig.jsonincludessrc/limits.tsdirectly;tsconfig.repair.jsonfollows the rewritten repair imports to compilesrc/limits.tsandsrc/queue-pressure.ts. No include expansion was needed.User Impact
No derived value or runtime limit changes. This removes the divergent implementation path so future automation-limit edits have one owner.
Drift Evidence
Before this change, the repair copy alone contained:
lanes.exact_review.target_max_concurrentlanes.assist.maxassistworker lane andworkerLimit("assist")The remaining capacity formulas were duplicated between the two files.
Real Behavior Proof
src/limits.tsandsrc/repair/limits.ts, includingWORKER_CONFIG,AUTOMATION_LIMITS,readWorkerConfig(),deriveAutomationLimits()at worker maxima 64/128/256, andworkerLimit()for every lane under default, active-worker, soft-pressure, hard-pressure, and unknown-pressure scenarios.origin/main, reconstructs both pre-change modules withgit show, compiles them and the current canonical module in isolated temporary trees, serializes recursively sorted JSON, and requires an empty unified diff.origin/mainhad not changed the historical modules or config, so the run selectedorigin/mainat3a38d3622a9b9874fe40f813dc7d1235ea4a024b; merge base35b5f622c968cf3acb2fbe8226ffeef801422a88is recorded alongside it.crabbox run --provider local-container --local-container-image node:24-bookworm --fresh-pr openclaw/clawsweeper#1104 --no-hydrate ... docs/proof/unify-automation-limits/run-proof.sh; Crabbox CLI 0.41.1, Docker 29.4.0 via OrbStack, Node v24.19.0, pnpm 11.10.0, Corepack enabled into$HOME/.local/bin.PROOF_RC=0; containerPROOF_RC=0;value_diff=empty;pnpm run check:limitspassed. Container leasecbx_7f99f448f5d1(harbor-barnacle), runrun_da41fab8ff24, reviewed head87a6ae8c4555e6350ff4559086bc2c03e76382b6, stopped automatically.Value diff output (verbatim; empty):
Validation
docs/proof/unify-automation-limits/run-proof.sh(local and Docker-backed Crabboxlocal-container)pnpm run format:checkpnpm run check:limitspnpm run build:allpnpm run test:no-buildpnpm run lintpnpm run check:active-surfacepnpm run check:dashboard-queue-boundaryorigin/main: clean, no accepted/actionable findingsOpenClaw Bay Impact
None. This is an internal source-ownership consolidation with no lifecycle publication, queue/workflow behavior, status/telemetry, or dashboard data-contract change. OpenClaw Bay remains unaffected.