Last updated: 2026-11-17

API Server

Session Reuse Policy

All API Sections

Automatic chat session reuse policy.

Limits capability discovery to the backend and model state that have passed cached/native-reference and tool-history controls. Explicit API session keys retain their existing behavior independently of automatic client discovery.

5 exports shown

function

canAdvertise

#
pub fn canAdvertise(vulkan: bool, recurrent_width: u32) bool

Attention-only Vulkan models have passed cached/native and tool-history controls.

The hybrid control returned correct full-prefill output, but its stored prefix and recurrent checkpoint positions differed. Keep clients on full prefill until recurrent reuse has its own successful qualification.

src/server/session_reuse_policy.zig:12

function

canRewindPrefix

#
pub fn canRewindPrefix(vulkan: bool, recurrent_width: u32, has_draft_state: bool, has_kv_pages: bool) bool

KV rows before an edited token remain valid for attention-only models.

Recurrent state and speculative draft state cannot be rewound by changing the token position, so they must retain the existing full-prefill fallback.

src/server/session_reuse_policy.zig:19

function

defaultRewind

#
pub fn defaultRewind(vulkan: bool, intel_xe2: bool, gemma: bool, experts: u32, recurrent_width: u32) bool

The Intel Gemma MoE client path needs canonical replay after its template drops an empty thought channel.

Keep the automatic change on this profile; other attention-only graphs retain the explicit experimental override.

src/server/session_reuse_policy.zig:26

function

rewindRequested

#
pub fn rewindRequested(setting: ?[]const u8, qualified_default: bool) bool

No public doc comment yet.

src/server/session_reuse_policy.zig:30

function

rewindPrefixLen

#
pub fn rewindPrefixLen(stored: []const u32, prompt: []const u32) usize

Reuse only the identical canonical prefix.

Reprocess at least the last prompt token even on an identical/shortened retry: the previous request's logits describe its final generated token, not the end of this prompt.

src/server/session_reuse_policy.zig:37