Skip to content

fix: [Feature]: Continuously admit newly due cron jobs while earlier timer-batch jobs are still running - #119139

Closed
zyw02 wants to merge 3 commits into
openclaw:mainfrom
zyw02:auto/issue-119083
Closed

zyw02 wants to merge 3 commits into
openclaw:mainfrom
zyw02:auto/issue-119083

Conversation

@zyw02

@zyw02 zyw02 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review feedback addressed

ClawSweeper durable review on e9153473897059f54a7836ba423264482c4b2964 (Overall 4/6) blocked merge on dirty merge state (rebase onto current main) plus a fresh exact-head scheduler proof after that rebase. Competing draft #119195 remains for maintainer canonical-branch selection. This tip answers the rebase gate:

  1. [x] Rebase dirty branch onto current origin/main — resolved conflict in src/cron/service/ops.run-admission.test.ts (kept bounded-admission deferred gating); re-imported createDeferred from test/helpers/promise.js after main's helper migration.
  2. [x] Bound scheduled admission before reserving saturated ticks (P1) — unchanged; tryAcquireCronRunSlots + capacity listener.
  3. [x] Prefer earliest-due + skip saturated no-op Gateway roots — retained.
  4. [x] Exact-head isolated real scheduler proof for final head 0574d28e39337c2da5bf6df2aeb37d0ded4f6153 — standalone Node/tsx proof (no vitest, no fake timers) exercises production createCronServiceState + onTimer for cross-tick concurrency, saturation non-reserve, listener-driven refill, durable marker cleanup, and earliest-due prefix admission.

Focused vitest on tip 0574d28e39337c2da5bf6df2aeb37d0ded4f6153: cross-tick + ops.run-admission → 24 passed.

Final PR head: 0574d28e39337c2da5bf6df2aeb37d0ded4f6153

Closes #119083

What Problem This Solves

Addresses #119083: Continuously admit newly due cron jobs while earlier timer-batch jobs are still running, without unbounded saturated retention.

Why This Change Was Made

Scheduled ticks must admit only immediately free slots, leave saturated due work eligible, wake once via a capacity listener, and prefer earliest-due jobs when only a free-slot prefix exists.

User Impact

Later-due cron work can start while earlier batches still run when capacity allows; a full pool no longer stacks reserved/waiter/root work for every watchdog recheck.

Evidence

Exact-head real scheduler proof (0574d28e39337c2da5bf6df2aeb37d0ded4f6153)

git rev-parse HEAD
0574d28e39337c2da5bf6df2aeb37d0ded4f6153

NODE_ENV=test PROOF_TIP=0574d28e39337c2da5bf6df2aeb37d0ded4f6153 ./node_modules/.bin/tsx \
  .issue-hunter-proof-runtime/proof-bounded-admission-final-head.ts

PROOF tip=0574d28e39337c2da5bf6df2aeb37d0ded4f6153
runtime=/root/workspace/issue-hunter/data/manual-119139-fix/.issue-hunter-proof-runtime
storePath=/root/workspace/issue-hunter/data/manual-119139-fix/.issue-hunter-proof-runtime/jobs.json
PHASE1 cross-tick free capacity
job-start id=proof-a active=1 peak=1
job-start id=proof-b active=2 peak=2
CHECK PASS: cross-tick concurrent admission peakActive=2
CHECK PASS: cross-tick durable cleanup
PHASE2 saturation non-reserve + listener refill
sat-job-start id=sat-a active=1 peak=1
sat-job-start id=sat-b active=2 peak=2
CHECK PASS: saturation leaves due work unreserved
sat-job-start id=sat-c active=2 peak=2
capacity-wake delayMs=10.4
CHECK PASS: listener-driven refill after capacity release
CHECK PASS: post-saturation durable cleanup
PHASE3 earliest-due prefix admission
earliest-start id=proof-early
CHECK PASS: earliest-due preferred when only a free-slot prefix exists
earliest-start id=proof-late
CHECK PASS: earliest-due phase cleanup
OUTCOME: PROVED (7/7 checks)
- cross-tick concurrent admission peakActive=2
- cross-tick durable cleanup
- saturation leaves due work unreserved
- listener-driven refill after capacity release
- post-saturation durable cleanup
- earliest-due preferred when only a free-slot prefix exists
- earliest-due phase cleanup

