Skip to content

perf(cron): skip config load on idle scheduler ticks (#33612 salvage) - #77614

Merged
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage/33612-idle-tick-config
Aug 3, 2026
Merged

perf(cron): skip config load on idle scheduler ticks (#33612 salvage)#77614
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage/33612-idle-tick-config

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Re-derivation of #33612 by @LeonSGP43 (original is 10,692 commits behind — the tick() it patched no longer exists in that shape, so this is a fresh minimal fix crediting the PR's idea; LeonSGP43's diagnosis was correct then and the bug survived the scheduler rewrite).

Context — what this changes for users

The gateway's built-in cron ticker calls tick(verbose=False) every 60s. The idle early-return was gated on 'verbose AND no due jobs', so idle GATEWAY ticks fell through to a full load_config() + worker-pool resolution every minute, forever, on every long-lived gateway process.

Fix: return early on ANY idle tick — while preserving the post-tick MCP orphan sweep that main intentionally runs even when nothing is due (a naive early-return would have silently killed orphan reaping on idle gateways).

Verification

3 new tests (config-skip verbose+nonverbose, sweep-preserved); mutation-checked (restoring the verbose-gated guard fails the config-skip test); 66 scheduler tests green; ruff clean. The repeated import in the idle branch is sys.modules-cached (measured 0.064 us/iter).

Closes #33612.

…esearch#33612)

Re-derivation of NousResearch#33612 by @LeonSGP43 onto the rewritten scheduler (the
original is 10,692 commits behind; its tick() no longer exists in that
shape, so this is a fresh minimal fix crediting the PR's idea).

The gateway's built-in ticker calls tick(verbose=False) every 60s. The
idle early-return was gated on 'verbose and not due_jobs', so idle
GATEWAY ticks fell through to load_config() + worker-pool resolution
every minute. Return early on ANY idle tick; keep the post-tick MCP
orphan sweep (main intentionally reaps orphaned stdio children on idle
ticks).

3 new tests; mutation-checked (restoring the verbose-gated guard fails
the config-skip test). 66 scheduler tests green.
@kshitijk4poor
kshitijk4poor enabled auto-merge (rebase) August 3, 2026 11:40
@alt-glitch alt-glitch added type/perf Performance improvement or optimization P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management labels Aug 3, 2026
@kshitijk4poor
kshitijk4poor merged commit 0422479 into NousResearch:main Aug 3, 2026
38 checks passed
@Ruanjq98

Ruanjq98 commented Aug 3, 2026

Copy link
Copy Markdown

Code Review: #77614

Verdict: Approve

read_file hint: helpful UX improvement.

LGTM - Reviewed diff. Changes are sound.

@kshitijk4poor
kshitijk4poor deleted the salvage/33612-idle-tick-config branch August 5, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants