Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Code Agent Dissection (10): When the Agent Crashes, How Does It Recover? Where Is Conversation History Stored?

Описание и применение

Модель MyCodeAgent использует поток событий в формате JSONL для восстановления истории диалога и состояния инструментов после аварийного завершения процесса, устраняя потерю данных и неполные изменения файлов.

Задача

Agent conversation history is lost on crash and tool calls may leave files in an inconsistent state.

Результат

Using an event‑stream transcript, MyCodeAgent restores conversation history and tool state after crashes, eliminating data loss and inconsistent file edits.

Рабочий процесс

  • 1. Agent emits events (message, state_transition, tool_lifecycle, checkpoint, terminal).
  • 2. RuntimeRunner forwards events to CompositeRuntimeEventSink.
  • 3. CompositeRuntimeEventSink writes events to two sinks: TraceRuntimeEventSink (debug) and TranscriptRuntimeEventSink.
  • 4. TranscriptRuntimeEventSink records events via TranscriptRecorder.
  • 5. TranscriptRecorder appends each event to a JSONL file using TranscriptStore.append_event().
  • 6. TranscriptStore repairs any incomplete trailing line before writing.
  • 7. On restart, the agent reads the transcript file, replays events to rebuild HistoryManager and tool state.

Доказательства

Once the process crashes — network timeout, OOM, Ctrl+C — all that history is gone.

Источник

MyCodeAgent solves both problems with Transcript: continuously writing all key facts to an append‑only JSONL file, then rebuilding runtime state from the file after a crash.

Источник

  • Дата записи: 2026-09-06T21:36:54.176Z