From 6d252e062a52da5501c68f123016f7dd0a9ef0cc Mon Sep 17 00:00:00 2001 From: Marek Olszewski <999594+marekolszewski@users.noreply.github.com> Date: Wed, 5 Aug 2026 20:54:20 +0000 Subject: [PATCH] =?UTF-8?q?fix(tools):=20import=20asyncio=20in=20handlers?= =?UTF-8?q?=20=E2=80=94=20data-gen=20errors=20raised=20NameError?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `_execute_pipeline` guards its body with `except asyncio.CancelledError:`, but `handlers.py` never imported asyncio — that line was the module's only reference to the name. Python evaluates an except clause's expression only when an exception actually propagates to it, so this stayed invisible on the happy path. On any failure inside the try block, evaluating `asyncio.CancelledError` raised `NameError: name 'asyncio' is not defined`, which replaced the real exception and skipped the `except Exception` handler below it (telemetry + project-log error recording). Reproduced with no credentials, where `require_token()` — the second statement in the try block — raises RuntimeError: before: NameError: name 'asyncio' is not defined after: ❌ Pipeline failed: RuntimeError: Not logged in. Run /login to authenticate with lqh.ai. `ruff check --select F821` reports no undefined names in handlers.py after this change, and `pytest tests/unit` passes (1379 passed, 25 skipped). Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01H8BG6fPGiZjZ8nCB7f9x5h --- lqh/tools/handlers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lqh/tools/handlers.py b/lqh/tools/handlers.py index 4383506..7884f89 100644 --- a/lqh/tools/handlers.py +++ b/lqh/tools/handlers.py @@ -2,6 +2,7 @@ from __future__ import annotations +import asyncio import json import logging import os