Project

General

Profile

Actions

Задача #19

closed
HU

Эпик #6: Architecture

B1: Abort mid-tool — orphaned entities

Задача #19: B1: Abort mid-tool — orphaned entities

Added by Hardelele User about 7 hours ago. Updated 22 minutes ago.

Status:
Закрыта
Priority:
Высокий
Assignee:
-
Start date:
02/16/2026
Due date:
% Done:

100%

Estimated time:

Description

При abort mid-tool-execution остаются orphaned entities в БД. AgentRunner singleton, abort между tool executions а не внутри транзакций. Нужен cleanup step после abort.

HU Updated by Hardelele User about 3 hours ago Actions #1

  • Status changed from Новая to В работе

Частично реализовано: транзакции для tool execution, orphan cleanup в merge_blocks, abort signal checks по всему runner. НЕ реализовано: post-abort cleanup handler, session cleanup при обрыве, global transaction wrapping. ~50% готово.

HU Updated by Hardelele User about 2 hours ago Actions #2

Начата работа: исследование abort flow и orphaned entities для реализации cleanup.

HU Updated by Hardelele User about 2 hours ago Actions #3

  • Status changed from В работе to Решена
  • % Done changed from 0 to 100

Implemented abort-safe entity handling:

  1. Entity tracking in runner: Track all created entity IDs (blocks, events, lore, traits, fragments, characters) during run via createdEntityIds map.

  2. Atomic event effects: Moved event effects (add_trait, remove_trait, set_location) INSIDE the $transaction in narrator.executor.ts. Previously effects were outside the transaction, causing partial state on failures.

  3. Proper abort handling: On abort, runner now logs created entities, saves abort summary to session, and yields done event. Gateway and SSE controller ensure done is always emitted on abort.

Files changed:

  • narrator.runner.ts — entity tracking, abort handler with done event
  • narrator.executor.ts — atomic event+effects transaction
  • narrator.gateway.ts — emit done on abort in finally block
  • narrator.controller.ts — emit done on abort in finally block

HU Updated by Hardelele User 22 minutes ago Actions #4

  • Status changed from Решена to Закрыта

Закрытие: задача решена ранее.

Actions

Also available in: PDF Atom