Skip to content

Responses compaction: restore Pi-style active-window behavior; remove archive backfill and serial batching #1459

Closed

Description

@AnthonyRonning

Problem

Server-side Responses compaction has drifted from the intended Pi-style behavior in two fundamental ways:

  1. It reaches past the existing sliding-window boundary and tries to recover older stored history into the first compaction summary. Enabling compaction on an established conversation can therefore turn the next user request into an attempt to process a multi-million-token archive.
  2. It compacts through serial history batches and smaller summary fragments, repeatedly folding partial summaries together. The intended operation was to summarize the bounded model-visible context coherently, not to run an archive-processing pipeline before answering.

These are design/initialization problems, not merely a timeout that should be increased. The owner has explicitly clarified that retroactively backfilling history excluded by previous sliding windows and processing compaction in arbitrary batches are unwanted behavior.

Intended contract

  • Establish the same active/model-visible context boundary that the sliding-window path would use, including its model budget, current instructions, required input and complete tool relationships.
  • Compact the older portion of that active context, retaining the appropriate recent tail verbatim. When a prior checkpoint exists, update it with the newly selected active history.
  • Generate a coherent summary in one normal summarization operation for that bounded input. Do not substitute arbitrary 64k serial batch/fold loops. Pi's distinct split-turn handling is a separate semantic case, not a justification for archive chunking.
  • Keep older canonical records available for history/retrieval without pulling them back into the first summary. Preserving database history is not the same requirement as summarizing all database history.
  • Enabling the feature must not expand a conversation's model-visible history scope. A deliberate history-recovery feature would need separate product approval and its own design.

What the implementation does

The inspected deployed source is c3b8ad45c2cf1c0512fa34c1981500aedad0de42.

  • The compaction path builds an uncovered-source snapshot and plans from its older eligible history, without first applying the previous sliding-window boundary. Without a checkpoint, previously excluded archived history becomes compaction work.
  • History batches target min(64_000, context_window / 2) estimated tokens. Atomic source groups can exceed the target; there is also a source-byte batching target.
  • Selected batch messages are serialized and partitioned again using a conservative byte limit, then checked against the helper-input estimate. The helper receives a fragment plus the running summary; each subsequent fragment depends on the preceding result.
  • The executor publishes a checkpoint after the selected batch's fragments finish, then can plan another history batch while the projected prompt remains over budget. An incomplete batch does not produce a durable checkpoint, so a later request can repeat work already paid for.
  • All initial preparation shares a five-minute deadline after Response acceptance. The main answer cannot begin until preparation succeeds. A timed-out attempt can use the complete uncompressed prompt only if it still fits; the oversized cases consequently fail.
  • Helpers inherit the selected model's reasoning policy and normal generation allowance. This is not independently proof of a bug or the sole latency cause, but it makes representative validation important.

Source: planning and orchestration, history batch planner, serial fragment executor, helper policy.

Production observations

A limited pilot on November 4, 2026 Pacific was rolled back after the following observations. These are aggregate operational metadata; no conversation content or summary plaintext was inspected.

  • Seven logical Responses attempted helper work: five failed, one was cancelled, and one completed using uncompressed fallback. Stored Response status independently confirmed all five failures, affecting two users.
  • A GLM Flash attempt planned approximately 3.24M tokens against a 1.05M input budget. Its first two summary fragments completed in 120.3s and 153.2s. The third was interrupted about 25s later by the shared preparation deadline. No checkpoint from that batch was published. A subsequent attempt again started the same initial source fragment.
  • A Kimi attempt planned approximately 4.13M tokens against a 262k input budget. It published generations 1 and 2, but the estimated remaining projection was still about 4.01M tokens. The logical Response failed at approximately 306s. Checkpoint publication did not establish successful end-to-end compaction or a successful answer.
  • Two GLM attempts planned approximately 753k tokens against a 262k input budget. Their first helpers remained pending until the roughly 300s preparation deadline.
  • The completed fallback case still spent approximately 300s in preparation before answering without a new checkpoint.
  • The quick contemporaneous comparison with users outside the pilot did not show the same compaction-preparation failure pattern on comparable models. Subsequent rollback observations confirmed new pilot requests returning to the legacy path with zero helper/preparation work.

Timing qualification: the confirmed mechanism is expiration of the preparation deadline. Completed helper calls had correlated provider completion events; a helper still pending at the deadline does not prove every elapsed second was active model generation. Streaming termination, delivery/backpressure and generation/reasoning time need separate attribution. A later ten-minute logical Response deadline also occurred with compaction disabled and zero helpers; that is a separate failure and must not be counted as a recurrence of this incident.

Where the Pi comparison broke down

The pinned upstream Pi implementation operates on the current session projection, selects an older portion to summarize, retains a recent tail, and incorporates the previous summary. Its ordinary path makes one history-summary call; a split-turn case can additionally summarize the turn prefix. It accepts the selected thinking setting and uses the model's output allowance.

That supports the general summary-plus-recent-context approach. It does not justify our server-specific decision to bring history outside prior sliding windows back into scope, or the arbitrary repeated batch/fragment pipeline used to process that archive. Borrowing Pi's prompt and headings did not preserve its surrounding context-selection behavior.

Reference: pinned Pi preparation and compaction.

The roughly 20k recent-token setting is one verbatim suffix in the final answer context, not a per-helper allowance. Whole tool-call/result relationships must remain coherent at the selection/coverage boundary; older exchanges may be summarized rather than retained byte-for-byte. Canonical records remain stored regardless.

Validation and design-review gaps

  • Earlier real-model validation primarily used smaller synthetic/archive workloads with DeepSeek and reasoning disabled. It did not establish that the production model/settings and existing over-window conversations could complete this path within its preparation deadline.
  • Protocol, encryption, persistence, cancellation and reload successes were stronger evidence for lifecycle correctness than for the appropriateness of the context-selection design or real request latency.
  • Preserving canonical history was overextended into preserving/recovering all historical material in the first summary. This expanded feature scope and amplified the serial batching problem.
  • The two published checkpoints inside a failed Response illustrate why helper success/publication must be evaluated separately from the main answer outcome.

Required correction and acceptance criteria

  • Define and implement an explicit active-context boundary for first enablement and later compactions; previously windowed-out archive entries must not become summary inputs.
  • Remove arbitrary serial history-batch/fragment folding from the normal compaction design. Summarize the bounded selected context coherently, following Pi's actual semantic boundaries.
  • Keep archive retention/retrieval separate from model-context compaction. Do not replace this issue with a resumable archive-backfill feature, smaller batches, or a longer timeout.
  • Add synthetic regression coverage where stored history greatly exceeds the model window: archived sentinels outside the active boundary must be absent from the helper prompt, while active facts, current input and tool relationships are preserved.
  • Verify summary-plus-retained-tail context fits the chosen model, including ordinary overhead/output reservation, without changing the caller's main-answer allowance.
  • Test realistic model/reasoning settings, slow or stalled helper streams, cancellation, typed failure, persistence and subsequent checkpoint reuse. Distinguish total preparation time from individual upstream generation/stream timing.
  • Require successful main Responses and subsequent reuse/recall evidence; helper completion or a saved checkpoint alone is insufficient.

Related implementation work: #1184 and #1363. This issue documents the redesign and observed failures; it does not authorize a new rollout or production changes.

Activity

  1. added a commit that references this issue on Nov 16, 2026
    f09df6b
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