It is not automatic. You have to use workItemManager.completeWorkItem(...);
But, regarding to the work item Id, what you get when you do wi.getId() is something like a runtime id. Is an id that is only valid for the pocess instance where the work item handler got invoked. It has nothing to do with the id attribute of the Task node in your bpmn2 file.
AFAIK, there is no way to know that information inside a work item handler. I think you may need to preprocess this before the node and pass it as a parameter.
Best Regards,