transcript_sha256=5d8c90f76baad107dca3d5e12070d6ddbe23c2626443a174345d70bcccc3931b

Focused vitest

✓ cron service cross-tick bounded admission > starts a later-due job while an earlier timer batch still runs
✓ cron service cross-tick bounded admission > does not reserve or retain timer batches while all slots are full
✓ cron service cross-tick bounded admission > wakes unreserved due work when a partially admitted job releases capacity
✓ cron service cross-tick bounded admission > arms the next unclaimed wake while an earlier batch is still running
✓ cron service cross-tick bounded admission > admits earliest-due jobs first when only a prefix of the pool is free

 Test Files  2 passed (2)
      Tests  24 passed (24)

AI-assisted development

This change was implemented with an OpenClaw coding agent and published through a guarded human-approval workflow. The exact diff and exact-head validation evidence were verified before publication.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 10:59 PM ET / August 10, 2026, 02:59 UTC.

ClawSweeper review

What this changes

This PR lets newly due cron jobs use immediately free shared-concurrency slots while earlier scheduled jobs still run, without reserving saturated work.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer selection: current main still serializes timer batches, while this branch supplies a bounded cross-tick repair with source-backed tests and an exact-head scheduler trace. No discrete patch defect was found; exact-head CI and selection against the competing draft remain before merge.

Priority: P1
Reviewed head: 0574d28e39337c2da5bf6df2aeb37d0ded4f6153
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A well-evidenced scheduler repair with no discrete correctness finding, pending canonical-branch selection and exact-head CI completion.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR provides an exact-head terminal trace through production scheduler state and timer entry points with observed after-fix concurrency, refill, ordering, and cleanup.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR provides an exact-head terminal trace through production scheduler state and timer entry points with observed after-fix concurrency, refill, ordering, and cleanup.
Evidence reviewed 6 items Current-main defect: Current main returns whenever a timer batch is already marked running, so later timer ticks cannot collect newly due jobs.
Bounded admission repair: The branch acquires only slots available now, leaves excess due rows unreserved, and installs one capacity listener for the next release.
Regression coverage: The new scheduler-boundary tests cover cross-tick admission, saturation without durable reservation, listener refill, timer re-arming, and earliest-due selection.
Findings None None.
Security None None.

How this fits together

Cron scheduling loads due persisted jobs, records reservations, and runs them through one shared concurrency pool. This change affects how timer ticks choose work and wake overdue jobs after capacity is released.

flowchart LR
  A[Persisted cron jobs] --> B[Timer tick]
  B --> C[Due-job selection]
  C --> D[Shared run admission]
  D --> E[Isolated cron execution]
  E --> F[Capacity release]
  F --> B
Loading

Decision needed

Question Recommendation
Should this PR become the canonical repair for cross-tick cron admission instead of the overlapping draft at #119195? Adopt this branch: Use this clean, proof-positive branch as the canonical repair once its exact-head required checks are green.

Why: Both branches modify the same scheduler and admission invariants; the competing branch is draft and dirty, while choosing a canonical implementation is a maintainer merge-scope decision.

Before merge

  • Resolve merge risk (P1) - This bug repair is production net +250 lines, including a child-tick lifecycle tracker; maintainers should accept that added scheduler complexity only with completed exact-head CI.
  • Resolve merge risk (P1) - A competing draft at Cron: bound cross-tick admission #119195 targets the same invariant, so both branches should not land independently.
Agent review details

Security

None.

PR surface

Source +251, Tests +399. Total +650 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 5 381 130 +251
Tests 2 410 11 +399
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 791 141 +650

Review metrics

Metric Value Why it matters
Production versus test LOC production +379/-129 (net +250); tests +410/-11 (net +399); test support +2/-1 (net +1) The positive production delta implements bounded reservation and refill ownership, so its lifecycle complexity warrants exact-head validation before merge.

