fix(hitl): rollback on KB delete failure, tighten linear tool guards

- delete_linear_issue + delete_notion_page: add db_session.rollback()
  in the KB document deletion exception handler so the session is never
  left in a PendingRollbackError state after a failed commit, which
  would otherwise break all subsequent DB operations in the same request
- delete_linear_issue: include issue identifier (e.g. ENG-42) in the
  success message so the caller can confirm which issue was archived
- update_linear_issue: remove redundant label_ids ternary
  (x if x is not None else None -> x)
- create_linear_issue: add logger.error on empty-title guard for parity
  with the equivalent Notion tool
This commit is contained in:
CREDO23 2026-02-19 16:27:02 +02:00
parent ca624385a6
commit d4e2ebb99f
4 changed files with 7 additions and 5 deletions

View file

@ -240,8 +240,7 @@ def create_delete_notion_page_tool(
logger.warning(f"Document {document_id} not found in KB")
except Exception as e:
logger.error(f"Failed to delete document from KB: {e}")
# Don't fail the whole operation if KB deletion fails
# The page is already deleted from Notion, so inform the user
await db_session.rollback()
result["warning"] = (
f"Page deleted from Notion, but failed to remove from knowledge base: {e!s}"
)