Read DSH session format v4 written by dsh 0.2.0-rc.2 - #1612
Merged
Merged
Conversation
dsh 0.2.0-rc.2 stamps every session log v4, so discovery skipped each one and DeepSeek Harness contributed no usage anywhere (getagentseal#1584). Admitting v4 only after verifying the reader's whole consumption surface against DSH's official sessionFormatCatalog (recovery: 'strict', validation: 'current', @deepseek-ai/dsh-session-format-catalog@0.2.0-rc.2), per the semantic-update rule docs/providers/dsh.md prescribes for format bumps: dense seq, usage at assistant/message data.usage (plus a new informational totalTokens sum) or the embedded stream, tagged end-seed inheritance, and llm/retry-started attempt slots are all unchanged. What v4 does change (tool-result role lift, plugin: tag namespacing, surfaceOp append/replace metadata, new header fields, untagged end-seed markers in unseeded sessions) is ignored or already handled. Adds catalog-validated v4 fixtures (same buckets as v0-v3 plus the informational totalTokens) and extends the per-version parse tests to v4. Bumps the dsh parse version so cached skip-era sessions recompute. Verified end to end against a real 0.2.0-rc.2 log: doctor reports the session readable, and the parsed totals (12 calls, input 11783, output 3699, cache read 107520) match the official catalog artifact exactly.
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.
Summary
Fixes #1584.
@deepseek-ai/dsh0.2.0-rc.2 writessession.v4.jsonl.zstd, so discovery skipped every DSH session withskipping DSH sessions written in session format version 4; upgrade codeburnand DeepSeek Harness contributed no usage anywhere.This admits format v4 after the semantic reader update the docs prescribe for format bumps, not by relaxing the check:
sessionFormatCatalog(recovery: 'strict',validation: 'current',@deepseek-ai/dsh-session-format-catalog@0.2.0-rc.2): denseseq, usage atassistant/message'sdata.usage(which gains an informationaltotalTokenssum this parser ignores) or its embedded stream, the taggedsession/end-seedinheritance rule, andllm/retry-startedattempt slots are all unchanged in v4. The restore of the fixtures and of a real 0.2.0-rc.2 log both pass strict/current validation.tool, unknown tags namespacedplugin:<name>,surfaceOpappend/replace metadata, new header fields (agentPreset,origin), untaggedsession/end-seedmarkers that unseeded sessions now also write — is either ignored by the reader or already handled by it (the seeded/unseeded consistency checks key on theinheritedtag, which v4 keeps as the only inheritance marker).v4.jsonl/v4-retry.jsonlfixtures with the same buckets as v0-v3 (uncached input 100, output 20, cache read 30, write 5) and extends the per-version parse tests (totals, retry accounting, embedded-stream preference, tagged inherited-prefix exclusion) to v4. Thesession.v4-as-unknown-version discovery test moves to v5.PROVIDER_PARSE_VERSIONS.dshso cached skip-era sessions recompute.Testing
npx vitest run tests/providers/dsh.test.ts— 86 passed (including the new v4 variants).~/.dsh/sessions, one session, 119 events):The parsed totals match the official catalog artifact for the same log exactly (sum of its 12
assistant/messageusage records).