Stored data model

Persistent data-model change detected: serialized state: src/cron/service/state.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #119083
Summary: This PR is a candidate repair for the canonical cross-tick cron-admission issue; the other open PR addresses the same root cause but is not currently a viable replacement.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Merge this as the canonical repair (recommended)
    Complete exact-head CI, then merge this branch and avoid landing the overlapping draft independently.
  2. Pause for consolidation
    Ask for a single maintained scheduler implementation if maintainers want to preserve unique safeguards from the competing draft.

Technical review

Best possible solution:

Adopt one canonical bounded-admission repair, preferably this clean proof-positive branch after exact-head CI is green, and close or preserve the competing draft only through an explicit maintainer decision.

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

Yes—source reproducible: current main's running guard prevents a later timer tick from collecting work, and the branch's regression tests encode the reported deferred-job sequence.

Is this the best way to solve the issue?

Yes—the branch repairs admission at the scheduler and shared-capacity owner, rather than merely removing the running guard or retaining unbounded waiter batches.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8430fc0e3b86.

Labels

Label justifications:

  • P1: This repairs scheduled automations that can remain delayed despite configured cron capacity being free.
  • merge-risk: 🚨 availability: The diff changes the timer lifecycle, capacity wake-up behavior, and shared execution admission path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR provides an exact-head terminal trace through production scheduler state and timer entry points with observed after-fix concurrency, refill, ordering, and cleanup.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides an exact-head terminal trace through production scheduler state and timer entry points with observed after-fix concurrency, refill, ordering, and cleanup.

Evidence

What I checked:

  • Current-main defect: Current main returns whenever a timer batch is already marked running, so later timer ticks cannot collect newly due jobs. (src/cron/service/timer-scheduler.ts:166, 8430fc0e3b86)
  • Bounded admission repair: The branch acquires only slots available now, leaves excess due rows unreserved, and installs one capacity listener for the next release. (src/cron/service/timer-scheduler.ts:278, 0574d28e3933)
  • Regression coverage: The new scheduler-boundary tests cover cross-tick admission, saturation without durable reservation, listener refill, timer re-arming, and earliest-due selection. (src/cron/service.cross-tick-admission.test.ts:33, 0574d28e3933)
  • Exact-head behavior proof: The PR body records a standalone production scheduler run at the final head with 7/7 observed checks, including cross-tick concurrency, saturation non-reservation, listener refill, cleanup, and earliest-due admission. (0574d28e3933)
  • Admission ownership history: Shared cron admission dates to the historical max-concurrency repair, making that area the relevant owner boundary for this change. (src/cron/service/run-admission.ts:7, 7ba436ac7048)
  • Current-main-only check: The PR head is not contained by current main, so the requested behavior is not already implemented on main or the supplied latest release. (0574d28e3933)

Likely related people:

  • NianJiu: The historical max-concurrency repair introduced the shared cron admission neighborhood this PR extends. (role: introduced shared admission; confidence: medium; commits: 7ba436ac7048; files: src/cron/service/run-admission.ts, src/cron/service/timer-scheduler.ts)
  • Peter Steinberger: Recent cron lifecycle and durable-run recovery commits are adjacent to the reservation and recovery invariants changed here. (role: recent area contributor; confidence: medium; commits: d957b157e049, 5a5255e6219a; files: src/cron/service/timer-scheduler.ts, src/cron/service/state.ts)

Rank-up moves

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

  • Confirm all required checks, including the currently failed or in-progress exact-head checks, finish green.
  • Make this the sole canonical branch or explicitly consolidate the overlapping draft.

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.

