refactor: change trace span to async context manager in knowledge_base_search refactor: enhance _run_sync_span for better trace handling and cleanup