mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2082] [CLOSED] fix: make conversation parking admission fail safely #3850
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3850
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2082
Author: @ivanov84
Created: 10/12/2026
Status: ❌ Closed
Base:
main← Head:pr/parking-admission-fail-safe📝 Commits (10+)
ae3e21cpark: bound eviction by what is freeable, keep the K/V a refusal did not use, name the failure76d9a10park: act on review - drop put_reuse's dead guard, free the probe's reservation on failure, strip the BOM4addb40docs: record the measured e2e blocker (server on 8080, 0.1.40 engine, GPUs full)ce4d820docs: the header fixes do reach the SYCL build (shared include path, strata_resolve fallback)ac96332docs: record the reviewer's confirmed points and stated uncertainties, and show the new tests do not build without the patch08f2115AGENTS.md: drop the BOM and two mojibake em-dashes, and space the new heading before it7c500a8parking: move the eviction round into evict_for_admission() so the loop can be tested1805bcepark: act on the second review of the eviction-round move - the reviewer found no behaviour change and five wording/test defects; each was checked against the code first. - doc: the 'hopeless' bullet claimed an immediate refusal; the helper samples first (conversation_memory.hpp:117-122), so it only decides what a refusal says. The claim that a refusal can print a shortfall measured before an eviction is refuted and removed: the helper re-samples after every eviction (:131) and refreshes short_by (:136); what is true is that freeable is a snapshot of the round that decided it could not win, and that arm evicts nothing. 'Measured output of the test' -> what the checks assert. 'both park copies share the named-cause failure lines' -> the four causes and ram_note() are CUDA-only; SYCL still prints its two generic lines (sycl/src/program/generate.cpp:7502, 7525). - test: the old-loop copy dropped its retained-K/V state (that loop reads neither evictable_bytes() nor reuse_, and evict_oldest() never touches it); the equivalence table now compares short_by and freeable as well, and is equal on all twelve cases that entered the loop; added a round against one unpinned plus one pinned entry. - header: the dead-for-ConversationCache !evict_oldest() bound is marked as the template's bound; dropped top-level const on the parameters. conversation_cache_test 4281 checks, memory test 32, ctest 43/43 (2 skipped, CPU-only), fresh build_tests_clean [131/131] with 0 errors, cl /Zs CL_EXIT=0, CUDA engine rebuilt and reports strata 0.1.42 with the same string table. Co-authored-by: openhands openhands@all-hands.devbf73014build notes + pinned blob references - AGENTS.md: a bare cl/cmake --build without vcvars64 reports C1083 'cannot open include file: algorithm', which is a missing toolchain env, not a code error - the test and the doc now cite git show 3ae6a9ec:src/program/generate.cpp for the loop the equivalence table retypes; HEAD~1 stops naming the right blob as soon as this branch moves conversation_cache_test 4281 checks after the edit. Co-authored-by: openhands openhands@all-hands.deva7c28d6park: record the end-to-end run the user made on this tree📊 Changes
9 files changed (+1174 additions, -35 deletions)
View changed files
📝
AGENTS.md(+40 -0)➕
LOCAL-PARKING-PATCH-0.1.43.md(+605 -0)📝
include/strata/core/conversation_cache.hpp(+17 -0)📝
include/strata/core/conversation_memory.hpp(+67 -0)📝
src/core/conversation_cache_test.cpp(+277 -0)📝
src/core/conversation_memory.cpp(+35 -0)📝
src/core/conversation_memory_test.cpp(+32 -0)📝
src/program/generate.cpp(+75 -28)📝
sycl/src/program/generate.cpp(+26 -7)📄 Description
Summary
This hardens conversation-cache admission and retained K/V reuse under memory pressure. On Windows the engine
runs out of the system commit limit rather than physical RAM, and the park path had no way to tell that it had
already given up, no way to see why an allocation failed, and it silently dropped the retained K/V whenever
admission said no.
The eviction round now lives in
ConversationCache::evict_for_admission(), which makes the loop's decisionstestable for the first time; the tests assert the old and new loops against one cache state.
Changes
slots()and calledevict_oldest()unconditionally, so a request larger than the total freeable capacity evicted every parkedconversation and still refused.
evict_for_admission()checks the request againstevictable_bytes()firstand stops at the first round that stops making progress, reporting why (
stalled,hopeless,freeable).is subtracted before the admission need is computed; a park that needs no new capacity evicts nothing.
take_reuse()used to leave the buffers withthe caller, so a declined park lost them and the next turn rebuilt them. They go back through
put_reuse()onevery early-return path.
at the capture,after the checkpoint split,after the full-model load) and the probe reports whether the machine is out of commit orout of address space. Refusal lines print both resources and the process' own commit rather than one number.
and new loops agree everywhere they should and differ only in the hopeless case.
Validation
Built and run on Windows, MSVC + CUDA 12.8, sm_120:
String audit of the built engine: the textless
allocation failed; skip parkingis gone, and the named-cause andadmission lines are present.
End-to-end, against a real model on this machine — the user's production server running a build of this tree,
2026-10-11 23:42 to 2026-10-12 02:46, two RTX 5060 Ti with
--layer-split auto,--max-context 262144,--conversation-cache-mib 16384 --conversation-cache-slots 4 --conversation-cache-min-free-mib 4096. Countedover that session's log:
The single refusal is the
hopelessarm: the request was 3966 MiB against 2152 MiB freeable in total, and itnames both numbers instead of evicting a conversation that could not have paid for it. Parking continued normally
afterwards. The same workload on the unpatched 0.1.40.1 engine logged 293
skip parkinglines — 203 of them thebare textless
allocation failed; skip parkingand 90 the budget refusal ending in a staticor telemetry unavailable— out of 2772 attempts (291 refused, 10.5%). That build never ran an evict-to-admitround at all: the loop that would have run does not exist in 0.1.40.
That run was built from the 0.1.42 base of this series; the rebase onto 0.1.43 changed no source of the patch, so
the runtime evidence is the same code. The binary was string-audited first: the textless failure line absent, the
named-cause and admission lines present.
Limitations
evict_for_admission(), thebad_allocprobe, and the budget-refusal K/V hand-back areasserted only by the native tests. The run above produced no stalled round (evicting did return memory on this
machine), no failed allocation, and no budget refusal, so those three paths are runtime-untested.
is installed here, so it is not compiled. The header changes do reach the SYCL build through the shared include
path.
on this machine; it makes admission stop early, keep what it already holds, and say why it declined.
now explain themselves.
Review focus
take_reuse()and must be handed back withput_reuse()on all of them.evictable_bytes()deliberately excludes the retained K/V and pinnedentries, because
evict_oldest()cannot free either.bytes()still charges both, which is correct for thecache budget and wrong for "what can I free right now".
every path, including failure.
ConversationCache::clear()from #879 is upstream's, and it is consistent with this: it zeroesreuse_, andevictable_bytes()never counted it.This PR was prepared by an AI agent (OpenHands) on behalf of the author. The agent's work was reviewed by two
independent review passes before the branch was pushed; the review notes and the answers to them are recorded in
LOCAL-PARKING-PATCH-0.1.43.md, which is included in the branch along with the repo-localAGENTS.mdnotes.Happy to drop either file from the change if you would rather keep them out of the repository.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.