History

Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-05T13:33:01.417Z sha 2e8d88e41d7a7a7a1ff207681bfa23295ed8e1dd :: found issues before merge. :: [P1] Bound scheduled admission before reserving saturated ticks
  • reviewed 2026-08-07T10:48:35.109Z sha 2e8d88e41d7a7a7a1ff207681bfa23295ed8e1dd :: found issues before merge. :: [P1] Bound scheduled admission before reserving saturated ticks
  • reviewed 2026-08-07T10:54:25.111Z sha 2e8d88e41d7a7a7a1ff207681bfa23295ed8e1dd :: needs changes before merge. :: [P1] Bound scheduled admission before reserving saturated ticks
  • reviewed 2026-08-08T20:52:25.593Z sha 2e8d88e41d7a7a7a1ff207681bfa23295ed8e1dd :: found issues before merge. :: [P1] Bound scheduled admission before reserving saturated ticks
  • reviewed 2026-08-09T11:46:02.289Z sha e9153473897059f54a7836ba423264482c4b2964 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-09T12:48:16.894Z sha e9153473897059f54a7836ba423264482c4b2964 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-09T14:46:26.193Z sha e9153473897059f54a7836ba423264482c4b2964 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-10T02:50:40.216Z sha e9153473897059f54a7836ba423264482c4b2964 :: needs maintainer review before merge. :: none

@zyw02 zyw02 closed this Aug 4, 2026
@zyw02
zyw02 force-pushed the auto/issue-119083 branch from 17f05fb to e079919 Compare August 4, 2026 07:59
@zyw02 zyw02 reopened this Aug 4, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. and removed P2 Normal backlog priority with limited blast radius. labels Aug 5, 2026
@zyw02

zyw02 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Issue Hunter real-behavior proof

  • Reviewed head: 2e8d88e41d7a7a7a1ff207681bfa23295ed8e1dd
  • Source diff SHA-256: 06c4bc9b97d5134adebdab58fdd12f0900eec9ab6044fc7c2418e58e04d676ef
  • Proof SHA-256: 46e161db66d32f7970e241c62b82646cffda4c77097a1c7ba22e392707fbc567
  • Risk class: general-bugfix
  • Environment: Isolated sandbox container; no production state, profiles, ports, or credentials. All temporary state, stores, and logs under /workspace/.issue-hunter-proof-runtime. Node.js v24.15.0, tsx v4.23.1, vitest v4.1.10. NODE_ENV=test. Base HEAD: e079919 with staged/unstaged fix changes applied (matching reviewed_head 2e8d88e).
  • Initial state: Cron timer scheduler uses a mutually-exclusive running boolean gate. When a timer tick starts executing and sets running=true, subsequent timer ticks see running=true and bail out after re-arming the recheck timer. This prevents newly-due jobs from being collected while an earlier batch is still executing. The fix replaces this with an activeTimerTicks counter: the scheduler only blocks when running=true AND activeTimerTicks===0 (externally-set running, not from an active tick). Concurrent ticks increment the counter; the finally block decrements it and only clears running when it reaches zero.
  • Operation: Standalone Node.js proof scripts exercising the real cron service (no vitest mocks, no fake timers). Two cron jobs persisted to an isolated store: job A due at T0, job B due at T0+5s. First onTimer() call collects job A (blocks on a real deferred promise). Clock advances so job B becomes due. Second onTimer() call must collect job B while job A is still executing. Deferred promises released, both ticks drained, persisted store verified.
  • Failure injection: Applied git stash to temporarily remove the fix (src/cron/service/state.ts activeTimerTicks field, src/cron/service/timer-scheduler.ts activeTimerTicks logic, src/cron/service.test-harness.ts default). Ran proof-before-fix-defect.ts which confirms: without the fix, the second onTimer() call sees running=true, re-arms the recheck timer, and returns — job B is never collected/started. After 5s timeout, script exits confirming the defect.
  • Observed behavior: WITH FIX: second onTimer() call enters onAdmittedTimer (running=true, activeTimerTicks=1 > 0 → passes gate). Job B is collected, reserved, admitted, and started. peakActiveJobs=2 proves both jobs running concurrently. Both complete with status=ok. State transitions: activeTimerTicks: 0→1→2→1→0, running: false→true→false. Persisted store: both jobs have lastRunStatus=ok, queuedAtMs=undefined, runningAtMs=undefined. All 9 verification checks pass. Vitest: cross-tick-admission tests (2/2 pass); broader cron suite all pass.
  • Final health: After-fix proof: 9/9 checks ✓ (peakActive=2 cross-tick admission, both jobs lastRunStatus=ok, all state markers cleared, running=false, activeTimerTicks=0). Vitest cross-tick-admission: 2/2 pass (direct onTimer test + fake-timer lifecycle test). Broader cron vitest suite: all tests pass (regressions, duplicate-timer prevention, stream validation, timer regressions, ops, store, delivery, etc.).
  • Cleanup: Timers cleared in proof scripts. Temp files under /workspace/.issue-hunter-proof-runtime. No services started. Git stash pop restored fix changes.
  • Redactions: None required. Isolated environment with no real credentials, endpoints, paths, or user data.

