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)
- 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.
- 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).
- 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.
- 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.
- 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.
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 becontinued.
What happens (traced on current main)
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.
the failure is rethrown as
CredentialFailoverErrorwith thesenpi:no-turn-retry:prefix(any event after
startcounts as committed output).classifyRequiredCompactionFallbackFailure, so thedeterministic compaction fallback — which exists exactly for "summarization did not
complete" — never runs. It is not transient either, so the blocking compaction route
rethrows it.
(
agent-session.ts_isRetryableError/_isHardErrorFallbackEligible). The turn dieswith the raw internal marker as the user-visible error.
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
fallback checkpoint (retained-suffix safety checks unchanged) so the session continues.
a deterministic checkpoint was applied"), never the internal
senpi:no-turn-retry:marker.with the transcript unchanged.
Environment
large-context model (~1M window), long session near the compaction threshold.