Skip to content

Add DeepSeek Harness rollout parsing - #35

Open
Wangmerlyn wants to merge 2 commits into
TeichAI:mainfrom
Wangmerlyn:siyuan/deepseek-harness
Open

Add DeepSeek Harness rollout parsing#35
Wangmerlyn wants to merge 2 commits into
TeichAI:mainfrom
Wangmerlyn:siyuan/deepseek-harness

Conversation

@Wangmerlyn

@Wangmerlyn Wangmerlyn commented Sep 7, 2026

Copy link
Copy Markdown

DeepSeek Harness session logs were misclassified as Pi, and compressed logs were not discovered. Add automatic v0/v1/v2 parsing through teich convert, load_traces(), and prepare_data() for plain JSONL and Zstandard-compressed sessions.

The converter projects the effective conversation after compaction, preserves reasoning, tool-call arguments, and tool error flags, uses the latest request header for system instructions and tool schemas, and selects the newest native version per session ID within a directory when migration copies coexist. Streaming/execution records do not duplicate assembled messages. Includes a synthetic example and documentation; this adds rollout parsing only, with unresolved attachments reported explicitly.

Validation:

  • 735 non-integration tests passed, including 34 DeepSeek regressions.
  • Ruff, mypy, lock validation, and wheel/sdist build passed.
  • Installed-wheel CLI conversion passed in an isolated environment.
  • Two existing compressed DeepSeek smoke logs converted successfully.
  • Two independent code reviews completed; the reproduced tolerant-discovery issue was fixed and re-reviewed.

Docker/API integration and live tokenizer smoke tests were not run.

@CompactAIOfficial CompactAIOfficial added documentation Improvements or additions to documentation enhancement New feature or request triaged labels Sep 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30b121e98b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/teich/converter.py
header = next(_read_trace_events(handle, skip_invalid_lines=skip_invalid_lines), None)
if _is_deepseek_session_header(header):
sessions.setdefault(path.parent, []).append((int(match[1] or 0), path))
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Deduplicate only files from the same session

When a directory contains canonically named DeepSeek files from different session IDs—for example, session.v1.jsonl and session.v2.jsonl copied into a flat collection—this groups them solely by parent directory and silently retains only the highest filename version. Since directory conversion otherwise supports arbitrary collections of traces, this can drop an independent rollout; include the session header ID in the grouping key (and only treat matching IDs as migration copies).

Useful? React with 👍 / 👎.

Comment thread src/teich/converter.py
Comment on lines +3522 to +3525
message: dict[str, Any] = {
"role": "tool", "tool_call_id": call_id,
"content": _deepseek_text(block["content"]),
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve DeepSeek tool error status

When a native tool-result block has isError: true, this message construction discards that field, so the converted row represents failed tool executions identically to successful results. Other converters and message normalization preserve this as is_error, and losing it can teach the model an incorrect interpretation of error output; copy the block's error flag onto the emitted tool message.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants