Skip to content

Resuming a session drops reasoning_text from all earlier assistant messages (kimi-k3) #5006

Description

@dzamoshchin

Describe the bug

After --resume, earlier assistant messages are sent without their reasoning. With kimi-k3 (first-party, /chat/completions, not BYOK), a live session sends each assistant message's reasoning_text back on later requests. After resume, the same messages are sent without it. The same message across requests:

before resume: {"role": "assistant", "reasoning_text": "Let me run the test and look at stats.py.", "tool_calls": [...]}
after resume:  {"role": "assistant", "tool_calls": [...]}

The reasoning is still in the session's events.jsonl (reasoningText), so it is removed when the session is loaded, not lost when saved. Setting COPILOT_STRIP_REASONING_ON_RESUME=false keeps it.

Kimi K3 is trained with its reasoning preserved across turns, so after a resume it sees every earlier turn with empty reasoning. In our tests, K3 produced no reasoning on any request after a resume.

Separately, on the first request after resume, earlier tool_calls[].function.arguments are re-serialized compactly ({"command": "…"} becomes {"command":"…"}). That breaks prompt caching at the first assistant message.

Affected version

1.0.90-5

Steps to reproduce the behavior

  1. Run copilot -p "..." --model kimi-k3 --reasoning-effort high --allow-all-tools --no-ask-user --log-level all --log-dir logs1 with a prompt that produces a few tool calls
  2. Run copilot --resume=<session-id> -p "..." with the same flags and --log-dir logs2
  3. Compare the Wire request: bodies: in logs1, assistant messages carry reasoning_text; in the first request in logs2, the same messages have none

Expected behavior

A resumed session sends the same assistant history, including reasoning_text, as the live session did.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:modelsModel selection, availability, switching, rate limits, and model-specific behaviorarea:sessionsSession management, resume, history, session picker, and session state

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions