Repository navigation
[PLT-4664] Add Project.clear_queue_reservations - #2087
Conversation
Clears every reservation in one task queue of a project and returns how many reservations the queue held, or None when that count could not be read. Destructive and irreversible: holders lose their rows and unsaved work on them. Only reservations are cleared; no labels are deleted and no data rows are enqueued. Raises LabelboxError when the clear fails. Requires the clearQueueReservations mutation to be public (intelligence, PLT-4664). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9c9c3ce. Configure here.
| result = self.client.execute( | ||
| query_str, | ||
| {"input": {"projectId": self.uid, "queueId": task_queue_id}}, | ||
| )["clearQueueReservations"] |
There was a problem hiding this comment.
Missing queue raises TypeError
Medium Severity
When the queue is not in the project, client.execute returns None for a RESOURCE_NOT_FOUND GraphQL error. Indexing that result then raises TypeError instead of the documented ResourceNotFoundError, so callers catching that exception miss the failure.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 9c9c3ce. Configure here.
There was a problem hiding this comment.
Valid: execute returns None on RESOURCE_NOT_FOUND without raise_return_resource_not_found=True. This PR merged before the fix; fixed in #2090.


Description
Adds
Project.clear_queue_reservations(task_queue_id), which clears every reservation in one task queue of a project. It's the SDK equivalent of Clear all reservations on the project Queue tab. Customers asked for it so admins can unblock rows stuck in a queue without a support ticket (PLT-4664).Noneif that count couldn't be read (the clear still ran).LabelboxErrorwhen the server reports the clear failed, andResourceNotFoundErrorwhen the queue is not in the project.Depends on Labelbox/intelligence#31631, which makes the
clearQueueReservationsmutation public and addsclearedReservationCount. Release this after that PR is deployed; until then, calls fail with a schema error.Fixes PLT-4664 (SDK part)
Type of change
All Submissions
New Feature Submissions
Changes to Core Features
Tests:
tests/unit/test_unit_project_clear_queue_reservations.py(3 tests) pass locally, alongside the existing bulk-assign unit tests. No integration test yet, because it needs the API change deployed.🤖 Generated with Claude Code
Note
Medium Risk
Introduces a destructive, permission-gated queue operation that can drop labeler reservations and unsaved work; misuse or wrong queue ID could disrupt labeling, though existing behavior is unchanged.
Overview
Adds
Project.clear_queue_reservations(task_queue_id), exposing the Queue tab’s “clear all reservations” action in the Python SDK. The method calls theclearQueueReservationsGraphQL mutation with the project and queue IDs, returns how many reservations were cleared (orNoneif the count is unavailable), and raisesLabelboxErrorwhen the server reports failure. The docstring documents destructive impact (holders lose rows and unsaved work), permission requirements, and GitHub reservation-lifecycle limitations.Unit tests mock the client to verify mutation shape, successful count/
Nonereturns, and error handling onsuccess: false. Depends on backend PR makingclearQueueReservationspublic before this works in production.Reviewed by Cursor Bugbot for commit 9c9c3ce. Bugbot is set up for automated code reviews on this repo. Configure here.