Skip to content

Context compression failed #6981

Open
Open

Description

@luestr

Before you start

  • I searched existing issues and this is not a duplicate. 我已搜索过现有 issue。

What happened? 发生了什么?

Context compression failed and encountered an error.

Warn 本回合失败: Making room failed: Chat API response missing choices

If you try to establish a new session at this time, it will fail, including using /new --force to create the session.

Note Error: Cannot start a new session while runtime work is active. Wait for the current turn, maintenance, and background tasks to finish, or cancel that specific work. /new --force only discards draft or queued input.

Steps to reproduce 复现步骤

After the session is completed, perform the context compression operation.

Codewhale version 版本

0.10.1

Where did it happen? 在哪里出现?

TUI (terminal interface)

Operating system 操作系统

Windows

How did you get Codewhale? 获取方式

Scoop / Nix / Docker / other package

Provider and model 提供商和模型

DeepSeek-v4.1-flash by Cline

Terminal and shell 终端

Windows Terminal

codewhale doctor (optional)

My model is accessed through the [Sub2API v0.2.16](https://github.com/Wei-Shaw/sub2api/releases/tag/v0.2.16) gateway, and the model service provider is Cline. Normal sessions have not encountered any errors.

Logs, screenshots, anything else (optional)

No response

Activity

  1. added
    needs-triageNew external report awaiting maintainer triage; repro, logs and version output help
    on Oct 15, 2026
  2. Hmbown commented on Oct 15, 2026

    @Hmbown
    Collaborator

    Thanks for including the Sub2API/Cline route and the fact that ordinary conversations still work. Compaction sends a non-streaming request (stream: false); this particular error means the returned JSON has no choices array. The response shape is still unknown, so we have not identified a gateway compatibility fix.

    Could you share the failed compaction response’s HTTP status, Content-Type and top-level JSON keys (or a sanitized error object), plus whether any background agent or shell job remains queued/running when /new is refused? Please omit credentials and conversation content.

    The source already has a failure-settlement path, but that does not prove which state remains active on your machine. #6948, carried in the 0.10.2 candidate #6968, names the specific blockers. If you are testing a build containing 5530db9, the full refusal text and any named task IDs would narrow this down. That change improves diagnosis; we have not reproduced or verified a fix for this Windows case, and 0.10.2 is not released. Keeping this open.

  3. luestr commented on Oct 16, 2026

    @luestr
    Author

    @Hmbown I provided the response headers and the desensitized response body. Additionally, when this issue occurred, only this program was running, and there were no other background tasks.

    HTTP/1.1 200 OK
    Content-Type: application/json
    Date: Fri, 16 Oct 2026 01:22:41 GMT
    Referrer-Policy: strict-origin-when-cross-origin
    Vary: Origin
    X-Client-Request-Id: 889d0f82-2d5e-4dd4-a688-9dcce8aab31d
    X-Content-Type-Options: nosniff
    X-Frame-Options: DENY
    X-Request-Id: 5ffac1de-fbcd-4ec7-a768-bbec882db2b3
    X-Request-Id: VnWBxBiUehHcREuvzpRTIewPevaJAPaj
    Transfer-Encoding: chunked
    
    {
      "data": {
        "choices": [
          {
            "finish_reason": "stop",
            "index": 0,
            "logprobs": null,
            "message": {
              "content": "",
              "provider_metadata": {
                "deepseek": {
                  "choiceIndex": 0,
                  "messageRole": "assistant",
                  "promptCacheHitTokens": 440704,
                  "promptCacheMissTokens": 221,
                  "responseObject": "chat.completion",
                  "systemFingerprint": ""
                },
                "gateway": {
                  "cost": "0.006021324",
                  "gatewayCost": "0.006021324",
                  "generationId": "gen_01M514V8JBGMY34W3X39D07J12",
                  "inferenceCost": "0.006021324",
                  "inputInferenceCost": "0.002710524",
                  "marketCost": "0.006021324",
                  "outputInferenceCost": "0.0033108",
                  "routing": {
                    "affinity": {
                      "outcome": "confirmed",
                      "pinnedProvider": "deepseek"
                    },
                    "canonicalSlug": "deepseek/deepseek-v4.1-flash",
                    "clientSessionId": "sess-48704921372f1415cf60c8c2108ac181",
                    "clientSessionIdSource": "explicit",
                    "fallbacksAvailable": [
                      "fireworks",
                      "baseten",
                      "alibaba",
                      "runware",
                      "particle",
                      "novita",
                      "togetherai",
                      "deepinfra",
                      "wafer",
                      "parasail",
                      "gmicloud",
                      "modal",
                      "morph",
                      "runinfra",
                      "boundless",
                      "inference-net",
                      "relace"
                    ],
                    "finalProvider": "deepseek",
                    "modelAttemptCount": 1,
                    "modelAttempts": [
                      {
                        "canonicalSlug": "deepseek/deepseek-v4.1-flash",
                        "providerAttemptCount": 1,
                        "providerAttempts": [
                          {
                            "credentialType": "system",
                            "endTime": 1792113761841,
                            "provider": "deepseek",
                            "providerRequestId": "5fcab564b4b6cfb7d0fd384dcb5956dc",
                            "providerResponseId": "270405c5-b93c-4bf3-8eb8-5c2330b0c2d3",
                            "startTime": 1792113746605,
                            "statusCode": 200,
                            "success": true
                          }
                        ],
                        "success": true
                      }
                    ],
                    "originalModelId": "deepseek/deepseek-v4.1-flash",
                    "planningReasoning": "System credentials planned for: deepseek, fireworks, baseten, alibaba, runware, particle, novita, togetherai, deepinfra, wafer, parasail, gmicloud, modal, morph, runinfra, boundless, inference-net, relace. Total execution order: deepseek(system) → fireworks(system) → baseten(system) → alibaba(system) → runware(system) → particle(system) → novita(system) → togetherai(system) → deepinfra(system) → wafer(system) → parasail(system) → gmicloud(system) → modal(system) → morph(system) → runinfra(system) → boundless(system) → inference-net(system) → relace(system)",
                    "resolvedProvider": "deepseek",
                    "totalProviderAttemptCount": 1
                  },
                  "surchargeCost": "0"
                }
              },
              "role": "assistant"
            }
          }
        ],
        "created": 1792113761,
        "generationId": "gen_01M514V8JBGMY34W3X39D07J12",
        "id": "gen_01M514V8JBGMY34W3X39D07J12",
        "model": "deepseek/deepseek-v4.1-flash",
        "object": "chat.completion",
        "system_fingerprint": "",
        "usage": {
          "cache_creation_input_tokens": 0,
          "completion_tokens": 2759,
          "completion_tokens_details": {
            "image_tokens": 0,
            "reasoning_tokens": 0
          },
          "cost": 0.003010662,
          "cost_details": null,
          "gateway_cost": 0.006021324,
          "is_byok": false,
          "market_cost": 0.006021324,
          "prompt_tokens": 440925,
          "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 440704,
            "video_tokens": 0
          },
          "total_tokens": 443684
        }
      },
      "success": true
    }
    
  4. Hmbown commented on Oct 16, 2026

    @Hmbown
    Collaborator

    Thank you @luestr. The response headers and sanitized body were exactly what was needed. They show the gateway returning HTTP 200 with the completion wrapped as {"data": {"choices": ...}, "success": true}. Codewhale's non-streaming parser only read a top-level choices, so every non-streaming call on that route failed with "Chat API response missing choices". That includes compaction ("Making room failed"), the doctor live probe and review. Streaming turns use a different parser, which is why ordinary conversation kept working.

    a38062b (on main) reads id, model, choices and usage from data only when all three of these hold:

    • top-level choices is absent;
    • success is the boolean true;
    • data.choices is an array.

    Standard responses parse as before, and an envelope with success: false still reports an error. The fix is part of the 0.10.2 release candidate (9f25ef0). That candidate is still in testing and not released yet.

    What was verified:

    • I ran a local mock gateway that returns your body shape. The current 0.10.2 development build reproduces your exact error, and the fixed build compacts the session ("Made room: 2 → 4 messages").
    • doctor --probe-local fails before the fix and passes after it.

    It was not tested against a real Sub2API/Cline gateway or on Windows. When 0.10.2 is out, a quick confirmation on your setup would be very welcome.

    The /new refusal you saw after the failed compaction ("Cannot start a new session while runtime work is active") is a separate problem, and this fix does not change it. We will follow up on it in this issue.

    简要:a38062bd07 修复了网关以 {data, success} 包装非流式响应导致的上下文压缩失败。该修复将包含在尚未发布的 0.10.2 中;压缩失败后 /new 被拒绝的问题会在本 issue 中另行跟进。

    — Written by Claude Opus 5.5 (AI agent) on behalf of the maintainers.

  5. luestr commented on Oct 16, 2026

    @luestr
    Author

    @Hmbown I will wait for the new version to be released and then test and verify it as soon as possible.

  6. Hmbown commented on Oct 16, 2026

    @Hmbown
    Collaborator

    Follow-up on the /new refusal ("Cannot start a new session while runtime work is active") that @luestr reported alongside the compaction failure.

    We found one way a session gets stuck there. A "Making room…" pass may still be running or queued when Codewhale replaces its engine. That happens when you switch provider, model route, profile or workspace, when plugins reload, or when Codewhale falls back or rolls back to another provider. The old engine's result then never reaches the session, so the session keeps treating compaction as active. /new, /resume and /compact are refused until restart. 8f54845 and 856eefa (on main) stop or settle the old pass when the engine is replaced. The transcript then shows "Making room stopped; the conversation was not changed", and /new works again.

    This is not in 0.10.2, which is already frozen. It is queued for the release after it. It was checked with focused tests and a TUI run that switched provider during Making room. It has not been checked on Windows or against your gateway.

    We have not confirmed this is the path you hit. Between the failed compaction and /new, did you switch provider or model, or did Codewhale move to another provider? If neither happened, a short note on what you did in between would help us find the remaining path.

    简要:在“Making room…”进行或排队时若引擎被替换(切换服务商、模型、配置或工作区,插件重载,或自动回退到其他服务商),会话会一直认为压缩仍在进行,从而拒绝 /new。8f54845f78 / 856eefa(已在 main)修复了这一路径,但不在已冻结的 0.10.2 中,会随下一个版本发布。我们尚未确认这就是你遇到的情况:在压缩失败和 /new 之间,你是否切换过服务商或模型,或者 Codewhale 是否切换到了其他服务商?

    — Written by Claude Opus 5.5 (AI agent) on behalf of the maintainers.

  7. luestr commented on Oct 16, 2026

    @luestr
    Author

    @Hmbown I've never switched service providers or models.

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

    bugSomething isn't workingneeds-triageNew external report awaiting maintainer triage; repro, logs and version output help

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions