8000 fix(sdk): an unidentified reasoning start opens a new block instead of joining the last by Fodesu · Pull Request #56 · felinics/twilight · GitHub
[go: up one dir, main page]

Skip to content

fix(sdk): an unidentified reasoning start opens a new block instead of joining the last - #56

Merged
Fodesu merged 1 commit into
felinics:mainfrom
Fodesu:fix/sdk-reasoning-unidentified-blocks
Sep 25, 2026
Merged

Fodesu merged 1 commit into
felinics:mainfrom
Fodesu:fix/sdk-reasoning-unidentified-blocks

Conversation

@Fodesu
@Fodesu Fodesu commented Sep 25, 2026 •
Copy link
Copy Markdown
Member

Problem

reasoningAccumulator.index resolved an ID-less part to the most recent block. A second ReasoningStartPart without an ID therefore merged into the first block: the texts concatenated and the second block's ProviderMetadata overwrote the first block's signature, which the provider then fails to verify on replay. ReasoningPart documents that blocks are never merged, reordered or dropped.

Every in-tree provider carries a block ID today, so this is a latent divergence between the accumulator and its contract rather than a live failure.

Change

  • An unidentified start always opens a new block.
  • An unidentified delta or end joins the most recent block only when that block is itself unidentified, and opens one otherwise. A provider that omits block IDs delimits its blocks with their starts alone.
  • Identified parts behave exactly as before (re-announced IDs still return the existing block).

This is the rule identified parts already follow: a block is delimited by its start, and whether it has ended does not change where a later part belongs. No new state is added to the accumulator.

Tests

TestToResultKeepsUnidentifiedReasoningBlocksApart (table-driven, 3 cases) through CollectStream: two delimited blocks, delta without start, unidentified block after an identified one.

go vet ./..., go test ./sdk/... ./provider/... -skip Integration, golangci-lint run ./sdk/... all pass.

…f joining the last

reasoningAccumulator.index resolved an ID-less part to the most recent
block, so a second ReasoningStartPart without an ID merged into the first:
texts concatenated and the second block's metadata overwrote the first
block's signature, which the provider then fails to verify on replay.
ReasoningPart's contract is that blocks are never merged.

An unidentified start now always opens a new block. An unidentified delta
or end joins the most recent block only when that block is itself
unidentified, and opens one otherwise, so a provider that omits block IDs
delimits its blocks with their starts alone. This is the rule identified
parts already follow: a block is delimited by its start, and whether it
has ended does not change where a later part belongs. Every in-tree
provider carries an ID, so no live path changes.
@Fodesu
Fodesu force-pushed the fix/sdk-reasoning-unidentified-blocks branch from 40ecba0 to 31f61e3 Compare September 25, 2026 06:02
@Fodesu
Fodesu marked this pull request as ready for review September 25, 2026 06:04
@Fodesu
Fodesu merged commit 6487fcb into felinics:main Sep 25, 2026
3 checks passed
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

0