Improve QueueManager Documentation
Refactor: Add do_with_rebase_retry functio.

Extracted rebase and retry logic to a function.
Ignore the added test, it was previously left commented out.
Add `add_before` and `add_after` methods to QueueManager