Skip to content

fix: end DFlash generation on a stop token - #267

Merged
solderzzc merged 1 commit into
mainfrom
fix/dflash-stop-token-265
Nov 6, 2026
Merged

solderzzc merged 1 commit into
mainfrom
fix/dflash-stop-token-265

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Closes #265.

The DFlash bridge handed a stop id to onStopToken. When the handler answered .more, the bridge kept going, so the committed tokens after the stop id, from the same DFlash block, reached onToken and the client. A tool call written after the stop token was parsed too.

A stop id now always ends the generation, as on the standard path (Evaluate.swift breaks out on any stop id). The existing finish block runs: onGenerationEnd, one .info with stopReason .stop, and the task is cancelled. Non-stop tokens are unchanged.

Verified

  • testStopTokenEndsGenerationAndDropsLaterTokens (new): failed on origin/main with chunks ["t5 ", "t7 ", "t8 "], passes with this change.
  • swift test --filter DFlashStreamBridgeTests on this branch: 8 tests, 0 failures, EXIT=0.

🤖 Generated with Claude Code

The DFlash bridge handed a stop id to onStopToken, and when the handler
answered .more it kept going, so the committed tokens after the stop id
from the same DFlash block reached onToken and the client. A tool call
written after the stop token was parsed too.

A stop id now always ends the generation, as on the standard path
(Evaluate.swift breaks out on any stop id). The existing finish block
runs: onGenerationEnd, one .info with stopReason .stop, and the task is
cancelled. Non-stop tokens are unchanged.

Adds testStopTokenEndsGenerationAndDropsLaterTokens, which failed on
origin/main with chunks ["t5 ", "t7 ", "t8 "].

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@solderzzc
solderzzc merged commit 2c9aebe into main Nov 6, 2026
15 checks passed
@solderzzc
solderzzc deleted the fix/dflash-stop-token-265 branch November 7, 2026 01:28
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.

DFlash bridge keeps emitting tokens after a stop token in the same block

1 participant