Conversation cache: parking an idle --batch slot no longer drops the main session's copy with the shared-prefix checkpoint (#4420)
A batch slot's chain holds one checkpoint (the one its admission copied in). park_slot() went through park_source(), whose drop_superseded() (#342) removes a parked entry when the outgoing chain holds that entry's deepest checkpoint; the main session's copy of the same conversation qualifies, and the root checkpoint at the end of an agent's system prompt went with it. The next overlapping request then read the whole 5 K-token prefix again (323 ms in 0.2.6, 4130 ms in 0.2.7). ConversationCache::supersedes_richer() says when the park would drop an entry that has a checkpoint the slot's chain lacks; park_slot() then leaves the slot unparked (it is overwritten, as in 0.2.6) and says so. A slot with no such parked copy is parked as before. The predicate and its test come from the report (shenmintao, #4420).
This commit is contained in:
1 parent
ea73eab442
commit
c7a0cef13a
3 files changed
+59
No files matched your search
@@ -12609,6 +12609,13 @@ int main(int argc, char** argv) {
|
||||
const bool in_main = live_ok && cvec_cached == sl.cvec && prefix_of(live) &&
|
||||
imgs_below(live_imgs, (int64_t) sl.ids.size()).empty();
|
||||
if (in_main || conversations.holds(sl.ids, {}, sl.cvec)) return;
|
||||
if (conversations.supersedes_richer(sl.ids, {}, sl.checks, sl.cvec)) {
|
||||
// its park would drop (as superseded) the main session's copy of this conversation, and with it the checkpoints the slot
|
||||
// does not hold - an agent's system-prompt root that the next requests borrow (#4420, as 0.2.6 did: the slot is overwritten)
|
||||
std::fprintf(stderr, "strata serve: conversation cache: slot %d not parked before its overwrite (a parked copy of its "
|
||||
"conversation holds checkpoints the slot does not; it stays)\n", b);
|
||||
return;
|
||||
}
|
||||
if (use_mtp && !batch_mtp) { // no draft K/V of its own: an image without it would not restore beside the drafter
|
||||
std::fprintf(stderr, "strata serve: conversation cache: slot %d not parked before its overwrite (its %zu tokens "
|
||||
"have no per-slot draft K/V without --batch-mtp)\n", b, sl.ids.size());
|
||||
|
||||
Reference in new issue
Block a user