Repository navigation
fix(learn): a failed or one-off peak no longer pins the memory need - #28
Merged
Merged
Conversation
A run that failed never raises the memory need above the runs that passed, with any number of runs and also when it is no ratio outlier. When every recent run failed, the need is the second-highest failed peak, at least new_job_mem and at most the highest. A failed memory-starved run adds the 25% boost only when its peak stayed within that 25% of its need. outlier_ratio defaults to 1.5, so a 1.9x one-off is held back too. taskguard outliers, doctor --explain and the job's end line show the failed runs whose peak is ignored. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Roderik saw a task that once took ~17 GB keep reserving that much on every later run. Vincent's DB shows the causes:
root:tsc_-p_tsconfig.jsonprd14394-gatenew_job_mem)host/dapi:…tsc…declarations.jsontsc-queue:packages_dapi_server(2 GB / 25 GB, 5/5)What changed (
src/db.rsDb::learned)failed_need: the second-highest failed peak, at leastnew_job_mem, at most the highest.BOOST_FAILED_MAX(1.25) of its need. That means within what the boost would have given. OOM-killed at its need still boosts. A run that went 48x past its need and crashed does not.outlier_ratiodefaults to 1.5 (was 2). This holds back a one-off 1.9x peak.taskguard outliers: one more vitest one-off, the dapi failed run, andweb/dapp:bun_check(2 of 10 runs at ~3 GB vs 1.5 GB; it now reserves 2.3 GB).Learned.failedlists the failed runs whose peak is at leastoutlier_minabove the need. Smaller ones are noise, and listing them flooded the output.taskguard outliersshows them asignored: the run failed (exit N).doctor --explainshows afailed:line.Example, on a copy of the real DB:
Mixed versions: no change to the schema, queue entries or keys.
Learngets a new in-memory field,new_job_mem_kb.Trade-off to know
The rule "failed never counts above passed" can under-reserve a job that only reaches its full size when it fails. The real DB has examples:
e2e/agentic:bun_src/pr.ts: passes at 3.0 GB, failed 3 times at 4.1–4.4 GB. It now reserves 3.0 GB, before 4.4 GB.new_job_mem) on their next run.The README "Limits" section says this. A follow-up could let repeated failed peaks count by
outlier_weights, the same way repeated outliers do.Other paths that can pin a high need (not changed here)
steady_mem_kbis the plain max of the last 10 steady peaks. It has no outlier or failed-run handling, so one steady spike holds for 10 runs. Vincent'sdev-env:stackis 4.7–9.0 GB, with no one-off right now. See also A dev stack is admitted while the proof job that needs it cannot be, so the stack idles holding 7+ GB #27.Db::estimatetakes the max peak per similar key over 30 days and includes failed runs. One failed 14.5 GBtscrun can push the 90th percentile for newtsckeys.tsc/tsgojob with no runs of its own usestsc-queue:<legacy key>, for example 25 GB forpackages_dapi_server. This lasts only until its own first run. The new failed-run rule applies there too.--min-mem/ configmin_mem:prd14394-gatestarted with a need of 16 GB, more than it learned, so a floor is set somewhere. Roderik should check his DALP config and wrappers for amin_mem.taskguard outliersandtaskguard doctor --explain "CMD"on the new build show which of these applies to him.Tests
TDD in
src/db.rs, with the real numbers:a_failed_run_never_raises_the_need_above_the_runs_that_passed(root:tsc and dapi)when_every_run_failed_one_high_peak_alone_does_not_set_the_need(prd14394-gate)a_failed_run_starved_at_its_need_still_raises_ita_one_off_peak_under_twice_the_usual_is_held_backa_job_with_two_sizes_reserves_the_big_onecargo test: 167 + 28 pass.cargo clippy --all-targetsandcargo fmtare clean. Not released.🤖 Generated with Claude Code