{"record":{"id":"3e7e45e7ee578c50","repo":"deepseek-ai/deepseek-harness","slug":"context-overflow-compaction-failed-after-durable-s","errorCode":null,"errorMessage":"context-overflow compaction failed after durable surface progress: ${message}; retrying from the replacement surface","messagePattern":"context-overflow compaction failed after durable surface progress: (.+?); retrying from the replacement surface","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/compaction/compaction-basic/src/index.ts","lineNumber":202,"sourceCode":"      this.overflowAgents.set(agent.session, agent)\n      const target = routedTarget(agent.session)\n      if (target === undefined) return next()\n      const policy = resolveTargetPolicy(this.config, target)\n      const retries = this.overflowRetries.get(agent) ?? 0\n      if (retries >= policy.maxOverflowRetries) return next()\n\n      const generation = agent.session.surface.replaceGeneration\n      let result: CompactionResult | null\n      try {\n        result = await this.compactIfNeeded(agent, 'context-overflow', signal)\n      } catch (recoveryError: unknown) {\n        const message = recoveryError instanceof Error ? recoveryError.message : String(recoveryError)\n        // A model-free prune can land before later summary work fails. That\n        // durable reduction is sufficient retry proof; do not discard it just\n        // because the optional second phase threw. Cancellation still wins.\n        // oxlint-disable-next-line typescript/no-unnecessary-condition -- the signal can abort while recovery is awaited.\n        if (!signal.aborted && agent.session.surface.replaceGeneration > generation) {\n          ctx.logger.warn(\n            `context-overflow compaction failed after durable surface progress: ${message}; `\n            + 'retrying from the replacement surface',\n          )\n          this.overflowRetries.set(agent, retries + 1)\n          return { kind: 'retry' }\n        }\n        ctx.logger.warn(\n          // oxlint-disable-next-line typescript/no-unnecessary-condition -- the signal can abort while recovery is awaited.\n          `context-overflow compaction failed: ${message}; ${signal.aborted\n            ? 'cancellation prevents retry'\n            : 'preserving the original request error'}`,\n        )\n        return next()\n      }\n      // oxlint-disable-next-line typescript/no-unnecessary-condition -- the signal can abort while compaction is awaited.\n      if (signal.aborted\n        || agent.session.surface.replaceGeneration <= generation) return next()\n      if (result !== null) logResult(result, 'context overflow recovery')","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/compaction/compaction-basic/src/index.ts#L184-L220","documentation":"Error \"context-overflow compaction failed after durable surface progress: ${message}; retrying from the replacement surface\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/compaction/compaction-basic/src/index.ts:202 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["No immediate action needed because compaction retries from the replacement surface; if it repeats, reduce context size or check the provider error."],"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"}