Задача #19
closedЭпик #6: Architecture
B1: Abort mid-tool — orphaned entities
100%
Description
При abort mid-tool-execution остаются orphaned entities в БД. AgentRunner singleton, abort между tool executions а не внутри транзакций. Нужен cleanup step после abort.
HU Updated by Hardelele User about 6 hours ago
- 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 5 hours ago
Начата работа: исследование abort flow и orphaned entities для реализации cleanup.
HU Updated by Hardelele User about 4 hours ago
- Status changed from В работе to Решена
- % Done changed from 0 to 100
Implemented abort-safe entity handling:
-
Entity tracking in runner: Track all created entity IDs (blocks, events, lore, traits, fragments, characters) during run via
createdEntityIdsmap. -
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. -
Proper abort handling: On abort, runner now logs created entities, saves abort summary to session, and yields
doneevent. Gateway and SSE controller ensuredoneis 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 about 3 hours ago
- Status changed from Решена to Закрыта
Закрытие: задача решена ранее.