Repository navigation
feat(deps): migrate replay state to dsh-llm rc.8's ReplayEnvelope - #54
Merged
Merged
Conversation
@deepseek-ai/dsh-llm 0.1.0-rc.8 types the terminal finish chunk's
replayState, which rc.6 left as `unknown`:
interface ReplayEnvelope { response: unknown; blocks?: readonly unknown[] }
This workspace filled that slot with its own `{ content, type }`, so the
bump is an API break rather than a version change and could not land as
a plain Dependabot bump.
Put the per-block array in `blocks` and the discriminator in `response`.
The placement is the whole point. dsh-llm's assembler prunes `blocks` at
the same positions as any block it drops -- a max-tokens finish drops
tool calls that were cut off and cannot safely be executed -- so the
envelope keeps describing the content that survived. State kept anywhere
under `response` is opaque to the assembler, so it cannot be pruned, and
falls out of step on the first truncation.
Falling out of step is not a loud failure. An envelope whose `blocks`
length disagrees with the emitted block count is discarded whole, with no
error: the reasoning block simply arrives without its signature, and the
first visible symptom is a provider rejecting the replayed history much
later. Three new tests in anthropic-provider pin the behaviour against
the real assembler -- one entry per emitted block, correct pruning under
a max-tokens finish, and the silent discard itself -- and a new host test
covers the one place a mismatch can still be turned into an error, since
the host reads the finish chunk rather than using the assembler.
Migrated in step, producers and consumers together; the envelope never
leaves the workspace, so no compatibility shim is needed:
omlx replay.ts (type + helper), serialize.ts (reader)
anthropic-provider translate.ts (producer), wire.ts (reader)
maximal-dsh-host bridge.ts (both directions)
Two fixture pins had to follow the bump. The host's synthetic provider
profiles and the oMLX integration profile declare dsh-llm as an exact
version, and profile validation rejects a mismatch against what is
installed. Only the hoisted dsh-llm moved: dsh-attachment, dsh-brand,
dsh-invariants and dsh-timeout still resolve to rc.6 there, so those pins
are unchanged.
The new host test pushed host.test.ts past its 800-line max-lines
ceiling, so it lives in tests/replay-alignment.test.ts.
Supersedes #39
stuffbucket
added a commit
that referenced
this pull request
Sep 7, 2026
#79) ## What The dsh-host test fixture hardcodes the versions it writes into the fixture profile's `package.json`: ```js dependencies: { "@deepseek-ai/cordis": "4.0.1", "@deepseek-ai/dsh-llm": "0.1.0-rc.8", ... } ``` but it symlinks the *actually installed* packages next to it. `resolveExternalProfile` requires the two to agree (`profile.ts:766`), so any bump of cordis, dsh-llm or schemastery breaks every test in the package. ## Why it matters The failure surfaces as the generic ``` Error [DshHostStartError]: The external provider profile is invalid. ``` which names neither the package nor the version — it reads like a regression in the bumped dependency. This is exactly what happened on #71 (cordis 4.0.1 → 4.0.2), and #54 had already had to hand-bump these strings once for dsh-llm rc.6 → rc.8. ## The fix Derive the versions from the same `require.resolve` that `packageRoot` already uses, so the manifest can never disagree with what is linked. No production code changes — `tests/fixture.ts` only. ## Verification - 44/44 on main (cordis 4.0.1) - 44/44 with #71's bumps applied (cordis 4.0.2, schemastery 3.18.2), **with no pins** — confirming there is no cordis regression - `pnpm run lint` and `pnpm run typecheck` clean across the workspace - lockfile untouched, 0 shard hosts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #39, which cannot land as a plain bump.
The break
rc.8 types the terminal finish chunk's
replayState, which rc.6 left asunknown:This workspace filled that slot with its own
{ content, type: "anthropic-message-v1" }.Why the per-block array goes in
blocksNot cosmetic. dsh-llm's assembler prunes
blocksat the same positions as anyblock it drops — a
max_tokensfinish drops tool calls that were cut off andcannot safely be executed — so the envelope keeps describing the content that
survived. Anything under
responseis opaque to the assembler, cannot bepruned, and drifts out of step on the first truncation.
Drift is silent. When
blocks.lengthdisagrees with the emitted blockcount, the assembler discards the envelope whole and reports nothing. The
reasoning block just arrives without its signature, and the first visible
symptom is a provider rejecting the replayed history much later.
So the alignment is what the tests pin, against the real
BlockAssemblerrather than against our beliefs about it:
blocksentry per emitted block — asserted as the invariant, since aliteral would still pass if both sides drifted together;
max_tokensfinish drops the unexecutable tool call and prunes theenvelope at the same position, with the surviving reasoning block keeping its
signature;
so reintroducing it fails a test instead of going quiet.
Plus a host-side test: the host reads the finish chunk directly rather than
using the assembler, which makes it the one place a mismatch can still become a
502 instead of a silence.
Migrated in step
Producers and consumers move together. The envelope never leaves the workspace
— no on-disk persistence, and
bridge.tsrebuilds replay from request contentrather than reading a stored envelope — so no compatibility shim is needed.
omlxreplay.ts(type + helper)serialize.tsanthropic-providertranslate.tswire.tsmaximal-dsh-hostbridge.tsbridge.tsTwo fixture pins the bump exposed
The host's synthetic provider profiles and the oMLX integration profile declare
dsh-llm as an exact version, and profile validation rejects a mismatch
against what is installed — every host test failed with
The external provider profile is invaliduntil they tracked the bump.Only the hoisted
dsh-llmactually moved.dsh-attachment,dsh-brand,dsh-invariantsanddsh-timeoutstill resolve to rc.6 there, so those pinsare deliberately unchanged.
Verification
tsc --noEmitandeslintclean across the three changed packages.verify:workspacepasses; lockfile re-resolved and stripped of rotatingshard hosts per SOURCES.md.
One structural note: the new host test pushed
host.test.tspast its 800-linemax-linesceiling, so it lives intests/replay-alignment.test.ts. Only thenew test moved — relocating the existing replay tests would be a larger diff
than this PR warrants.