Skip to content

Commit 378b314

Browse files
committed
doc: explain why completion and batch cancel are request-scoped
Note at both cancel declarations that continuous batching runs concurrent jobs on one model, so a model-wide cancel would stop peers; per-request cancel routes through each run's response to the addon's cancelJob.
1 parent 3f21fc5 commit 378b314

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • packages/sdk/server/bare/plugins/llamacpp-completion

packages/sdk/server/bare/plugins/llamacpp-completion/plugin.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ export const llmPlugin = definePlugin({
162162
requestSchema: batchCompletionStreamRequestSchema,
163163
responseSchema: batchCompletionStreamResponseSchema,
164164
streaming: true,
165-
// Per-request cancel: aborting one batch cancels only its own group
166-
// (addon cancelJob), leaving concurrent peers on the model decoding.
165+
// Request-scope, not model: under continuous batching several jobs share
166+
// the model, so a model-wide cancel would stop concurrent peers. The abort
167+
// routes through this batch's response to the addon's per-group cancelJob.
167168
cancel: { scope: 'request', hard: true },
168169

169170
handler: async function* (request) {
@@ -340,9 +341,9 @@ export const llmPlugin = definePlugin({
340341
requestSchema: completionStreamRequestSchema,
341342
responseSchema: completionStreamResponseSchema,
342343
streaming: true,
343-
// Per-request cancel: aborting one completion cancels only its own
344-
// native job (via the response), leaving concurrent completions on the
345-
// same model running.
344+
// Request-scope, not model: under continuous batching several jobs share
345+
// the model, so a model-wide cancel would stop concurrent peers. The abort
346+
// routes through this run's response to the addon's per-job cancelJob.
346347
cancel: { scope: 'request', hard: true },
347348

348349
handler: async function* (request) {

0 commit comments

Comments
 (0)