Repository navigation
feat(provider): opt-in turn continuation prefills the next turn while the Mac is idle (off by default, stacked on #1954) - #1959
Draft
jonathan308 wants to merge 6 commits into
Conversation
… the Mac is idle With the prefill grid on, DARKBLOOM_CBV2_TURN_CONTINUATION=1 lets a slot prefill the tokens every next turn of a conversation starts with, after a text reply ends and only while the Mac is idle. Off by default. - The stream forwarder rebuilds the reply a client keeps, renders the conversation twice with that reply and two different user messages, and keeps the tokens both renders share. - The bridge cuts that prefix at the last position the slot's prefix tiers keep and submits a hidden one-token request through the idle-calibration coordinator. It is skipped, never queued; any arrival cancels it; it stops after 60 seconds. - The hidden request uses the cache scope of the request it follows. It has no seed, logs counts and a duration only, and is left out of the prefix-cache savings counter, reuse telemetry and calibration. - No continuation after a tool call, a token-limit cut, a matched stop sequence, a cancelled request, a response format, media, or on a slot without a grid and a resident bank or complete-checkpoint store. Tests: 37 new unit tests, including a bridge-level test on a real engine with a toy model. No run on a real model, a GPU or over HTTP yet. Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
17 of 18 tasks
… prefix-store transfer Measured over HTTP on Qwen3.5-9B at 594a944: on a slot whose prefix tier is the encrypted complete-checkpoint store, 26 of 26 continuations ended within 1 ms and prefilled nothing. Cause: the continuation runs as the idle session of IdleCalibrationCoordinator. Its hidden request restores from the store, the store begins a WholeMacUnboundedActivity for that transfer, and beginning one cancelled the idle session, which was the continuation. - IdleCalibrationCoordinator.startIfIdle takes toleratesPrefixStoreTransfers, and cancel(prefixStoreTransfer:) leaves such a session running. The default is unchanged: a calibration session still ends on a store transfer. - WholeMacServiceBudget.beginUnboundedActivity(prefixStoreTransfer:) passes the mark on. The activity still counts against the idle gate and still invalidates calibration evidence. - The checkpoint store's restore staging and checkpoint write, and the SSD prefix cache's donate and stage, begin their activity as store transfers. Every other caller is unchanged. - The continuation's log line names what cancelled an ended session. Tests: one coordinator test, and a bridge test on a real engine with a toy model, a paged backend and the encrypted store on the bridge's budget. The continuation restores 512 tokens, prefills to 768, writes that checkpoint and completes; the follow-up restores 768. Without the call-site argument the same test fails: the continuation ends in 0 ms, cancelled by device work. The fixed caller has not been run over HTTP on a real model yet. Docs: inference.md, hardware-support.md and prefix-cache.md state the rule. Co-Authored-By: Claude <noreply@anthropic.com>
…old less than its turn left Measured over HTTP on Qwen3.5-9B at 7b58ec2: where the turn's own request wrote no checkpoint (requests that did not send presence_penalty), the hidden request prefilled the whole prompt from token 0 (10,753 and 11,777 tokens, about 12 s of GPU) and wrote 585 and 627 MB. A request that arrived during the write waited for it; one reached its first token 4.75 s later than with the caller off (13.469 s against 8.721 s). - TurnContinuationCells.plan replaces continuationTokens and returns a TurnContinuationPlan: the tokens, and restoreFloor, the last grid multiple the turn's own request should have left on the complete-checkpoint store. The floor is 0 on a slot with the resident bank. - The hidden request's calibration cell carries the floor. Before submission, EngineV2Bridge.submitTokenized compares it with what the prefix tiers restore for the request (the longer of the store's staged checkpoint and the resident tier's match). When they restore less, the request is refused before any memory reservation or prefill, a staged checkpoint is given back unconsumed, and the log line says "skipped" with the two counts. Limits: where a model's default request writes no checkpoint, no continuation starts. A turn whose last grid multiple is below the store's minimum checkpoint (1,024 tokens by default) starts none. A turn shorter than one grid cell has floor 0 and may still prefill from token 0, less than one cell. A refused continuation that found an older, shorter checkpoint has read it once. The wait behind a warm continuation's one checkpoint write, and the hidden request's bypass of the novel-write gate, are unchanged. Tests: two cell tests for the floor and two bridge tests on a real engine with a toy model, a paged backend and the encrypted store: a continuation on an empty store is refused and writes nothing, then runs once its turn has left a checkpoint; a continuation whose turn should have left 768 is refused when the store holds only 512, and the next request still restores 512. Focused suites: 55 tests in 10 suites pass. Related suites: 235 tests in 20 suites pass. With the comparison replaced by "restored < 0" the two bridge tests fail with 7 recorded issues (the refused request is admitted and writes its checkpoints); with the guard back the focused suites pass again. Not run on a GPU model or over HTTP. Docs: inference.md, hardware-support.md, prefix-cache.md, configuration.md and the changelog fragment state the rule. Co-Authored-By: Claude <noreply@anthropic.com>
5 tasks done
Brings in feat/turn-continuation-every-template at 470c2e4, which merges dev 65580bd and pins mlx-swift-lm at f86ac6731042. Conflicts, each resolved by keeping both sides: - EngineV2Bridge.init: dev's refusalProbe, nativePrefillEvidence, evidenceProbeOnACPower and terminalBeforeCheckpointPublication, then this branch's turnContinuationCells. - MultiModelBatchSchedulerEngine: dev moved the withholdsGLMOutput declaration earlier in prepareCompletion, so the continuation block keeps using it there. Each stream builder takes dev's rewriteHarmonyFinalHeaders, then turnContinuation. On the engine's stop event, dev's token-limit note runs, then engineReportedStop is set. - IdleCalibrationCoordinatorTests: this branch's transfer test, then dev's two tests and its admittedLease() helper. #1966 renamed beginForeground() to admitForeground(), so this test and TurnContinuationBridgeTests take the lease through admittedLease(). - docs/architecture/hardware-support.md: the later "Last updated" date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in feat/turn-continuation-every-template at 6552890: the mlx-swift-lm pin 129acbcdc0b7 (library main f41a5f9af307 merged in) and dev de9b25b (#2123, the 0.10.13 candidate). No conflict. dev's new EngineAdmissionPriority is set on ordinary bridge submissions; a turn continuation still runs at the library's own lowest priority, because EngineV2.submitContinuation builds its request with priority Int.min / 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in feat/turn-continuation-every-template at 8b666d9: dev 58659fe (#2134) and the mlx-swift-lm pin 129acbcdc0b7. No conflict. dev's reservation changes in WholeMacServiceBudget (overcommit, exclusive idle charges), native reasoning budgets in the bridge submission and the MiMo route, and the bridge event task's admission priority sit beside this branch's continuation code without touching it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
Refresh, 2026-11-14 (head
ad1126a7ad7b)devmoved three times during this refresh, from65580bdc16b5tode9b25ba5c66(0.10.13 candidate (phase C: #2096 2088@001996379f 2100@2e241534b5 2098@d76366162a) into dev, for the DevNet build #2123) and then58659fe3900f(0.10.13 candidate (phase D1) into dev, for the DevNet build #2134, the 0.10.13 candidate). Library DAR-327 Phase 3: instant provider reconnect (going_away) #396 is now129acbcdc0b7, which merges librarymainf41a5f9af307;devpinsf41a5f9af307itself. After these checksdevmoved once more, to6d61e2d08ace(0.10.13 candidate (phase D2) into dev, for the DevNet build #2136, read 04:18 UTC): 17 files, the same pins, and with this branch only "Last updated" doc lines in common; it merges without a conflict, so it is not merged in here.ff11482b3a78: merge of470c2e4f38c8.a99f5bd996b3: merge of6552890bd71f.ad1126a7ad7b: merge of8b666d9a553e.EngineV2Bridge.init:dev'srefusalProbe,nativePrefillEvidence,evidenceProbeOnACPowerandterminalBeforeCheckpointPublication, then this PR'sturnContinuationCells.MultiModelBatchSchedulerEngine:devmoved thewithholdsGLMOutputdeclaration earlier inprepareCompletion, and the continuation block uses it there.dev'srewriteHarmonyFinalHeaders, thenturnContinuation.dev's token-limit note runs, thenengineReportedStopis set.emityields to the client.IdleCalibrationCoordinatorTests: this PR's transfer test, then fix(provider): a request stops waiting for an idle calibration probe that never retires #1966's two tests and itsadmittedLease()helper.beginForeground()toadmitForeground(). This PR's two test call sites now take the lease throughadmittedLease().devadded since then:EngineAdmissionPriority: a turn continuation keeps the library's own lowest priority, becausesubmitContinuationbuilds its own request.WholeMacServiceBudgetovercommit and exclusive idle charges, and native reasoning budgets: these sit beside the continuation code.swift build --build-tests: passes.TurnContinuation|TurnReplyCapture|EngineV2CanonicalGridTests|TemplateBoundaryRule): 55 tests in 10 suites passed.KVPoolSweepWiringTests|LocalPrefillProgressTests|UnboundedDeviceWorkTests|ModelCalibrationTests|ProviderCancelledPrefixCache|SSDHybridCheckpoint|SSDPrefixCache): 214 tests in 30 suites; 2 issues, both in the two cache-path tests that fail on this Mac in every run ("without the isolated root the cache root is the user caches folder" and "cacheDirectory lives under darkbloom/kv3, never under the legacy darkbloom/kv root"). They expect/darkbloom/kv3under the user caches folder, which this session's home-folder layout does not give.docs-impact-check25 files OK;changelog.py check2 fragments;git diff --checkclean.594a944f0f69,7b58ec236df9and earlier) and the repository's two-reviewer quality gate.Summary
#1954 adds an opt-in prefill grid, so a slot keeps state at fixed positions that a later prompt can reuse. A follow-up still has to prefill the reply it follows, because that reply was generated, not prefilled, and its end is not a kept position.
This PR adds the caller that fills that gap. With
DARKBLOOM_CBV2_TURN_CONTINUATION=1and the grid on, after a text reply ends the provider works out the tokens every next turn of that conversation must start with, and prefills them while the Mac is idle. The next request of the conversation then finds state past the reply.What the HTTP runs showed (2026-11-10, Qwen3.5-9B, M3 Ultra 256 GB, one stream, grid 512):
594a944f0f69, shipped tier. A continuation started on exactly the turns whose reply crossed a 512-token boundary: 13 of 54 turns per run. All 26 over two runs ended within 1 ms and prefilled nothing.7b58ec236df9. A prefix-store transfer no longer ends a continuation session. An arriving request, a model load, a cache clear and every other device activity still end it. A calibration session behaves as before.7b58ec236df9, shipped tier (two launches of one binary, caller on and caller off, 108 turns, 0 failures). 13 continuations started, on the same 13 turns. 4 completed after 2.3 to 2.9 s of idle work, the next request ended the other 9, and none ended itself.presence_penalty), the continuation prefilled the whole prompt from token 0 (10,753 and 11,777 tokens, about 12 s of GPU) and wrote 585 and 627 MB. The next request arrived during the write and waited for it. In one of the two cases it reached the first token 4.75 s later than with the caller off (13.469 s against 8.721 s). In the other it waited about 6 s, then restored what the continuation had written, and was sooner (6.976 s against 11.164 s).9491f00111a5. The hidden request is refused before any prefill when the store and the resident tier restore less than the last grid position its turn's prompt should have left. Both cases above are refused by that rule. So is the later reuse in the second case: where the turn's own requests write no checkpoint, no continuation starts and none writes one. Tested on the toy engine only (see Test plan); not run over HTTP.Before
flowchart LR A[Turn 1 prompt] --> B[Prefill, state kept on the grid] B --> C[Reply generated] C --> D[Mac idle] D --> E[Turn 2 arrives] E --> F[Restore the last grid position of turn 1] F --> G[Prefill the reply and the new message]:::bad classDef bad fill:#fee2e2,stroke:#b91c1c,color:#7f1d1dAfter
flowchart LR A[Turn 1 prompt] --> B[Prefill, state kept on the grid] B --> C[Reply generated] C --> D[Idle: prefill prompt + reply to the next kept position]:::good D --> E[Turn 2 arrives, cancels any work still running] E --> F[Restore a position past the reply]:::good F --> G[Prefill the new message only]:::good classDef good fill:#dcfce7,stroke:#15803d,color:#14532dCode flow:
MultiModelBatchSchedulerEngine.makeEventStreambuilds aTurnContinuationSourcefor a request the continuation may follow and feeds the stream's events to aTurnReplyCapture. After the terminal frame is sent and the model pin released,TurnContinuationSource.startrenders the conversation twice with the reply appended and two different one-letter user messages, and keeps the tokens both renders share, less the last.EngineV2Bridge.continueTurncuts that prefix at the last position the slot's tiers keep (TurnContinuationCells.plan, which also gives the restore floor: the last grid position the turn's own request should have left on the store), waits for the source request to retire, and starts a hidden one-token request throughIdleCalibrationCoordinator.startIfIdle. It starts the session withtoleratesPrefixStoreTransfers: true, so the request's own store restore and checkpoint write do not cancel it. Before submissionEngineV2Bridge.submitTokenizedcompares the floor with what the prefix tiers restore for the request, and refuses it when they restore less: nothing is reserved or prefilled, and a staged checkpoint is given back unconsumed. Otherwise the bridge hands the request toEngineV2.submitContinuation, which admits it only while the engine has no other stream.Linked issue
None.
Test plan
Build, local, CPU:
swift build --build-tests --package-path provider-swifton the head's tree. Build complete.Focused suites, CPU, isolated state files:
swift test --package-path provider-swift --skip-build --no-parallel --filter 'TurnContinuation|TurnReplyCapture|EngineV2CanonicalGridTests|TemplateBoundaryRule': 55 tests in 10 suites pass. 42 of them are new, in six suites:contenta client keeps, without reasoning, for streamed, complete and native-channel replies; a tool call or an empty answer gives none.EngineV2with a two-layer toy hybrid model (random weights, 128-token grid, resident bank). See the next bullet.Bridge test, what it shows. On the toy engine: a build derives the cells from its grid and tier, and the key gates them; a continuation prefills the next kept position and the follow-up restores it, where the same turns in a second cache scope with no continuation do not; a continuation is skipped while a request holds the slot or when nothing new is left to keep; a request that arrives during a continuation gets the same reply as the same turns with no continuation and as a cold request, and the serving counters count the arrival alone. The arrival is pinned at two points only: right after the continuation is scheduled, and once the engine has admitted it. Other interleavings are not pinned.
Store test, what it shows. A 513-token turn leaves a checkpoint at 512. The continuation for a 900-token shared prefix restores it (512 tokens consumed from the store), writes the checkpoint at 768 and completes, with no canceller recorded. The follow-up restores 768. With the fix's call-site argument removed the same test fails (6 expectations): the log line reads
ended, 769 tokens after a 513-token prompt in 0 ms, session cancelled by device work, nothing is restored or written, and the follow-up restores 512. That is the HTTP result on the toy engine. The store refuses writes on a volume under its low-disk floor, so this test needsDARKBLOOM_SSD_TEST_TMPDIRon a volume with free space when the default temp volume is nearly full (it was here).Guard tests, what they show. Same toy engine and store. (1) On an empty store the continuation for a 513-token turn is refused: the engine admits nothing, no file is written, nothing is consumed and no canceller is recorded. After the turn's own request has left position 512, the same continuation runs and writes 768. (2) The store holds 512 and a 769-token turn should have left 768: the continuation is refused, the checkpoint it read is given back unconsumed, nothing is written, and the next request still restores 512. With the comparison replaced by
restored < 0, the focused suites fail with 7 recorded issues, all in these two tests: the refused request is admitted and its checkpoints are written. With the guard back they pass again.Related suites, same build (the feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954 list plus
IdleCalibrationandModelCalibrationPolicy): 235 tests in 20 suites pass. One is new: a prefix-store transfer ends a session unless the session tolerates it.Suites around the changed call sites, previous head
7b58ec236df9, not rerun on this head (KVPoolSweepWiringTests|LocalPrefillProgressTests|UnboundedDeviceWorkTests|ModelCalibrationTests|ProviderCancelledPrefixCache|SSDHybridCheckpoint|SSDPrefixCache): 212 tests in 30 suites, 210 pass, 2 fail. The 2 assert the cache folder's path (SSDPrefixCacheFactoryTests.swift:103,SSDPrefixCacheTests.swift:2771: it must enddarkbloom/kv3). The shell these ran in is a dev-channel sandbox whose folder isdarkbloom-dev/kv3. This PR does not touch that path. The two were not rerun on the base head.Skipped by their own gates (they need local model weights or a GPU profile): suite
GLM5NextProtectedFactoryTests, and 11 tests:defaultServingSelectsPagedKVAndCompletePrefix,disabledSSDStillUsesOriginalProtectedProfile,glmNativeFenceFailureKeepsNewcomerAndShrunkSurvivor,malformedDecodeStepsRefuseTheBackend,managedSlotBindsEncryptedStoreAndRestoresPrefix(precision:),pinnedCheckpointIsDiscoveredWithItsRecordedLoadCharges,pinnedMetadataIsDiscoveredAsAnImageModel,prefixOptOutAndPagedVetoesNeverFallBackToContiguous,preparedFactoryRejectsForeignStoreAndTuple,rectangularVerifyRollbackReachesTheProviderJob,residentOptInKeepsCompletePrefixInsteadOfRefusing.Repo checks:
./scripts/docs-check.sh(211 files OK);python3 scripts/docs-impact-check.py --base upstream/dev(35 changed files, coverage OK);python3 scripts/changelog.py check(69 valid fragments);git diff --checkclean.GPU, HTTP, previous head
594a944f0f69(before the fix).darkbloom start --local --here --no-auth --model Qwen3.5-9B, paged KV, grid 512, M3 Ultra 256 GB, macOS 27.2. Sessions of 6 turns, prompts 8,297 to 11,900 tokens,temperature0, streaming, thinking off,presence_penalty: 0. Seven launches, 318 turns, 0 failures.Paired by turn on the bank, caller off / caller on: 1.370 (p10 1.276, p90 1.446, n 18) at 6 s pauses; 1.313 (p10 1.077, n 9) at 0.3 s pauses. A continuation's log line reports a median 232 ms (179 to 290, n 42).
GPU, HTTP, previous head
7b58ec236df9(before the guard). The same server command, sessions and seeds as the item above; encrypted store with a 40 GB cap on an external volume; one binary (sha2564b16548cb942…) for both launches. Launch 1 caller on, launch 2 caller off: 54 turns each, 0 failures. Built without fix(provider): Qwen3.5-9B: no default presence penalty and exact MTP acceptance; the 35B Qwen builds keep 1.5 #1961.presence_penalty: 0, 4 sessionspresence_penalty: 0, 3 sessionspresence_penaltynot sent, 2 sessionsNot run: this head's guard on a real model, on a GPU or over HTTP; the full provider suite; a request that arrives while a warm continuation writes its one checkpoint file; the write wait on the internal SSD (the store was on an external volume, about 87 MB/s); the idle GPU time spent; any other model, grid size or prompt size; more than one stream; a bitwise check of a request that arrives during a continuation or restores a continuation's checkpoint; anything on a build with fix(provider): Qwen3.5-9B: no default presence penalty and exact MTP acceptance; the 35B Qwen builds keep 1.5 #1961.
Components touched
Protocol / interface changes
DARKBLOOM_CBV2_TURN_CONTINUATION. Nothing on the coordinator or the wire changes, and there is no version bump. No library change: the pin is feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954's.Documentation impact
docs/architecture/inference.md(new section "Turn continuation"),docs/architecture/hardware-support.md,docs/architecture/prefix-cache.md(store transfers and idle sessions),docs/reference/configuration.md(one row),docs/provider/cli-reference.md(one row).Changelog
changelog.d/turn-continuation-prefills-the-next-turn.md;python3 scripts/changelog.py checkpasses.Notes for reviewers
EngineV2Config.makeBridgepasses the cells only when the key is exactly1. With no cells the scheduler builds no source and no capture, and the stream forwarder is the one feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954 has.stop, non-empty content and no tool call. None for: a token-limit cut, a matched stop sequence, a cancelled request, a response format or JSON answer, withheld GLM output, a native consumer lease, media, a GLM5Next slot with a native owner, or a slot whose only prefix tier is resident KV pages.7b58ec236df9: the one follow-up after a completed continuation restored one more 512-token block and reached the first token 1.64 times sooner (0.830 s against 1.368 s); the median follow-up did not move (1.120 s against 1.143 s). The larger gain (1.3 to 1.4 times sooner to the first token) needs a resident bank on paged storage, which no shipped build enables.Qwen3.5-9B,qwen3.5-35b-a3bandqwen3.6-35b-a3b-vl-mtp-mxfp8a request that omitspresence_penaltygets 1.5, runs no MTP and writes no prefix checkpoint. Measured on feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954's binary over HTTP on 2026-11-10: 180 of 180 follow-ups without the field reused 0 tokens. fix(provider): Qwen3.5-9B: no default presence penalty and exact MTP acceptance; the 35B Qwen builds keep 1.5 #1961 (draft, basedev, not in this stack; it supersedes [superseded by #1961] fix(provider): no default presence penalty on Qwen 3.5/3.6 #1946) removes that default on Qwen3.5-9B; by its title the two 35B builds keep 1.5. The hidden request here does not get the default: the bridge submits it throughEngineV2.submitContinuation, which replaces its sampling with temperature 0 and no penalty. So on these builds the hidden request writes checkpoints where the turn's own request wrote none, after a full cold prefill. The HTTP run of7b58ec236df9measured that. On this head the guard refuses that hidden request, so on these builds a turn without the field starts no continuation. Nothing here ran on a build with fix(provider): Qwen3.5-9B: no default presence penalty and exact MTP acceptance; the 35B Qwen builds keep 1.5 #1961.7b58ec236df9, when the turn's own request left no checkpoint, the hidden request prefilled the whole prompt: about 12 s of GPU for 11,000 tokens on this Mac, and a full set of checkpoint files. This head refuses the hidden request before any prefill unless the store or the resident tier restores at least the last grid position the turn's prompt should have left. What that leaves:mainat 17:45Z today, not in this pin) lets a cached request that cannot speculate, such as one under the card's default presence penalty, save prefix checkpoints. By reading, that removes the cause on these builds, and their continuations would start again. Not built or tested here.reasoning_contentback, or changes an earlier message gets no reuse.DARKBLOOM_CBV2_*key: it enters the complete-checkpoint numerics fingerprint and turns off the reviewed serving and deadline profiles.7b58ec236df9, store tier, caller on vs caller off: equal on 19 of 21 turns at 6 s pauses, 18 of 18 at 0.3 s and 12 of 12 with the penalty not sent. The two that differ start in the caller-off launch; the caller-on launch equals the previous head's caller-on launch on 24 of 24 and 18 of 18. On the bank (previous head), caller on vs caller off gave equal replies on 21 of 22 turns at 6 s pauses and 10 of 12 at 0.3 s. The same setting run twice also differs: on the store tier with the caller off, 21 of 22 and 15 of 16 were equal. Two turns (session 2 turn 3, and in that head's run session 0 turn 4) vary between identical launches attemperature0, with and without the caller. That variation is not explained; it appears with reuse and MTP active and was not seen in feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954's HTTP run without them. One reply differed only in the launch where its request arrived during a continuation (one sample, on the bank). All of this compares reply text. A bitwise check of a request that arrives during a continuation, and of one that restores a continuation's checkpoint, is owed before this is turned on anywhere.device work). The hidden request is left out of the prefix-cache savings counter and the reuse telemetry, and calibration takes no measurement from it.feat/turn-continuation-every-templateat1a2a346a8dd1(feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954 head);devat2474f3dcce8c; library pin unchanged from feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954 (6db4a4001f, mlx-swift-lm#396). Librarymainmoved toef028fbe41f3at 17:45Z (mlx-swift-lm#398, see Costs). The pinned branch does not have it. A trial merge of the pinned branch with thatmainhas no conflict; the merged library was not built or tested, and no measurement here includes it. fix(provider): Qwen3.5-9B: no default presence penalty and exact MTP acceptance; the 35B Qwen builds keep 1.5 #1961 atca8697d851c5(draft): a trial merge of it with this head has no conflict; the merged tree was not built or tested. Recorded exception carried from feat(provider): 0.10.12 — an opt-in prefill grid that reads message boundaries from each chat template (off by default) #1954: the pin is the library PR branch, to be moved tomainonce DAR-327 Phase 3: instant provider reconnect (going_away) #396 merges; that branch is behind librarymainby stats: leaderboard earnings lack context (rolling window + early-ramp vs calculator) #367 and Detect boot policy in doctor #398.Refactor Pass
Verdict: reviewed once by a second pass; eight findings applied, one left. The first HTTP run then found one more defect, fixed in
7b58ec236df9. The HTTP run of that head found another; this head adds a guard for it, tested on the toy engine only.Applied:
A reply ended by a matched stop sequence started a continuation. It now starts none.
The log line said
completedafter a cancel. It now sayscompletedonly when the engine prefilled every token.A cancelled continuation was described as keeping its work. The comment, doc and changelog now say the complete-checkpoint store keeps nothing from it.
The hidden request entered the prefix-cache savings counter and reuse telemetry. It is now left out of both.
The hidden request carried
seed: 42, which gave it an engine ID a client's request could mint again. Removed.The unit tests depended on timing and never reached the bridge. They now use an injected launch, and a bridge-level test on a real engine was added.
The changelog's condition for "starts none" was too narrow. Reworded.
The wait an arrival sees had no stated bound. The doc now says so under Costs.
Found by the first HTTP run: a continuation's own store restore ended its idle session, so on the store tier it never ran. A prefix-store transfer no longer ends a continuation session; a test on the store tier pins it.
Found by the HTTP run of
7b58ec236df9: a continuation that has nothing to restore prefilled the whole prompt, and the next request waited for its checkpoint write. The hidden request is now refused before any prefill when the prefix tiers restore less than its turn left; two tests on the store tier pin it and fail without the comparison.Open:
Considered and left:
!Task.isCancelledin the hook). The stream's termination handler cancels that task on every normal end, so the check would drop ordinary continuations at random.AI usage: written by Claude Fable 5 (Claude Code) at the owner's request. The 2026-11-14 refresh (the merges, their checks and the refresh section) was done by Claude Opus 5.5 (Claude Code). Not for merge until reviewed.
🤖 Generated with Claude Code