Commands and observed output

git rev-parse HEAD (exit 0)

e0799199b30fda0ee7268c8fed7e195cb6f5251b

git diff --cached --stat && git diff --stat -- src/cron/service.test-harness.ts src/cron/service/state.ts src/cron/service/timer-scheduler.ts (exit 0)

Staged: src/cron/service.cross-tick-admission.test.ts | 215 +++. Unstaged: service.test-harness.ts +1, service/state.ts +3, service/timer-scheduler.ts +18/-13.

git stash push -- src/cron/service.cross-tick-admission.test.ts src/cron/service.test-harness.ts src/cron/service/state.ts src/cron/service/timer-scheduler.ts && NODE_ENV=test timeout 10 npx tsx .issue-hunter-proof-runtime/proof-before-fix-defect.ts && git stash pop (exit 0)

BEFORE FIX: TICK-1 started job A (running=true). TICK-2 called onTimer — TIMEOUT after 5s: job B did NOT start. Cross-tick admission FAILS. The mutually-exclusive running gate blocks the second tick. DEFECT CONFIRMED.

NODE_ENV=test npx tsx .issue-hunter-proof-runtime/proof-cross-tick-admission.ts (exit 0)

AFTER FIX: TICK-1 started job A (active=1, peak=1, running=true, activeTimerTicks=1). Clock advanced. TICK-2 collected and started job B while job A still running (active=2, peak=2, activeTimerTicks=2). CROSS-TICK ADMISSION WORKS. Both jobs finished ok. 9/9 checks passed: peakActive=2, both lastRunStatus=ok, queuedAtMs/runningAtMs cleared, running=false, activeTimerTicks=0. OUTCOME: PROVED.

NODE_ENV=test npx vitest run src/cron/service.cross-tick-admission.test.ts --reporter=verbose (exit 0)

Test Files 1 passed (1). Tests 2 passed (2): (1) admits a newly due job on a later timer tick while an earlier batch is still running 415ms, (2) fake-timer lifecycle: admits a newly due job via the timer lifecycle when an earlier batch is still running 26ms.

NODE_ENV=test npx vitest run src/cron/service.scheduler-regressions.test.ts src/cron/service.prevents-duplicate-timers.test.ts src/cron/service.stream-validation.test.ts --reporter=verbose (exit 0)

Test Files 3 passed (3). Tests 18 passed (18): scheduler-regressions (7), prevents-duplicate-timers (4), stream-validation (7).

NODE_ENV=test npx vitest run src/cron/ --reporter=verbose 2>&1 | tail -5 (exit 0)

Full cron test suite: all test files passed, all tests passed. No regressions.

Remaining risks

  • Timer lifecycle (setTimeout → onTimer) tested only via vitest fake-timer path; real 60s MAX_TIMER_DELAY_MS recheck not exercised due to practical delay. The fake-timer test verifies the exact same code path using vi.advanceTimersByTime(MAX_TIMER_DELAY_MS), confirming the actual setTimeout → onTimer pathway works.
  • The fix modifies the cron service state shape (new activeTimerTicks field). Downstream consumers that construct CronServiceState directly (test harnesses, plugin SDK) must include the new field. The test harness fix in service.test-harness.ts addresses the createMockCronStateForJobs helper.

@zyw02

zyw02 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper-recovery-stuck and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper-recovery-stuck labels Aug 5, 2026
@zyw02
zyw02 force-pushed the auto/issue-119083 branch from 2e8d88e to 4d59b0f Compare August 9, 2026 11:21
@zyw02

