Repository navigation
fix(learning): keep one outlier and agent sessions from distorting estimates - #83
Merged
Merged
Conversation
…timates A workload borrowing from its group got the largest peak any member ever measured, times 1.5, so one runaway run set the estimate for the whole group. A borrowed estimate now keeps the workload's own peaks in full, counts every other workload once and sets aside the highest tenth of those. Groups with fewer than ten other workloads are unchanged. The exact variant also hashed values agents set for themselves, such as messaging sockets, tokens, process ids and thread ids, so the same command from another session was a new variant with no history. The CLAUDE_, CODEX_ and T3CODE_ namespaces are now incidental environment. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Marc Went <marc@went.io>
…timate Review of the estimate change found that XPC_SERVICE_NAME carries per-launch process ids, so every app relaunch still reset exact variants. The macOS launch values join the incidental environment. The caption under the group estimate and the grouping notes said the figure was the complete envelope, which is no longer true for groups of ten or more. The test now pins nine, ten, eleven and twenty other workloads. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Marc Went <marc@went.io>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Marc Went <marc@went.io>
govulncheck reports GO-2026-6859 in net/http of Go 1.26.10. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Marc Went <marc@went.io>
Rows evicted from learning_retained were folded into a machine-wide floor that raised every estimate on the machine and could only rise. They are now deleted, so a forgotten workload starts again like one never seen. Floors already stored are still read. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Marc Went <marc@went.io>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Marc Went <marc@went.io>
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.
Summary
Three defects made learned estimates far too high and kept exact history from accumulating.
A borrowed estimate was the largest peak any workload in the group ever measured, times 1.5. One runaway run set the estimate for the whole group:
The exact variant hashed values that agents set per session, so the same command from another session was a new variant with no history:
variant = digest(family, command, definition files, environment, toolchain) environment excludes PWD, TMPDIR, TERM, SSH_AUTH_SOCK, AGENT_HEAVY_*, PUEUE_*, ... + CLAUDECODE, AI_AGENT, CLAUDE_*, CODEX_*, T3CODE_* + XPC_SERVICE_NAME, XPC_FLAGS, __CFBundleIdentifier, __CF_USER_TEXT_ENCODINGHistory that fell out of the outer retention bound became a machine-wide floor under every estimate, and it could only rise:
The group estimate in the learning view now describes a workload new to the group, and its caption says so. Group membership, schemas and the prediction contract are unchanged, and no stored row is rewritten.
go.modmoves to Go 1.26.11, because the vulnerability scan fails on GO-2026-6859 innet/httpof 1.26.10. Details, findings left alone and next steps:docs/handoffs/learning-estimates.md.Evidence
Replayed in time order on a private copy of real history (4,065 runs, 3,190 workload families, 25 days, one 16 GiB machine); each estimate used earlier runs only.
Variants: 3,635 of 3,800 had exactly one run, and 83% of reruns of the same command landed on a new variant. Four per-session agent values each had five distinct values across six job payloads from five sessions.
TestProfileSimilarityUnusualSiblingDoesNotSetALargeGroupsEstimatefails on the old rule: nine ordinary 2 GiB workloads plus one 60 GiB runaway give a fresh workload a 90 GiB estimate.After: it passes with 3 GiB, and covers nine, ten, eleven and twenty other workloads, CPU trimmed on its own, a workload keeping its own peak, and batched and independent reads agreeing.
After:
TestWorkloadIdentityIgnoresAgentInvocationMetadatagets one variant, andGOMAXPROCSstill changes it.After:
TestProfileOuterRetentionForgetsTheOldestHistorygets the 1 GiB, 2-core cold floors and an emptyfloorstable.TestProfileCollectionMatchesIndependentHistoryReadspins that a floor already stored still applies until a reset.govulncheckas CI runs it: 1 vulnerability on Go 1.26.10.After: none on 1.26.11.
scripts/lint.sh, runtime partitionscore-1andcore-2with race detection, andscripts/test-native.shpassed. Other partitions, web and installer checks are left to hosted CI.Merge Danger
Door: two-way
Reverting restores the old estimates. No stored data is rewritten. One part does not come back: history deleted past the retention bound while this runs is gone, where the old code would have kept its peak as a floor. A job submitted from an agent session gets a new variant once, in either direction.
Blast Radius: admission
Borrowed estimates in groups of ten or more other workloads drop, so Adaptive mode admits jobs it used to hold or refuse. Under-predictions rise from 2.9% to 4.3% of runs; live sampling, the pressure gates, the three-success overlap guard, operator minimums and machine floors are unchanged. A heavy workload that returns after its history was forgotten starts from its group or the 1 GiB prior once. Operator-shared groups are trimmed like automatic ones; a minimum reservation holds every member above a figure.
🤖 Generated with Claude Code