Skip to content

A summarization stream terminated by a provider error is not fallback-authorized, so the session stays uncontinuable and repeats an internal retry-suppression marker #1741

Description

@code-yeongyu

Bug

During automatic compaction the summarization stream ran for over 690 seconds. When it
finally failed, the session did not recover: every subsequent prompt ended with the raw
internal marker error senpi:no-turn-retry:Codex error: …, and the session could not be
continued.

What happens (traced on current main)

  1. The summarization wall-clock budget is size-scaled: max(120s, 2ms × estimated input tokens),
    capped at 30 minutes (packages/coding-agent/src/core/compaction/stream-watchdog.ts).
    An input of ≥345k estimated tokens — normal for a ~1M-context model, whose summarization
    input may be 60% of the window — makes a 690s+ stream legal. The 300s idle watchdog never
    fires on a stream that keeps trickling deltas.
  2. When the provider stream fails after partial output on a provider with a credential pool,
    the failure is rethrown as CredentialFailoverError with the senpi:no-turn-retry: prefix
    (any event after start counts as committed output).
  3. That error class is not recognized by classifyRequiredCompactionFallbackFailure, so the
    deterministic compaction fallback — which exists exactly for "summarization did not
    complete" — never runs. It is not transient either, so the blocking compaction route
    rethrows it.
  4. At the session layer the marker prefix disables both auto-retry and model fallback
    (agent-session.ts _isRetryableError / _isHardErrorFallbackEligible). The turn dies
    with the raw internal marker as the user-visible error.
  5. Because compaction never applied, the context stays above the threshold, and the next
    prompt re-enters required compaction and fails identically — the marker error repeats on
    every attempt; nothing (including the circuit breaker, which only debits transient
    failures) interrupts the loop.

Expected

  • Any terminal summarization failure on a required-compaction route applies the deterministic
    fallback checkpoint (retained-suffix safety checks unchanged) so the session continues.
  • The user sees an actionable message ("compaction could not complete a provider summary;
    a deterministic checkpoint was applied"), never the internal senpi:no-turn-retry: marker.
  • If no safe suffix exists, show the existing deterministic-fallback recovery guidance once,
    with the transcript unchanged.
  • Total compaction wall time per turn stays bounded regardless of input size.

Environment

  • CLI coding agent, current main; openai-codex provider (credential pool, 2+ keys),
    large-context model (~1M window), long session near the compaction threshold.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions