Skip to content

fix: replay DeepSeek compaction as user handoff context - #33

Open
LukasAI wants to merge 1 commit into
fish2lab:mainfrom
LukasAI:fix/deepseek-post-compaction-replay
Open

LukasAI wants to merge 1 commit into
fish2lab:mainfrom
LukasAI:fix/deepseek-post-compaction-replay

Conversation

@LukasAI

@LukasAI LukasAI commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

What and why

DeepSeek automatic compaction can succeed, but the immediate continuation may fail with:

The reasoning_text in the thinking mode must be passed back to the API.

The issue occurs because DSCodex restores its synthetic DeepSeek compaction summary as an assistant message.

Automatic compaction resumes the same Codex turn without inserting another user message. If the restored compact summary is therefore the final assistant item while tools are enabled, DeepSeek interprets it as its own previous thinking turn and expects the corresponding reasoning_text.

A minimal live A/B reproduction confirmed the behavior:

  • compact summary as assistant + tools + no following user message → HTTP 400
  • identical request with the compact summary as user → HTTP 200

This change restores DSCodex-generated DeepSeek compaction summaries as user handoff context instead.

The GPT compaction replay path is unchanged.

The existing compaction regression test was also changed to match the real automatic-compaction flow: tools remain enabled and there is no artificial Continue user message after the compaction item.

After the patch, a real DSCodex synthetic compaction followed immediately by a tool-enabled DeepSeek continuation returned HTTP 200.

Checks

  • npm test passes locally
  • git diff --check is clean
  • Routing or CLI behavior changed: AGENTS.md, README.md, README.en.md, llms.txt and llms-full.txt updated to match
  • A bug fix comes with a regression test that fails without the fix
  • No API key, OAuth header or real rollout content in the diff

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