Skip to content

0.10.14: exit-thinking: a local client that leaves during the hand-off gets no continuation row (stacked on #2061) - #2078

Merged
jonathan308 merged 6 commits into
devfrom
fix/exit-thinking-handoff-cancel
Nov 15, 2026
Merged

jonathan308 merged 6 commits into
devfrom
fix/exit-thinking-handoff-cancel

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

0.10.14 follow-up, draft. Stacked on #2061 (which contains #2046): until both merge, the diff shows theirs too. Merge #2046, then #2061, then this.

The fresh-context review of #2046 + #2061 (REVIEW-4, APPROVE WITH NITS) left two items for a follow-up, which this PR takes: M1 step 1 and N1.

  • M1: on the scheduler path, a cancel that reached only the splice's control could arrive while the stopped row was still releasing its slot (up to 5 s). The continuation row was then submitted and cancelled at once.
  • N1: such cancels were logged as "continuation refused".

What

  • LoopExitThinkingContinuation.Submit gets a third argument, cancelled: the splice's own cancel, which the owner reads after its release wait.
  • Both owners check it after waitForRowRelease and submit nothing once it is set:
    • the scheduler, beside its Task.checkCancellation();
    • Super's binding, beside its RowCancel. There it changes nothing: every cancel on that route already sets RowCancel first.
  • A refusal the cancel caused (the control, or a CancellationError) ends the request as length with the outcome "cancelled", not "continuation refused".
  • A changelog fragment, scoped to the scheduler's text path.

Not here: REVIEW-4 M1 step 2, joining the splice before the scheduler returns the admission (releaseBox.fire()).

  • What's left without it: a cancel that lands during submitTokenized still gets a row that is submitted and then cancelled at once (markStarted → cancelContinuation). On the client-drop path that can happen just after the admission was returned.
  • Why it's deferred: waitForRowRelease ignores cancellation, so a plain join could hold the release for up to 5 s. The join wants a release wait that also races the splice's cancel.

Tests (red first)

  • Red 7da06f7bdc (local): exactly the new serving test fails, "a local client that leaves while the stopped row releases its slot gets no continuation row" (the engine saw 2 requests). The other 52 pass.
    • The test holds the first row's retirement: a row admitted against its first-content deadline ends its stream before it releases its slot.
    • It disconnects the local client (LocalRequestCancellationScope.cancel()) while the splice waits in waitForRowRelease, then releases the row.
    • With the fix it also checks the request ends length with no answer, and it has a 1-min time limit.
    • Its 200 ms wait lets the splice pass its own pre-submit check first. The red run shows the release wait is reached.
  • Green 4f3584fdad, then the review's nits (ccb7f48d7b): 54/54 locally.
    • New splice-level test: "an owner that checks the splice's cancel after its release wait submits nothing", with its outcome "cancelled".
    • The existing hand-off test still shows that an owner which doesn't check is cancelled at once.
  • The red commit's CI run was superseded by the green push; the red evidence is local, above.
  • Fresh-context review of 4f3584fdad: APPROVE WITH NITS. Its nits are answered here, and its minor finding is the "Not here" above.

Later

  • REVIEW-4 M2: binding-level tests for the binding's own cancel guard, join, fallbacks (RowNotReleased, id 18) and route wiring.
  • N3: on a pair, Super's guard still reports ends_thought (telemetry only).
  • N4: run the binding's token checks before the release wait.
  • N5's real-tokenizer fixture for Gemma's decode check.
  • N6: answerFinished, the continuation's checkpoint writes, outcome telemetry.

…ts no continuation row (red)

On the scheduler path, the local API's disconnect hook reaches only the
splice's control: the splice's task keeps running, so the owner's
`Task.checkCancellation()` after the stopped row's release wait passes, the
continuation row is submitted, and only then cancelled (the fresh-context
review of #2046 + #2061, m1).

The test holds the first row's retirement (a row admitted against its
deadline ends its stream before it releases its slot), disconnects the local
client while the splice waits in `waitForRowRelease`, then releases the row:
no continuation may be submitted. Red: the engine sees 2 requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Nov 15, 2026 4:57pm UTC
darkbloom-status Ready Ready Preview Nov 15, 2026 4:57pm UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 15, 2026 4:57pm UTC

Request Review

… continuation row

`LoopExitThinkingContinuation.Submit` takes the splice's own cancel
(`cancelled`). The scheduler checks it after the stopped row's release wait,
beside its `Task.checkCancellation()`; Super's binding beside its `RowCancel`.
A cancel that reaches only the splice's control (the local API's disconnect
hook; on the native route, the hand-off's cancel) therefore submits nothing,
instead of submitting the continuation and cancelling it at once (a wasted
prefill of the prompt and the whole thought). A refusal that cancel caused
ends the request as `length` with the outcome "cancelled".

A splice-level test pins the owner's check; the existing hand-off test still
shows that an owner that does not check is cancelled at once. Local: 54/54
(red 7da06f7: exactly the new serving test failed).

Review (fresh context) of #2046 + #2061, m1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review of #2078 (fresh context, APPROVE WITH NITS):
- n1: a task cancel that reaches the owner's check before the splice's
  control is set (its `onTermination` cancels the task first) is logged as
  "cancelled", not "continuation refused".
- n2: the serving test has a time limit, asserts the request ends `length`
  with no answer, and says why it waits 200 ms.
- n3: the splice-level test pins the outcome ("cancelled").
- n4: the changelog fragment is scoped to the scheduler's text path (Super's
  route already behaved this way).

Its m1 (join the splice before the scheduler returns the admission) is
listed in the PR as not here: the release wait ignores cancellation, so a
plain join could hold the release for up to 5 s.

Local: 54/54.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ncel

Conflicts:
- LoopExitThinkingContinuation: dev's admission priority (#2100/#2115) wraps
  this branch's three-argument submit (the splice's cancel).
- GenerationLoopExitThinkingServingTests: both sides added tests at the same
  place; both kept.
dev's vision exit-thinking path (#2054) splices with the same submit as the
text path; with this branch's three-argument Submit it now checks the task
and the splice's cancel after the release wait, as the text path does.
@jonathan308

Copy link
Copy Markdown
Collaborator Author

Release owner (0.10.14, REL14): brought onto today's dev without force-push (9d632a148c signed merge; 96151f13a5 the image/video path takes the three-argument submit and checks the cancel as the text path does; f381270f53 changelog). Fresh-context delta review APPROVE WITH NITS, merge YES (earnings/exit-thinking-families/review-2078-delta/REVIEW.md; F1 done, F3/F4 follow-ups); CI green on f381270f53. Merging into dev.

@jonathan308
jonathan308 marked this pull request as ready for review November 15, 2026 17:23
@jonathan308
jonathan308 merged commit 1ab1542 into dev Nov 15, 2026
19 checks passed

This branch was successfully deployed

3 active deployments
Preview – d-inference-landing — f381270f Deployed Nov 15, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — f381270f Deployed Nov 15, 2026 by vercel[bot]
Preview – darkbloom-status — f381270f Deployed Nov 15, 2026 by vercel[bot]
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.

1 participant