{"record":{"id":"6aaf8c2c295a752a","repo":"deepseek-ai/deepseek-harness","slug":"summary","errorCode":"summary","errorMessage":"manual compaction could not produce a smaller summary","messagePattern":"manual compaction could not produce a smaller summary","errorType":"exception","errorClass":"ManualCompactionError","httpStatus":null,"severity":"error","filePath":"packages/compaction/compaction-basic/src/region.ts","lineNumber":272,"sourceCode":"}\n\n/** Classify one closed manual attempt without weakening cancellation precedence. */\nfunction throwManualFailure(failure: TransactionFailure): never {\n  if (failure.stage === 'commit') {\n    throw new ManualCompactionError(\n      'commit',\n      'manual compaction did not commit cleanly',\n      { cause: failure.error },\n    )\n  }\n  if (failure.error instanceof SurfaceChangedError) {\n    throw new ManualCompactionError(\n      'changed',\n      'the compacted history changed during manual compaction',\n      { cause: failure.error },\n    )\n  }\n  throw new ManualCompactionError(\n    'summary',\n    'manual compaction could not produce a smaller summary',\n    { cause: failure.error },\n  )\n}\n\n/**\n * Reject a durable unmatched compaction marker unless a later constructor-seed\n * boundary proves that its owner belongs to an earlier session lifecycle.\n * @param unmatchedCompactionStart - latest unmatched opening marker, if any.\n * @param latestEndSeedSeq - newest constructor-seed boundary, if any.\n * @param stage - operation label included in the busy diagnostic.\n */\nfunction assertCompactionInactive(\n  unmatchedCompactionStart: SessionEvent<'compaction/start'> | undefined,\n  latestEndSeedSeq: number | undefined,\n  stage: string,\n): void {","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/compaction/compaction-basic/src/region.ts#L254-L290","documentation":"Thrown when a manual idle-session compaction (ctx.compaction.compactNow) fails while producing or validating its summary. The closing classifier puts every summary-stage failure that is not a changed-surface failure under code 'summary' and attaches the original error as `cause`. The conversation surface stays untouched; only the failed attempt (a compaction/start .. compaction/end pair carrying an error) remains in the session log.","triggerScenarios":"compactNow runs its auxiliary LLM summarization call and that call fails or its output is rejected: stream finish error/abort, MAX_TOKENS truncation ('summarization truncated at the token cap'), image output (UNSUPPORTED_CONTENT), no text content, or a framed summary that is not smaller than the shadowed span.","commonSituations":"maxTokens (default 8192) consumed by hidden reasoning tokens; provider outage or rate limit during the auxiliary call; compacting a span so short that checkpoint framing overhead rivals the content; a summarization model that restates the transcript near-verbatim.","solutions":["Inspect error.cause — it carries the original failure (code MAX_TOKENS, a provider error, or the shrink-check message) and selects the fix","If the cause is MAX_TOKENS truncation, raise BasicCompactionConfig maxTokens above the 8192 default","If the cause is 'summary is not smaller than the shadowed content', widen the compacted range so the summary can be strictly smaller","For transient provider failures (rate limit, 5xx), retry compactNow later — the failed attempt left the surface intact","Route summarization to a concise instruction-following model via summarizationProvider/summarizationModel"],"exampleFix":"// before\ntry {\n  await ctx.compaction.compactNow(agent, signal)\n} catch (error) {\n  throw error // opaque failure\n}\n\n// after\nimport { ManualCompactionError } from '@deepseek-ai/dsh-compaction'\ntry {\n  await ctx.compaction.compactNow(agent, signal)\n} catch (error) {\n  if (error instanceof ManualCompactionError && error.code === 'summary') {\n    report(`summarization failed: ${String(error.cause)}`)\n    return\n  }\n  throw error\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"import { ManualCompactionError } from '@deepseek-ai/dsh-compaction'\nconst isSummaryFailure = (error: unknown): error is ManualCompactionError =>\n  error instanceof ManualCompactionError && error.code === 'summary'","tryCatchPattern":"try {\n  await ctx.compaction.compactNow(agent, signal)\n} catch (error) {\n  if (isSummaryFailure(error)) {\n    report('compaction summary failed', { cause: String(error.cause) })\n    return // surface is intact; safe to stop or retry later\n  }\n  throw error\n}","preventionTips":["Set maxTokens above the summarizer's realistic reasoning-plus-text budget","Configure summarizationProvider/summarizationModel to a concise text model instead of relying on the conversation route","Do not compact spans only a few nodes long — framing overhead can rival the content","Treat error.cause as the real diagnostic; the wrapper only classifies the stage"],"tags":["compaction","summarization","manual-compaction","llm"],"backgroundTag":"context-compaction-failed","analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}