Skip to content

[Bug][High impact] 2.6.0 late replay takes 88.9s: per-event deep cloning regression #4917

Open

Description

@WilliamLambertCN

Summary / urgent triage request

High-impact 2.6.0 regression: an isolated reproduction of late conversation attachment took 88.873 s,
including 67.880 s in 7,439 full-state structuredClone calls. Users can wait over a minute even on localhost.

Current status: during report preparation I found that 2.6.1 already shipped the opt-in mutable replay fix
for kap.conversation via #4888, also merged to main as #4893. This report supplies independent 2.6.0 evidence;
it does not claim the normal conversation path remains broken in 2.6.1.
The default non-mutableReplay participant path still contains per-record deep cloning by source inspection,
but I have not runtime-tested 2.6.1 or reproduced a remaining user-visible stall there.

@kimi-agent-bot: please correlate this report with #4885 / #4888 / #4893 and confirm the shipped fix covers
restore, late attach, reconnect, undo, and failure recovery. Please prioritize guidance for affected 2.6.0 users.

Version, platform, model

  • Incident: 2.6.0, native Windows x64 CLI, kimi web --host; native Web remained slow after removing a proxy.
  • Isolated reproduction: exact official npm @moonshot-ai/[email protected], commit
    740d6c0bdd777cd8ed0d91eb3d62766910401173, in a network-disabled Linux container with a temporary home.
  • Actual official npm bundles compared: 2.5.2 / 2.5.3 / 2.6.0.
  • Same-version Windows native/npm cold-load controls were also exercised.
  • Subscription/model: not applicable; no model prompts or provider requests are needed for the reproduction.
  • 2.6.1 source inspected only; it has not been installed or validated against this incident.

User-visible impact and transport evidence

A previously captured HTTP/WS trace showed:

  • HTML: approximately 7 ms.
  • Older-history request: 61,928 ms waiting for local official backend response headers.
  • Payload: 1,764,993 raw bytes / 577,691 gzip bytes, not the entire several-hundred-MB session.
  • After upstream headers arrived, proxy delivery completed in approximately 65 ms.
  • An overlapping WebSocket handshake waited 42,670 ms.

This locates the wait at the local upstream service rather than full-session network transfer.
It does not identify the function responsible for that particular incident. No data loss or security exploit is alleged.

Confirmed introduction point

Inside EventDispatcherService.attachLateNow(), for every applicable historical event:

// Official 2.5.2 and 2.5.3
const next = produce(attachment.getState(), draft => applier(draft, event, ctx));

// Official 2.6.0
const next = produce(structuredClone(attachment.getState()), draft => applier(draft, event, ctx));

The full-state deep clone is inside the history loop: the growing accumulated state is copied again for each event.

Isolated reproduction and measured results

This deliberately exercises the late-attachment path; it does not prove ordinary refresh always reaches that path.

  1. Run the exact official npm 2.6.0 backend in an isolated home, without real config, credentials, or external networking.
  2. Supply tool-heavy history. The measured private, derived main-agent sample was about 48 MB / 13,581 retained records.
    Its contents are not attached publicly.
  3. In the diagnostic copy only, suppress ConversationService's early onDidCreateScope attachment.
    Request the feed after restore, forcing attachLate() / attachLateNow().
  4. Measure late attachment and clone calls separately; also request a latest page and probe health responsiveness.
  5. Compare with normal early attachment and an experimental copy replacing the late-loop expression with
    replayImmer.produce(attachment.getState(), ...).
Isolated condition Measured result
Normal early attachment, same input HTTP latest page 4.199 s
Forced late attachment, original 2.6.0 attachLateNow(kap.conversation) 88.873 s
Deep clones within that late stage 7,439 calls / 67.880 s cumulative
HTTP request during original late reproduction Failed at unchanged 90 s diagnostic budget
Experimental no-per-event-deep-clone copy Late stage 2.519 s, HTTP latest page 4.784 s

The timeout remains recorded as a failure; it was not hidden by increasing the budget.
The one-line experiment isolates the cost, not a production-ready fix: undo/checkpoints, immutable published state,
failed-replay isolation, and live-event ordering require validation. Upstream's staged mutable replay is relevant here.

Evidence limits

  • Confirmed: the deep-copy loop was added after 2.5.3 and can cause severe late-attachment stalls in released 2.6.0.
  • Unconfirmed: the historical 61.9 s incident naturally took that late-attachment path.
  • A coordinated live CPU capture was subsequently made, but the user reported fast loading on that attempt.
    It showed ordinary replayRecords -> applyConversationRecord -> findToolCall/upsertToolCall -> Immer shallowCopy,
    not late-attach deep cloning. This is a normal-load baseline, not a capture of the minute-long incident.
  • Same-version Windows native/npm and concurrent multi-agent controls alone did not reproduce the minute-long delay.
  • Production was not restarted or patched. Temporary loopback-only CPU profiling was closed afterward;
    the original service process was preserved.

Expected behavior / requested follow-up

  1. Please confirm the released 2.6.1 fix covers this 2.6.0 regression and advise affected users to update if appropriate.
  2. Triage the remaining default non-mutableReplay late-participant path separately.
    Its clone must not be mistaken for evidence that fixed kap.conversation still uses it.
  3. Retain coverage for tool-heavy restore/late attach, custom undo/checkpoints, failed-replay isolation,
    terminal deep freezing, and subsequent live dispatch.
  4. Reconcile open fix(agent-core-v2): avoid quadratic cloning during session replay #4885 with already merged/shipped fix(agent-core-v2): stage opt-in mutable replay for conversation participant #4888 / fix(agent-core-v2): stage opt-in mutable replay for conversation participant #4893; an open PR alone does not mean the fix is unreleased.

Contribution

  • Willing to submit a focused follow-up PR for a remaining issue after a maintainer's /approve.
  • I have read the contribution policy. Since the main conversation fix already shipped, this report provides
    independent evidence instead of opening a duplicate implementation PR.

Only aggregate measurements and public code references are included.
No real session IDs, conversation text, workspace paths, network addresses, credentials, raw profiles, or private logs
are attached.

Activity

  1. changed the title [-][Bug][High impact] 2.6.0 late replay takes 88.9s: per-event deep cloning regression; correlate 2.6.1 fix[/-] [+][Bug][High impact] 2.6.0 late replay takes 88.9s: per-event deep cloning regression[/+] on Nov 13, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions