{"record":{"id":"7063bcac23cbc8f8","repo":"deepseek-ai/deepseek-harness","slug":"compaction-still-above-threshold-after-spec-comp","errorCode":null,"errorMessage":"compaction still above threshold after ${spec.compactionRetries + 1} compaction attempts (${measurement.totalTokens} estimated tokens >= threshold ${spec.thresholdTokens})","messagePattern":"compaction still above threshold after (.+?) compaction attempts \\((.+?) estimated tokens >= threshold (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/compaction/compaction-basic/src/index.ts","lineNumber":328,"sourceCode":"      measurement = meter.measure(agent.session)\n    }\n    if (measurement.totalTokens < spec.thresholdTokens) return null\n\n    let result: CompactionResult | null = null\n    for (let attempt = 0; attempt <= spec.compactionRetries; attempt += 1) {\n      const range = selectCompactableRange(agent.session, measurement, spec.retainTokens)\n      if (range === null) {\n        /* v8 ignore else -- concrete replacement preserves a compactable checkpoint; subclass hooks cannot mutate it. */\n        if (result === null) return null\n        /* v8 ignore next -- paired with the defensive post-success branch above. */\n        break\n      }\n      result = await this.compactRegion(range.start, range.end, agent, signal)\n      measurement = meter.measure(agent.session)\n      if (measurement.totalTokens < spec.thresholdTokens) return result\n    }\n\n    throw new Error(\n      `compaction still above threshold after ${spec.compactionRetries + 1} compaction attempts `\n      + `(${measurement.totalTokens} estimated tokens >= threshold ${spec.thresholdTokens})`,\n    )\n  }\n\n  /**\n   * Compact one inclusive positional range from the agent-owned surface using\n   * the effective token meter for all retention and shrink pricing.\n   * @param start - inclusive first surface-node seq.\n   * @param end - inclusive last surface-node seq.\n   * @param agent - owner of the target session, used by the summarizer.\n   * @param signal - optional summarization cancellation signal.\n   * @returns the successful durable compaction result.\n   */\n  override async compactRegion(\n    start: number,\n    end: number,\n    agent: Agent,","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/compaction/compaction-basic/src/index.ts#L310-L346","documentation":"Error \"compaction still above threshold after ${spec.compactionRetries + 1} compaction attempts (${measurement.totalTokens} estimated tokens >= threshold ${spec.thresholdTokens})\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/compaction/compaction-basic/src/index.ts:328 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Lower the threshold, increase compactionRetries, or reduce the context size before compacting."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}