Repository navigation
Conversation
…lete The pre-flight memory check logged "proceeding without check" whenever the model size could not be determined and started the process anyway. On a fresh host (model store empty, Model status.size still "0") every service bypassed the budget this way; concurrent unsized llama-server loads wired 123 GB of a 128 GB host into unevictable memory and the machine died with a watchdog-timeout kernel panic. Three changes: - estimateModelMemory gains fallbacks: a status.size of "0" is treated as not-yet-populated instead of a hard parse error, and when neither the disk nor the status carries a size, an http(s) source is probed with a HEAD request and sized from Content-Length. - The admission block is extracted into checkMemoryAdmission, and an estimation/budget failure now refuses to start the process, records SchedulingStatus=MemoryCheckFailed on the InferenceService, and emits a MemoryCheckFailed warning event. - A new --memory-check-mode flag (enforce|warn, default enforce) keeps the old log-and-proceed behavior available as an operational escape hatch; unknown values resolve to enforce. Signed-off-by: Christopher Maher <chris@mahercode.io>
…-mode Signed-off-by: Christopher Maher <chris@mahercode.io>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The watcher retries a refused InferenceService every poll interval and zap attaches stacktraces at error level, flooding the agent log. The condition is already surfaced via SchedulingStatus and a Kubernetes warning event; warn matches the existing over-budget rejection path. Signed-off-by: Christopher Maher <chris@mahercode.io>
This was referenced Jun 10, 2026
Merged
5 of 6 tasks
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.
What
The metal-agent's pre-flight memory check now fails closed: when the check cannot be completed (unknown model size, budget resolution error, memory query failure), the agent refuses to start the inference process, records
SchedulingStatus: MemoryCheckFailedon the InferenceService, and emits aMemoryCheckFailedwarning event. A new--memory-check-modeflag (enforce|warn, defaultenforce) keeps the old log-and-proceed behavior available as an operational escape hatch.To keep the stricter check from rejecting legitimate not-yet-downloaded models,
estimateModelMemorygains two fallbacks:status.sizeof"0"is treated as "not measured yet" instead of a hard parse error.Content-Length, so admission is decided before the download starts.Why
The previous behavior logged
proceeding without checkand started the process anyway. On a fresh host (empty model store,status.sizestill"0"), every InferenceService bypassed the memory budget this way. On 2026-06-09 concurrent unsized llama-server loads wired 123.4 GB of a 128 GB Apple Silicon host into unevictable memory (--mlockweights + Metal KV buffers); the machine stalled and died with a watchdog-timeout kernel panic. Admitting a model blind is strictly worse than refusing it: wired memory cannot be paged or jetsam-killed, so the failure mode is a host panic rather than a failed pod.Fixes #640
How
ensureProcessintocheckMemoryAdmission; all three previously fail-open paths route throughfailMemoryCheck, which enforces or warns based on the resolved mode.remoteModelSize(HEAD probe) inpkg/agent/memory.goand restructuredestimateModelMemoryinto an explicit fallback chain (local source path → model store stat → status size → remote HEAD) that accumulates the reasons each source was unusable into the final error.--memory-check-modevalues resolve toenforceso a typo cannot select the dangerous direction; the resolved mode is logged in the startupmemory budgetline.TestEnsureProcess_InFlightGuardnow writes a real stub model file: its unsized model is correctly rejected by admission before reaching theStartProcessrace it exercises.Checklist
make testpasses locallymake lintpasses locally (plusGOOS=linux golangci-lint run ./...for the cross-arch files)git commit -s) per DCO