I have a rugged tree object and I want to find out what is its path (relative to root) and what was the commit id when that tree was written. For example:
tree = repo.lookup '7892eeee70c08fae4db63aef7000dea39f883b30' #sha/oid of tree
What operations should I perform on this tree object so that I get its path and commit id?
That information is not stored in the tree at all. Git uses Merkle trees where the parents know what the children trees are, but each tree can be contained in multiple commits (this is the typical situation, as some subdirs are very rarely touched).
A tree may also be accessible through many different paths, if those directories have the same contents.
The only way to figure out where a tree belongs would be to go and look at each commit and recursively look from the root to see if you can find the tree you were given. This is going to be a very expensive operation.
I would recommend you take a step back and figure out why you think you need to figure out where a tree is reachable from. It sounds like you've already decided many steps and you're asking about a detail, when you should be looking at it from a higher level.