zyw02 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@zyw02

zyw02 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 9, 2026
@zyw02

zyw02 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head real-behavior proof (final tip e9153473897059f54a7836ba423264482c4b2964)

Answers ClawSweeper Before-merge: final-head isolated scheduler proof for bounded admission.

  • Reviewed head: e9153473897059f54a7836ba423264482c4b2964
  • Proof transcript SHA-256: 5f16913eee1342eb58ab17a48bbc6c77b264d781216837639dc0b780bd4409cb
  • Environment: isolated local runtime under .issue-hunter-proof-runtime; Node.js v24.15.0; tsx; NODE_ENV=test. No production credentials/ports.
  • Method: standalone production onTimer path (not vitest harness). Phases cover cross-tick concurrency, saturation non-reserve, capacity-listener refill, durable cleanup, earliest-due prefix.
  • Result: 7/7 checks PROVED.
Transcript
PROOF tip=e9153473897059f54a7836ba423264482c4b2964
runtime=/root/workspace/issue-hunter/data/manual-119139-fix/.issue-hunter-proof-runtime
storePath=/root/workspace/issue-hunter/data/manual-119139-fix/.issue-hunter-proof-runtime/jobs.json
PHASE1 cross-tick free capacity
job-start id=proof-a active=1 peak=1
job-start id=proof-b active=2 peak=2
CHECK PASS: cross-tick concurrent admission peakActive=2
CHECK PASS: cross-tick durable cleanup
PHASE2 saturation non-reserve + listener refill
sat-job-start id=sat-a active=1 peak=1
sat-job-start id=sat-b active=2 peak=2
CHECK PASS: saturation leaves due work unreserved
sat-job-start id=sat-c active=2 peak=2
capacity-wake delayMs=10.7
CHECK PASS: listener-driven refill after capacity release
CHECK PASS: post-saturation durable cleanup
PHASE3 earliest-due prefix admission
earliest-start id=proof-early
CHECK PASS: earliest-due preferred when only a free-slot prefix exists
earliest-start id=proof-late
CHECK PASS: earliest-due phase cleanup
OUTCOME: PROVED (7/7 checks)
- cross-tick concurrent admission peakActive=2
- cross-tick durable cleanup
- saturation leaves due work unreserved
- listener-driven refill after capacity release
- post-saturation durable cleanup
- earliest-due preferred when only a free-slot prefix exists
- earliest-due phase cleanup

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 9, 2026
@zyw02
zyw02 marked this pull request as ready for review August 10, 2026 02:22
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

zyw02 added 3 commits August 10, 2026 10:48
Acquire only immediately available cron slots before reserving due jobs,
leave saturated rows eligible, and wake once on capacity release so
watchdog rechecks cannot pile Gateway roots or unbounded waiters.
Under the bounded cross-tick admission model, sort runnable jobs by due
time before taking a free-slot prefix, and skip watchdog ticks that cannot
admit work once a capacity listener is already armed.
Main moved createDeferred out of service-regression-fixtures; keep the
cross-tick admission tests compiling against current helpers.
@zyw02
zyw02 force-pushed the auto/issue-119083 branch from e915347 to 0574d28 Compare August 10, 2026 02:52
@zyw02

zyw02 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@zyw02

zyw02 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing this PR as superseded by the newer bounded-admission implementation in #119195.

Both PRs target the same cross-tick cron admission issue and overlap across the same seven scheduler files. #119139 is now stale/conflicting against current main; the bounded-admission/capacity-listener approach from #119195 is the better starting point for a current-main port.

The scheduler fix should not be landed from either stale head unchanged; preserve #119139's earliest-due/no-op-tick ideas if they are still needed when the canonical current-main implementation is prepared.

@zyw02 zyw02 closed this Aug 15, 2026
@clawsweeper

clawsweeper Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix: [Feature]: Continuously admit newly due cron jobs while earlier timer-batch jobs are still running This is item 2/3 in the current shard. Shard 51/89.

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.

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

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

[Feature]: Continuously admit newly due cron jobs while earlier timer-batch jobs are still running

1 participant