zai-org / zai-org/feedback

[Bug] /compact aborts with no retry when an external OpenAI-compatible model's stream drops (WebSocket close 1006) — GPT-6 Astra fails, GPT-5.6 Sol succeeds

Open
#591 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

提交前确认 · Pre-submission checklist
  • I searched existing issues and confirmed this isn't a duplicate (checked is:issue compact; #524 covers request-rebuild context trimming, not compaction retry).
  • I've read CONTRIBUTING.md.
问题类别 · Category

对话 / Agent 交互 · Agent chat

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

影响体验 · Major (works but degraded)

复现频率 · Reproducibility

偶现 · Sometimes (model slowness is consistent; the hard failure depends on a transport drop)

问题描述 · Description

Running /compact on a long session while using an external OpenAI-compatible model (OpenAI GPT-6 Astra via a local OpenAI-compatible proxy, configured through the official third-party provider path in model settings):

  • With GPT-5.6 Sol (same provider, same endpoint), compaction completes normally: ~2m47s on a session with ~266k tokens before compaction, reasoning effort low.
  • With GPT-6 Astra, the summary streams much more slowly (~141 chars/s vs ~255 chars/s for Sol on the same history). In one attempt the stream dropped mid-summary with WebSocket close 1006 and the whole compaction aborted. In another attempt it was still streaming after ~3m48s when I cancelled it. The session stays un-compacted.

The same provider/endpoint works for normal turns and for Sol compaction, so this is not a provider-config problem. It looks like compaction performs a single attempt with no retry on transient transport failures, so one dropped connection mid-summary kills the entire compaction.

复现步骤 · Steps to reproduce
  1. Configure an external OpenAI-compatible provider (mine: a local OpenCodex proxy in front of OpenAI models) and select GPT-6 Astra.
  2. Grow a session to a large context (~266k tokens before compaction).
  3. Run /compact.
  4. Observe the summary streaming slowly; if the connection drops mid-stream (e.g. WebSocket close 1006), compaction fails and no retry happens.
期望表现 · Expected behavior
  • Transient transport failures (429 / 5xx / dropped stream) during compaction should be retried with backoff instead of aborting the whole compaction.
  • Ideally, also consider a compaction timeout/retry policy or a configurable compaction model for slow external models.
实际表现 · Actual behavior

Compaction aborts on the first transport drop. With a slow model the summary stream stays open long enough that drops become likely, so /compact effectively cannot complete. Current workaround: switch the model to GPT-5.6 Sol, run /compact, then switch back.

ZCode 版本 · ZCode version

3.11.2 (3.11.2.6792) — the latest release as of 2026-09-09; bundled CLI harness reports 0.16.5.

设备 / 系统 / 浏览器 · Device / OS / Browser

Apple Silicon Mac, macOS, ZCode desktop

截图 / 录屏 / 日志 · Screenshots / Recordings / Logs

Measured on the same ~266k-token session, reasoning effort low in both runs:

Model First streamed content Total Summary chars Speed
GPT-6 Astra 9.5s >3m48s (cancelled; an earlier run aborted with WebSocket close 1006) 30,879 ~141 chars/s
GPT-5.6 Sol 12.4s 2m47s (success) 39,468 ~255 chars/s

Upstream context that looks directly relevant:

  • opencode had the same gap and fixed it on 2026-09-07 in anomalyco/opencode#47806: "Provider compaction made exactly one llm.compact attempt, so a transient 429/5xx/transport failure on the trigger call failed the compaction." Compaction calls are now retried with backoff, which is safe because nothing is installed until the provider returns a checkpoint. ZCode's compaction summary prompt matches opencode's, so the machinery looks related and the same fix pattern should apply.
  • openai/codex#43038 tracks GPT-6 Astra compaction being 3–5x slower than Sol on the model side, which lengthens the stream window during which a drop can occur.

Happy to share session logs or timings if that helps.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the /compact command into the compaction provider call and its streaming error handling; the issue does not name repository files or tests. Compare the behavior with anomalyco/opencode#47806. Done means transient 429, 5xx, and dropped-stream failures retry with backoff without losing the session's un-compacted state.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.