Skip to content

serve: an opt-in checkpoint where a request continues the live session after a long reply (STRATA_LIVE_CKPT_MIN) - #1537

Closed
zsariboga wants to merge 1 commit into
Niko1221:mainfrom
zsariboga:pr-live-ckpt
Closed

zsariboga wants to merge 1 commit into
Niko1221:mainfrom
zsariboga:pr-live-ckpt

Conversation

@zsariboga

@zsariboga zsariboga commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Rebased on main (477ac13c) and now opt-in, after @qiuzan2001's review. Thank you, the point was right: with a default of 1024 the checkpoint fired on most agent turns after a long reply. Each one is a synchronous checkpoint_save that takes one of the --prompt-cache slots, so it could push an older checkpoint out.

What it changes

  • STRATA_LIVE_CKPT_MIN=N turns it on. Unset or 0 is off, and the path is then byte-identical to main.
  • When on, a request that continues the live session saves a checkpoint where it starts. A wrap-up continuation, a forced call's opening and a reasoning-close retry are such requests. The checkpoint is saved only when the newest checkpoint below is at least N tokens back.
  • A later prompt that leaves the session right there resumes from that checkpoint instead of reading the whole reply again. A wrap-up the client's history does not carry, or a call the client renders differently, leaves the session at that point.
  • It is one ordinary checkpoint through checkpoint_at(). It is skipped for ckpt=0, STRATA_CKPT_REREAD, an incoming parked conversation and a slot source. The engine log says checkpoint at the live end: N tokens.
  • docs/DETAILS.md: one entry next to --prompt-cache-spread.

Measured (the previous version, 0.1.40.3)

Setup: RTX 5070 Ti Laptop 12 GB, Core Ultra 7 255HX, 64 GB DDR5-5600, Windows 11, Swift 1.5 IQ3_XXS.

  • A tool turn after a budget wrap-up: reused 362 / 364 before, 969 / 971 after; read 1379-3635 before, 583 / 1770 after.
  • In four opencode tasks with 1024, four live-end checkpoints were saved, 3134-4801 tokens past the one below. A 4096-token budget wrap-up then read ~1 token again instead of 4795.

How it was checked

  • Built on this branch for CUDA (sm_120, MSVC + CUDA 13).
  • Not built for HIP or SYCL: I have neither toolchain. The change is host code in src/program/generate.cpp, inside the CUDA/HIP serve loop.
  • Not re-measured end to end on this rebase. Our fork runs the same code with STRATA_LIVE_CKPT_MIN=1024 on 0.1.44.

@qiuzan2001

Copy link
Copy Markdown

As written the new checkpoint runs by default: STRATA_LIVE_CKPT_MIN defaults to 1024 (src/program/generate.cpp around 9179, "default 1024; 0 = off"), and the condition fires on any request that continues the live session with req_ckpt set, no incoming restore and no slot source, whenever the newest checkpoint below is 1K+ tokens back, i.e. most agent turns after a long reply, not only thinking-budget continuations. Each one is a synchronous checkpoint_save that takes one of the --prompt-cache slots (6 by default), so it can push out an older checkpoint. AGENTS.md asks for new behaviour to be opt-in; defaulting to 0, with your measurements as the case for turning it on, plus the added ms per turn, would match.

…n after a long reply (STRATA_LIVE_CKPT_MIN)

A request that continues the live session after a long stretch it generated (a thinking budget's wrap-up continuation, a forced call's opening) first keeps a checkpoint where it starts, so a later prompt that leaves the session right there resumes from it instead of reading the whole reply again. Off by default: each one is a synchronous checkpoint save that takes a --prompt-cache slot. STRATA_LIVE_CKPT_MIN=N turns it on when the newest checkpoint below is at least N tokens back (1024 is the value used with opencode on a 12 GB laptop).
@zsariboga zsariboga changed the title serve: keep a checkpoint where a request continues the live session after a long reply serve: an opt-in checkpoint where a request continues the live session after a long reply (STRATA_LIVE_CKPT_MIN) Oct 17, 2026
@zsariboga

Copy link
Copy Markdown
Contributor Author

@qiuzan2001 thanks, you were right. STRATA_LIVE_CKPT_MIN is now opt-in (unset or 0 = off, the path byte-identical to main), rebased on main (477ac13) and built for CUDA sm_120; a docs entry sits next to --prompt-cache-spread. Not built for HIP or SYCL (no toolchain here).

@Niko1221

Copy link
Copy Markdown
Owner

Thanks for the pull request.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to review properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Rebase on main if it no longer applies, and re-run your checks on 0.2.0-beta.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the pull request template: the problem and result, and the validation (what you ran, on which revision, what you saw).
  4. Comment /reopen. A check runs and either reopens the pull request or lists what is still missing.

The rules are in CONTRIBUTING.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants