Skip to content

fix: at macOS memory warning, start jobs while memory fits - #23

Merged
SpoBo merged 1 commit into
masterfrom
vincent/taskguard-issue-22
Oct 12, 2026
Merged

SpoBo merged 1 commit into
masterfrom
vincent/taskguard-issue-22

Conversation

@SpoBo

@SpoBo SpoBo commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Closes #22.

Problem

macOS keeps its memory warning level for a long time, also with half of memory free. A running dev stack held it there, and taskguard started nothing new at warning. The browser proof that needed the stack waited behind it: 25 minutes for one proof, an hour of retries for another.

Change

At warning (macOS only), a job starts when:

  • memory fits without any leeway (no noise_mem, no outside_admit, also when only long-lived jobs run), and
  • no running first run still grows.

A job with a history has its whole need booked from its first second, so the next job may start at once. A first run books a guess, so new jobs wait until it has shown what it takes (the existing settling rule, at most two minutes).

Critical still stops every new job. warn_admit = false keeps the old rule. Linux has no warning level and keeps its PSI rule.

Evidence

  • Unit test at_warning_jobs_start_while_memory_fits_and_no_first_run_grows.
  • Simulator (src/sim.rs), with the warning level held from 40% memory: the old rule never finished 4 of 6 scenarios. The new rule finished them in the same time and with the same peak memory as with no warning at all.
  • Local history (17 days): pressure was the main blocker for 16.2 job-hours of waiting. In the last 24 h, warning was on 10.5% of the time, at a median of 75% memory used.

Mixed versions

No change to queue::Entry, machine::MachineSample, the database, or job keys. warn_admit is a new setting; older versions ignore it with a warning and keep stopping at warning. Blocker::Pressure gains optional output fields only.

🤖 Generated with Claude Code

macOS keeps its memory warning level for a long time, also with half of
memory free. A running dev stack held it there, and the browser proof
that needed the stack waited behind it for up to an hour.

At warning, a job now starts when memory fits without any leeway, and
no first run still grows. A job with a history has its whole need booked
from its first second, so the next job may start at once. A first run
books a guess, so new jobs wait until it has shown what it takes (the
settling rule, at most two minutes). Critical still stops every new
job. `warn_admit = false` keeps the old rule. Linux has no warning
level and keeps its PSI rule.

No queue entry, machine file or database change.

Closes #22

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@SpoBo
SpoBo merged commit 2b41de8 into master Oct 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A job's own running stack at memory level warn blocks its dependent proof job

1 participant